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

Stops unplugging packages when the install scripts are disabled #6820

Merged
merged 3 commits into from Dec 14, 2018

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Dec 14, 2018

Summary

We currently unplug packages by default when they have postinstall scripts, since we can't run them from within the cache. This approach is fine, but we're a bit overzealous and we also do this when the user explicitly disabled the scripts.

This diff ensures that we don't automatically unplug packages anymore when the install scripts are disabled. Of note: packages that have already been unplugged won't be affected by this change (so for example, if you do yarn install && yarn install --ignore-scripts, the packages will still be unplugged).

Test plan

Should be simple enough not to be worth a test?

@arcanis arcanis merged commit f3fb110 into yarnpkg:master Dec 14, 2018
@edmorley
Copy link
Contributor

edmorley commented Dec 19, 2018

Hi!

Trying with Yarn 1.13.0 (which includes this change) this works when using --ignore-scripts however does not when using ignore-scripts true in a .yarnrc in the repository root (even though the console output in both cases mentions ignoring scripts).

Is this expected?

@arcanis
Copy link
Member Author

arcanis commented Dec 19, 2018

Nope, not expected 😮 Can you try adding --ignore-scripts true in your .yarnrc and see if it has an effect? I don't see why the two would be any different, but ...

@edmorley
Copy link
Contributor

Using --ignore-scripts true in the .yarnrc worked.

In all cases (CLI flag and both forms of the .yarnrc option) the console output included:
warning Ignored scripts due to flag.

...but I'm presuming that's because the option is retrieved via flags instead?

if (this.flags.ignoreScripts) {
this.reporter.warn(this.reporter.lang('ignoredScripts'));

@arcanis
Copy link
Member Author

arcanis commented Dec 19, 2018

Well, ignore-scripts true should not have any effect whatsoever - the settings can only be set from the command line afaik (and the yarnrc, but only through the command-line syntax). Compare here:

yarn/src/config.js

Lines 399 to 400 in eb2b565

this.ignorePlatform = !!opts.ignorePlatform;
this.ignoreScripts = !!opts.ignoreScripts;

Versus here (which also accepts the no-cli rc defintition):

yarn/src/config.js

Lines 310 to 312 in eb2b565

cafile: String(opts.cafile || this.getOption('cafile', true) || ''),
cert: String(opts.cert || this.getOption('cert') || ''),
key: String(opts.key || this.getOption('key') || ''),

@edmorley
Copy link
Contributor

Well, ignore-scripts true should not have any effect whatsoever

It does affect whether the scripts are run, see:

In all cases (CLI flag and both forms of the .yarnrc option) the console output included:
warning Ignored scripts due to flag.

@edmorley
Copy link
Contributor

edmorley commented Jan 9, 2019

I've broken out the issue above to #6893.

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.

None yet

2 participants