-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save Generator Version in Environment #90
Save Generator Version in Environment #90
Conversation
Thanks for the PR |
@SBoudrias Do you have an idea why the builds are failing lately? Update: Test are passing locally in master branch. |
lib/resolver.js
Outdated
for (const modulePath of generatorsModules) { | ||
patterns.push(path.join(modulePath, lookup)); | ||
for (const module of generatorsModules) { | ||
patterns.push({...module, path: path.join(module.path, lookup)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we are not ready to use object rest/spread properties 😞
lib/resolver.js
Outdated
for (const filename of globby.sync('*/index.js', {cwd: pattern})) { | ||
this._tryRegistering(path.join(pattern, filename)); | ||
for (const filename of globby.sync('*/index.js', {cwd: pattern.path})) { | ||
this._tryRegistering({...pattern, path: path.join(pattern.path, filename)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we are not ready to use object rest/spread properties 😞
20e9dd4
to
d080adb
Compare
Removed the use of ...spread operators. |
d080adb
to
b20a432
Compare
Code LGTM |
lib/store.js
Outdated
this._meta[namespace] = { | ||
resolved: path, | ||
namespace | ||
namespace, | ||
version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading/requiring files is a pretty costly operation. I wonder if instead we wouldn't be better to setup version as a property getter that will lazily require the package.json
at the resolved
location when the property is accessed.
Then we wouldn't incur the performance hit for every single operations, only when we'll actually display the version number.
When storing as module instead of path, then we could just setup the version as unknown.
b20a432
to
af55d79
Compare
af55d79
to
d607f3b
Compare
@SBoudrias Switched to a |
33d5f59
to
3393b40
Compare
Any update? |
The first step of yeoman/yo#542 involves persisting the generator version # when the Environment is being initialized. That way we'll have access to it later when we want to display it to the User.