-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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(upgrade, add): Separately log added/upgraded dependencies #5227
Conversation
…transitive When adding or upgrading dependencies, group the dependencies into directly required ones vs. transitive ones so that version shown is clearer to the end user. https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-show-updated-packages-only.md
This change will increase the build size from 10.44 MB to 10.44 MB, an increase of 3.25 KB (0%)
|
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.
One change I think we should make (the key
passed to the reporter.tree(
and an optional suggestion on the test.
__tests__/index.js
Outdated
expect(lastLines[0]).not.toEqual('success Saved lockfile.'); | ||
expect(lastLines[1]).toEqual('success Saved 1 new dependency.'); | ||
expect(lastLines[2]).toContain(pkg); | ||
expect(lastLines[3]).toContain('Done'); |
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.
Wondering if converting this test to a "snapshot" would be easier than trying to maintain this "index of line of output" approach...
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 was thinking that too, great idea
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.
So I had to make the tests not run concurrently (otherwise the snapshots would match random stdout depending on the order the commands ran) and still slice the output (remove yarn version and the time it took to complete the command), but I think the change is still worthwhile for developer experience.
src/cli/commands/add.js
Outdated
const directRequireDependencies = trees.filter(({name}) => resolverPatterns.has(name)); | ||
|
||
this.reporter.info(this.reporter.lang('directDependencies')); | ||
this.reporter.tree('newDependencies', directRequireDependencies); |
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 think we might want different keys instead of reusing 'newDependencies'
for the 2 calls to .tree(
. It doesn't matter for the console-reporter, but if you --json
to use the json-reporter, this key could be used to differentiate the two trees if parsing the json output. Maybe change this one to 'newDirectDependencies'
.
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.
ah, that's what it was used for! Will fix :)
…readdir_files * upstream/master: (34 commits) feat(upgrade, add): Separately log added/upgraded dependencies (yarnpkg#5227) feat(publish): Publish command uses publishConfig.access in package.json (yarnpkg#5290) fix(CLI): Use process exit instead of exitCode for node < 4 (yarnpkg#5291) feat(cli): error on missing workspace directory (yarnpkg#5206) (yarnpkg#5222) feat: better error when package is not found (yarnpkg#5213) Allow scoped package as alias source (yarnpkg#5229) fix(cli): Use correct directory for upgrade-interactive (yarnpkg#5272) nohoist baseline implementation (yarnpkg#4979) 1.4.1 1.4.0 Show current version, when new version is not supplied on "yarn publish" (yarnpkg#4947) fix(install): use node-gyp from homebrew npm (yarnpkg#4994) Fix transient symlinks overriding direct ones v2 (yarnpkg#5016) fix(auth): Fixes authentication conditions and logic with registries (yarnpkg#5216) chore(package): move devDeps to appropriate place (yarnpkg#5166) fix(resolution) Eliminate "missing peerDep" warning when dep exists at root level. (yarnpkg#5088) fix(cli): improve guessing of package names that contain a dot (yarnpkg#5102) (yarnpkg#5135) feat(cli): include notice with license when generating disclaimer (yarnpkg#5072) (yarnpkg#5111) feat(cli): group by license in licenses list (yarnpkg#5074) (yarnpkg#5110) feat(cli): improve error message when file resolver can't find file (yarnpkg#5134) (yarnpkg#5145) ...
Implementation of feature https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-show-updated-packages-only.md
When adding or upgrading dependencies, group them into directly required ones vs.
transitive ones so that version shown is clearer to the end user.
https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-show-updated-packages-only.md
Summary
Test plan
Added a test in upgrade.js