Skip to content

Conversation

@arcanis
Copy link
Member

@arcanis arcanis commented Jun 19, 2023

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-gyp warnings were for the most part unactionable (at best the user would pin a fixed version in their packageExtensions field, which I suspect no one ever did).

  • The deprecated warnings 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-gyp warnings have been removed.

  • The deprecated warnings have been removed from the install. The yarn npm audit command 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 run yarn 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

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis
Copy link
Member Author

arcanis commented Jun 19, 2023

Perhaps we can also consider removing the "forgettable messages" mechanism, since they are complex and not that useful (the only other forgettable message is UNUSED_CACHE_ENTRY, which we could easily aggregate into a single line, like we do here).

@arcanis arcanis changed the title Makes preferAggregateCacheInfo default to true Modernizes installs' output Jun 19, 2023
@paul-soporan paul-soporan self-requested a review June 19, 2023 14:29
@merceyz
Copy link
Member

merceyz commented Jun 19, 2023

There are some issues that this probably fixes (for example #4165), could you check and link to them so they're closed?

@paul-soporan paul-soporan mentioned this pull request Jun 20, 2023
7 tasks
Copy link
Member

@paul-soporan paul-soporan left a 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 🤔

@arcanis arcanis requested a review from paul-soporan June 21, 2023 10:53
@arcanis
Copy link
Member Author

arcanis commented Jun 22, 2023

I think the PR is ready, I'll land it this afternoon unless someone sees a significant blocker.

@arcanis arcanis merged commit ec7f37a into master Jun 22, 2023
@arcanis arcanis deleted the mael/no-cache-messages branch June 22, 2023 13:00
@paul-soporan
Copy link
Member

Looks good 👍

github-merge-queue bot pushed a commit that referenced this pull request Jun 24, 2023
**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]>
arcanis added a commit to yarnpkg/example-repo-zipn that referenced this pull request Jul 3, 2023
**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]>
arcanis added a commit that referenced this pull request Jul 18, 2023
**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]>
arcanis added a commit that referenced this pull request Nov 3, 2023
**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.
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.

[Bug?]: Terminal output makes yarn install very slow

4 participants