-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Modernizes installs' output #5509
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
Conversation
|
Perhaps we can also consider removing the "forgettable messages" mechanism, since they are complex and not that useful (the only other forgettable message is |
preferAggregateCacheInfo default to true|
There are some issues that this probably fixes (for example #4165), could you check and link to them so they're closed? |
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.
Nice work! Left an in-depth review, but overall I really like the changes 👍
Note: We shouldn't forget to update the CHANGELOG, either now or later, especially with the breaking changes.
The resolution step is now expected to only do one of two things: either report an error when the resolution fails, or report the packages which got added / removed from the lockfile.
Note that this is expected, not enforced, as proven by the fact that nothing prevented you from forgetting to remove the deprecation warnings during installs.
Perhaps we should do something about it 🤔
|
I think the PR is ready, I'll land it this afternoon unless someone sees a significant blocker. |
|
Looks good 👍 |
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> Follow-up to #5509 (comment). Changed package detection can be optimized because of an important property of the resolution process: `startPackageResolution` is guaranteed to be run a single time for a given package. **How did you fix it?** <!-- A detailed description of your implementation. --> Because of this we can: - start with a list of the initial packages - for each package that we resolve, we delete it from the list - if the deletion was successful, it means that the package has existed before and exists now too - otherwise, it means the package didn't exist before and we can add it to `addedPackages` - in the end, `initialPackages` will only contain the removed packages **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [X] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [X] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [X] I will check that all automated PR checks pass before the PR gets reviewed. Co-authored-by: Maël Nison <[email protected]>
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> Follow-up to yarnpkg/berry#5509 (comment). Changed package detection can be optimized because of an important property of the resolution process: `startPackageResolution` is guaranteed to be run a single time for a given package. **How did you fix it?** <!-- A detailed description of your implementation. --> Because of this we can: - start with a list of the initial packages - for each package that we resolve, we delete it from the list - if the deletion was successful, it means that the package has existed before and exists now too - otherwise, it means the package didn't exist before and we can add it to `addedPackages` - in the end, `initialPackages` will only contain the removed packages **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [X] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [X] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [X] I will check that all automated PR checks pass before the PR gets reviewed. Co-authored-by: Maël Nison <[email protected]>
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> While reviewing #5509, I noticed that the `--mode` flag wasn't passed to `yarn up --recursive`. The issue started in #2913, when the flag was originally introduced. **How did you fix it?** <!-- A detailed description of your implementation. --> Made it pass `--mode` to `yarn up --recursive` and added tests. **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [X] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [X] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [X] I will check that all automated PR checks pass before the PR gets reviewed. --------- Co-authored-by: Maël Nison <[email protected]>
**What's the problem this PR addresses?** <!-- Describe the rationale of your PR. --> <!-- Link all issues that it closes. (Closes/Resolves #xxxx.) --> The refactoring in #5509 accidentally dropped the `includeLogs: true` from the `yarn install` implementation. Fixes #5866 **How did you fix it?** I considered extending `installWithNewReport` to have a new `includeLogs` property, but it felt like this behaviour was unneeded for other use cases than `yarn install`, so I simply switched the `yarn install` implementation so that it manually creates the report stream rather than delegate to `installWithNewReport`. **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
What's the problem this PR addresses?
I wasn't entirely happy with the Yarn output:
When running
yarn add, we have no way to know what packages are actually added to the lockfile. The cache messages sometimes help, but with zero-installs now being opt-in, in many cases the packages would already be in the cache and thus wouldn't be displayed at all.The "can't be found in the cache and will be fetched from the remote registry" messages were incredibly slow to print - the same install would take 28s install for Gatsby on a local iTerm 2 without those logs, vs almost 2 minutes with. They also weren't very useful: we were only showing the last 5 of them, and with zero-installs being opt-in in many cases they wouldn't be shown at all.
The
node-gypwarnings were for the most part unactionable (at best the user would pin a fixed version in theirpackageExtensionsfield, which I suspect no one ever did).The
deprecatedwarnings were for the most part unactionable, and only printed in very specific cases (the first time they were added to the project).The "missing / invalid peer dependency" warnings were actionable, but in practice no one really look at them except when something breaks - and even then, it becomes unreadable when there are too many of them.
The skipped build warnings were printed every single time you ran
yarn install. It's nice to know the first time, then it quickly becomes redundant.Fixes #4165
How did you fix it?
I went a little overboard and did everything in the same PR ... at first I thought I wouldn't have to change unrelated parts, but then I finished implementing the skipped build warnings duplicate removal and oh no 🙈
Only peer dependency warnings caused by workspaces are now reporter. They have also been moved inside the post-resolution validation step. The resolution step is now expected to only do one of two things: either report an error when the resolution fails, or report the packages which got added / removed from the lockfile.
The
node-gypwarnings have been removed.The
deprecatedwarnings have been removed from the install. Theyarn npm auditcommand now reports deprecated packages, although this can be disabled using--no-deprecations(or any of the audit filtering settings).The "can't be found in the cache" messages have been removed. Instead, the fetch step will report the number of cache hits / cache misses once it's finished (same behaviour as
preferAggregateCacheInfo). The size delta will also be reported.Packages whose build was skipped are now stored within
Project#skippedBuilds, which is stored within the install state file. Warnings are only emitted if the install was skipped for the first time. To see the messages again, users can runyarn rebuild.Added the Yarn version on installs. A bit because of branding when screenshot are taken, but mostly so we easily know what version are people using when they share screenshots to us. In a follow-up PR I'd like to try to retrieve the latest version from the website, to let them know once one is available.
Checklist