Skip to content
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

Implements "yarn policies set-version" #6673

Merged
merged 5 commits into from
Nov 20, 2018
Merged

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Nov 13, 2018

Summary

This feature implements a new command:

$> yarn policies set-version [range]
# Examples:
$> yarn policies set-version nightly
$> yarn policies set-version rc
$> yarn policies set-version ^1.12
$> yarn policies set-version 1.12.3

When run, Yarn will download from Github the latest release matching the specified range, will put it inside the <lockfileFolder>/.yarn/releases directory, and will update <lockfileFolder>/.yarnrc to point to this new binary.

Essentially, this command allows:

  • to upgrade Yarn in a single swoop
  • to rely on npm much less (which always was a bit funny)
  • to enforce a specific Yarn version for a single project

This last point is especially important: we've been recommending people to use the same Yarn release across a team, but they usually had to discover by themselves that the yarn-path settings existed (despite it being one of the selling points in term of build reproducibility). Once they did they loved it, but it wasn't an easy find.

Test plan

I'm not too sure how to test this automatically, but I've tested it manually and it works just fine.

@buildsize
Copy link

buildsize bot commented Nov 13, 2018

File name Previous Size New Size Change
yarn-[version].noarch.rpm 1.1 MB 1.1 MB 43 bytes (0%)
yarn-[version].js 4.46 MB 4.47 MB 5.25 KB (0%)
yarn-legacy-[version].js 4.65 MB 4.66 MB 5.46 KB (0%)
yarn-v[version].tar.gz 1.11 MB 1.12 MB 3.01 KB (0%)
yarn_[version]all.deb 813.62 KB 814.53 KB 928 bytes (0%)

@arcanis
Copy link
Member Author

arcanis commented Nov 16, 2018

I'm considering renaming this command to yarn policies set-version in order to implement other such "auto-configure" policies in the future (for example yarn policies inline-cache to automatically configure the cache to be local to the project, etc).

@arcanis arcanis merged commit 158da6c into yarnpkg:master Nov 20, 2018
@arcanis arcanis mentioned this pull request Nov 29, 2018
@arcanis arcanis changed the title Implements "yarn self set" Implements "yarn policies set-version" Nov 29, 2018
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 17, 2019
## 1.13.0

- Implements a new `package.json` field: `peerDependenciesMeta`

  [6671](yarnpkg/yarn#6671) - [**Maël Nison**](https://twitter.com/arcanis)

- Adds an `optional` settings to `peerDependenciesMeta` to silence missing peer dependency warnings

  [6671](yarnpkg/yarn#6671) - [**Maël Nison**](https://twitter.com/arcanis)

- Implements `yarn policies set-version [range]`. Check [the documentation]() for usage & tips.

  [6673](yarnpkg/yarn#6673) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes a resolution issue when a package had an invalid `main` entry

  [6682](yarnpkg/yarn#6682) - [**Maël Nison**](https://twitter.com/arcanis)

- Decreases the size of the generated `$PATH` environment variable for a better Windows support

  [6683](yarnpkg/yarn#6683) - [**Rowan Lonsdale**](https://github.com/hWorblehat)

- Fixes postinstall scripts for third-party packages when they were referencing a binary from their own dependencies

  [6712](yarnpkg/yarn#6712) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes yarn audit exit code overflow

  [6748](yarnpkg/yarn#6748) - [**Andrey Vetlugin**](https://github.com/antrew)

- Stops automatically unplugging packages with postinstall script when running under `--ignore-scripts`

  [6820](yarnpkg/yarn#6820) - [**Maël Nison**](https://twitter.com/arcanis)

- Adds transparent support for the [`resolve`](https://github.com/browserify/resolve) package when using Plug'n'Play

  [6816](yarnpkg/yarn#6816) - [**Maël Nison**](https://twitter.com/arcanis)

- Properly reports the error codes when the npm registry throws 500's

  [6817](yarnpkg/yarn#6817) - [**Maël Nison**](https://twitter.com/arcanis)
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.

1 participant