Skip to content

Commit dbf08a8

Browse files
authoredJun 22, 2023
Modernizes installs' output (#5509)
**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** <!--- 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.
1 parent c09239b commit dbf08a8

File tree

55 files changed

+973
-683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+973
-683
lines changed
 

‎.yarn/versions/90cd4b88.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
releases:
2+
"@yarnpkg/builder": major
3+
"@yarnpkg/cli": major
4+
"@yarnpkg/core": major
5+
"@yarnpkg/plugin-essentials": major
6+
"@yarnpkg/plugin-interactive-tools": major
7+
"@yarnpkg/plugin-nm": major
8+
"@yarnpkg/plugin-npm": major
9+
"@yarnpkg/plugin-npm-cli": major
10+
"@yarnpkg/plugin-pnp": major
11+
"@yarnpkg/plugin-pnpm": major
12+
"@yarnpkg/plugin-version": major
13+
"@yarnpkg/plugin-workspace-tools": major
14+
15+
declined:
16+
- "@yarnpkg/plugin-compat"
17+
- "@yarnpkg/plugin-constraints"
18+
- "@yarnpkg/plugin-dlx"
19+
- "@yarnpkg/plugin-exec"
20+
- "@yarnpkg/plugin-file"
21+
- "@yarnpkg/plugin-git"
22+
- "@yarnpkg/plugin-github"
23+
- "@yarnpkg/plugin-http"
24+
- "@yarnpkg/plugin-init"
25+
- "@yarnpkg/plugin-link"
26+
- "@yarnpkg/plugin-pack"
27+
- "@yarnpkg/plugin-patch"
28+
- "@yarnpkg/plugin-stage"
29+
- "@yarnpkg/plugin-typescript"
30+
- "@yarnpkg/doctor"
31+
- "@yarnpkg/extensions"
32+
- "@yarnpkg/nm"
33+
- "@yarnpkg/pnpify"
34+
- "@yarnpkg/sdks"

‎CHANGELOG.md

+33-14
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,39 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:
1010

1111
### **Major Changes**
1212

13-
- The `yarn set version` command will now skip generating the `yarnPath` configuration on new projects if it detects you're using [Corepack](https://nodejs.org/api/corepack.html)
13+
- Some important defaults have changed:
14+
- `yarn set version` will now skip generating the `yarnPath` configuration on new projects if it detects you're using [Corepack](https://nodejs.org/api/corepack.html).
15+
- `yarn init` will no longer use zero-install by default.
1416
- All official Yarn plugins are now included by default in the bundle we provide. You no longer need to run `yarn plugin import` for *official* plugins (you still need to do it for third-party plugins, of course).
1517
- This doesn't change anything to the plugin API we provide, which will keep being maintained (Yarn still has a modular architecture and uses the exact same APIs as contrib plugins; all that changes is how we distribute our own features).
18+
- Yarn's UI during installs has been greatly improved:
19+
- Packages added and removed from the lockfile are now explicitly called out.
20+
- Changes to the project cache are now reported as a single line.
21+
- Unactionable warnings (`node-gyp` and transitive peer dependency errors) have been removed.
22+
- Skipped builds are now reported during the first installs only (and subsequent `yarn rebuild` calls).
23+
- The Yarn version is now displayed (to help us investigate issues [when reported as screenshots](https://discord.com/channels/226791405589233664/749942897071357954/935110539313565746)).
24+
- Deprecations have been moved to `yarn npm audit`.
25+
- Some settings were renamed or removed:
26+
- `caFilePath` is now `httpsCaFilePath`
27+
- `preferAggregateCacheInfo` has been removed (it's now always on)
28+
- `pnpDataPath` has been removed to adhere to our new [PnP specification](https://yarnpkg.com/advanced/pnp-spec). For consistency, all PnP files will now be hardcoded to a single value so that third-party tools can implement the PnP specification without relying on the Yarn configuration.
29+
- The `yarn npm audit` command has been reimplemented:
30+
- A registry providing the `/-/npm/v1/security/advisories/bulk` endpoint is now expected. Make sure your registry supports it, and let them know you need it otherwise (in the meantime you can use `npmAuditRegistry` to send your audit queries to the npm registry).
31+
- Deprecations are now returned by default. To silence them, use `--no-deprecations`.
1632
- Some legacy layers have been sunset:
1733
- Plugins cannot access the Clipanion 2 APIs anymore (upgrade to [Clipanion 3](https://github.com/arcanis/clipanion))
1834
- Plugins cannot access the internal copy of Yup anymore (use [Typanion](https://github.com/arcanis/typanion) instead)
19-
- The network settings configuration option has been renamed from `caFilePath` to `httpsCaFilePath`.
20-
- `yarn workspaces foreach` now automatically enables the `-v,--verbose` flag in interactive terminal environments.
21-
- `yarn npm audit` no longer takes into account publish registries. Use [`npmAuditRegistry`](https://yarnpkg.com/configuration/yarnrc#npmAuditRegistry) instead.
22-
- `yarn npm audit` has been fully rewritten to use the newer `/-/npm/v1/security/advisories/bulk` endpoint. Make sure your registry supports it, and let them know you need it otherwise (in the meantime you can use `npmAuditRegistry` to send your audit queries to the npm registry).
23-
- The `--assume-fresh-project` flag of `yarn init` has been removed. Should only affect people initializing Yarn 4+ projects using a Yarn 2 binary.
24-
- `yarn init` no longer enables zero-installs by default.
25-
- Yarn will no longer remove the old Yarn 2.x `.pnp.js` file when migrating.
26-
- The `pnpDataPath` option has been removed to adhere to our new [PnP specification](https://yarnpkg.com/advanced/pnp-spec). For consistency, all PnP files will now be hardcoded to a single value so that third-party tools can implement the PnP specification without relying on the Yarn configuration.
27-
- The `ZipFS` and `ZipOpenFS` classes have been moved from `@yarnpkg/fslib` to `@yarnpkg/libzip`. They no longer need or accept the `libzip` parameter.
28-
- Yarn now assumes that the `fs.lutimes` bindings are always available (which is true for all supported Node versions).
29-
- Some libzip bindings are no longer needed for `ZipFS` and have been removed:
30-
- `open`
31-
- `ZIP_CREATE` & `ZIP_TRUNCATE`
35+
- Yarn will no longer remove the old Yarn 2.x `.pnp.js` file when migrating.
36+
- The `--assume-fresh-project` flag of `yarn init` has been removed.
3237

3338
### **API Changes**
3439

3540
The following changes only affect people writing Yarn plugins:
3641

42+
- The `ZipFS` and `ZipOpenFS` classes have been moved from `@yarnpkg/fslib` to `@yarnpkg/libzip`. They no longer need or accept the `libzip` parameter.
43+
44+
- Reading the zip archives is now done on the Node.js side for performance; as a result, the `open`, `ZIP_CREATE`, and `ZIP_TRUNCATE` bindings are no longer needed for `ZipFS` and have also been removed.
45+
3746
- The `dependencies` field sent returned by `Resolver#resolve` must now be the result of a `Configuration#normalizeDependencyMap` call. This change is prompted by a refactoring of how default protocols (ie `npm:`) are injected into descriptors. The previous implementation caused various descriptors to never be normalized, which made it difficult to know what were the descriptors each function should expect.
3847

3948
- Similarly, the descriptors returned by `Resolve#getResolutionDependencies` are now expected to be the result of `Configuration#normalizeDependency` calls.
@@ -66,11 +75,21 @@ The following changes only affect people writing Yarn plugins:
6675

6776
- `workspace.dependencies` has been removed. Use `workspace.anchoredPackage.dependencies` instead.
6877

78+
- The `Installer` class must now return `BuildRequest` structures instead of `BuildDirective[]`. This lets you mark that the build must be skipped, and the reason why.
79+
80+
- `startCacheReport` has been removed, and is now part of the output generated by `fetchEverything`.
81+
82+
- `forgettableNames` & `forgettableBufferSize` have been removed (the only messages using them have been removed, making the forgettable logs implementation obsolete).
83+
6984
### Installs
7085

7186
- The `pnpm` linker avoids creating symlinks that lead to loops on the file system, by moving them higher up in the directory structure.
7287
- The `pnpm` linker no longer reports duplicate "incompatible virtual" warnings.
7388

89+
### Features
90+
91+
- `yarn workspaces foreach` now automatically enables the `-v,--verbose` flag in interactive terminal environments.
92+
7493
### Bugfixes
7594

7695
- `yarn dlx` will no longer report false-positive `UNUSED_PACKAGE_EXTENSION` warnings

0 commit comments

Comments
 (0)
Please sign in to comment.