Skip to content

Conversation

@wraithgar
Copy link
Member

This adds some lazy loading, inlines some single use functions, and also
removes the "define" function in the definitions file. That was
guarding against something that isn't worth the runtime to check for.

@wraithgar
Copy link
Member Author

wraithgar commented Apr 10, 2024

Draft because this won't automatically run the npm tests. I will do that locally to make sure nothing broke there.

npm tests fixed, added a config test to make sure we keep the definitions sorted (will help guard against the one thing define() was doing)

}

if (this.localPrefix && hasPackageJson) {
const rpj = require('read-package-json-fast')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use none of the normalization here, we should consider using the underlying JSON parser in this situation.


const semver = require('semver')
class Umask {}
class Semver {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@H4ad the class is meaningless it's just a unique "object" to hang nopt definitions off of. I opted for the same as Umask here instead. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't matter, I think it's okay.

I'd rather have our own version than import from semver, even though the import time from classes/semver is being measured in us.

@wraithgar wraithgar marked this pull request as ready for review April 10, 2024 14:47
@wraithgar wraithgar requested a review from a team as a code owner April 10, 2024 14:47
@wraithgar wraithgar merged commit 3760dd2 into latest Apr 10, 2024
@wraithgar wraithgar deleted the gar/config-perf branch April 10, 2024 17:19
@github-actions github-actions bot mentioned this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants