-
Notifications
You must be signed in to change notification settings - Fork 12k
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
feat(version): display verions of @angular/* and @ngtools/* #3592
Conversation
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.
Linting and building are both failing.
@hansl PR updated to resolve the lint and build issues. |
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.
A few comments.
@@ -14,12 +14,19 @@ const VersionCommand = Command.extend({ | |||
}], | |||
|
|||
run: function (options: any) { | |||
const versions: any = process.versions; | |||
let versions: any = process.versions; |
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.
Why the change?
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.
Because later on I have this...
versions = Object.assign(versions, this.getModules(projPkg, root));
which disallows the use of const
isRoot = true; | ||
} | ||
}); | ||
if (options.verbose || alwaysPrint.indexOf(module) > -1 || isRoot) { |
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.
isRoot
could be set to roots.some(root => module.startsWith(root))
and it would be simpler.
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.
yes, cleaner
}, | ||
|
||
getVersion: function(moduleName: string): string { | ||
const modulePkg = require(path.resolve( |
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.
Could you at least try locally to nom link
angular itself and run ng version
? Just wanna make sure that works.
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 tested locally via npm link for both inside and outside of CLI projects.
} | ||
} | ||
if (pkg.devDependencies) { | ||
for (let key of Object.keys(pkg.devDependencies)) { |
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.
This whole function could be simplified to:
Object.keys(pkg.dependencies || {})
.concat(Object.keys(pkg.devDependencies || {}))
.filter(depName => depName && depName.startsWith(prefix))
.forEach(depName => modules[key] = this.getVersion(key));
What do you think?
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 like this as well, updated this function, but had to fix a minor issue with what you have here
this.printVersion(module, versions[module]); | ||
} | ||
} | ||
}, | ||
|
||
getModules: function(pkg: any, prefix: string): any { |
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.
getDependencyVersions
or getVersionsOfDependencies
might be a better name, what do you think?
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 like getDependencyVersions
and went with that.
LGTM! Thanks! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #3589