What Renovate type, platform and version are you using?
Self hosted
Describe the bug
Using yarn 2, renovate changes the package location from unplugged to cache in the .pnp.js file.
Running yarn locally then changes it back again. Which means this file needs to be recommitted after every PR.

To Reproduce
This only happens with packages that need to be unplugged by yarn 2. nodemon for example.
Can this problem be reproduced in a public repo?
Yey, I also have a public repo where it happens:
https://github.com/brummelte/eslint-config
This commit changed core-js from unplugged to cache:
https://github.com/brummelte/eslint-config/commit/6996c4d05071d11cf27472c58f87a1f3963f2066
fix(deps): update dependency eslint-config-prettier to ^6.14.0
If I now run yarn locally, it switches it back to unplugged in .pnp.js.
I've committed the .pnp.js changes and rebased some renovate PRs, so that you can see it happening.
https://github.com/brummelte/eslint-config/pull/20/commits/21ac02fdf659d298465b038636b23cca5bf05c19
Has fixed it. But all open renovate PRs change it back.
what is the command renovate uses and what is the command you use to run yarn?
I run yarn or yarn install or even yarn install --immutable --immutable-cache.
All of them produce the same .pnp.js.
Renovate seems to produce a different one though.
The debug log should tell you which exact commands are run
I can't find any details in the debug log.
There is no mention of any yarn command and no mention of pnp.js.
You'll only see it on the run/log when yarn was run and the commit was made. if there's another run after that with no yarn work to do, you won't see a log there. i.e. need to match commit time to job log time.
It did update the branch though. And it seems without rerunning yarn.
I've now removed a MR and let renovate recreate it.
Now I can see the commands being run.
It seems renovate uses just yarn install too.
But also sets the environment variable YARN_ENABLE_SCRIPTS to disabled.
Which means yarn will not unplug packages that have build scripts.
core-js-pure@npm:3.6.5 lists build scripts, but all build scripts have been disabled.
Click to expand debug log
DEBUG: getBranchPr(renovate/eslint-config-prettier-6.x)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: findPr(renovate/eslint-config-prettier-6.x, undefined, open)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: processBranch with 1 upgrades(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Setting current branch to master(branch="renovate/eslint-config-prettier-6.x")
DEBUG: latest commit(branch="renovate/eslint-config-prettier-6.x")
{
"branchName": "master",
"latestCommitDate": "2020-10-28T12:24:22+01:00"
}
DEBUG: getBranchPr(renovate/eslint-config-prettier-6.x)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: findPr(renovate/eslint-config-prettier-6.x, undefined, open)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: branchExists=false(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Branch has 1 upgrade(s)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: recreateClosed is false(branch="renovate/eslint-config-prettier-6.x")
DEBUG: findPr(renovate/eslint-config-prettier-6.x, fix(deps): update dependency eslint-config-prettier to ^6.15.0, !open)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: prAlreadyExisted=false(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Checking schedule(at any time, null)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: No schedule defined(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Branch needs creating(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Using reuseExistingBranch: false(branch="renovate/eslint-config-prettier-6.x")
DEBUG: manager.getUpdatedPackageFiles()(branch="renovate/eslint-config-prettier-6.x")
{
"reuseExistingBranch": false,
"branchName": "renovate/eslint-config-prettier-6.x"
}
DEBUG: npm.updateDependency(): dependencies.eslint-config-prettier = ^6.15.0(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Updating packageFile content(packageFile="package.json", branch="renovate/eslint-config-prettier-6.x")
{
"depName": "eslint-config-prettier"
}
DEBUG: Updated 1 package files(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Getting updated lock files(branch="renovate/eslint-config-prettier-6.x")
DEBUG: lock file dirs(branch="renovate/eslint-config-prettier-6.x")
{
"dirs": {
"yarnLockDirs": [
"yarn.lock"
],
"npmLockDirs": [],
"pnpmShrinkwrapDirs": [],
"lernaDirs": []
}
}
DEBUG: Writing repo .yarnrc (/mnt/renovate/gh/brummelte/eslint-config)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Writing package.json files(branch="renovate/eslint-config-prettier-6.x")
{
"packageFiles": [
".vscode/pnpify/eslint/package.json",
".vscode/pnpify/prettier/package.json",
"package.json"
]
}
DEBUG: Writing .yarnrc to /mnt/renovate/gh/brummelte/eslint-config(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Writing any updated package files(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Writing package.json(branch="renovate/eslint-config-prettier-6.x")
DEBUG: No npmrc file found in repository(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Writing updated .npmrc file to /mnt/renovate/gh/brummelte/eslint-config/.npmrc(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Generating yarn.lock for .(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Spawning yarn install to create /mnt/renovate/gh/brummelte/eslint-config/yarn.lock(branch="renovate/eslint-config-prettier-6.x")
DEBUG: No node constraint found - using latest(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Using docker to execute(branch="renovate/eslint-config-prettier-6.x")
DEBUG: No tag or tagConstraint specified(branch="renovate/eslint-config-prettier-6.x")
{
"image": "docker.io/renovate/node"
}
DEBUG: Docker image is already prefetched: docker.io/renovate/node(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Executing command(branch="renovate/eslint-config-prettier-6.x")
{
"command": "docker run --rm --name=renovate_node --label=renovate_child -v \"/mnt/renovate/gh/brummelte/eslint-config\":\"/mnt/renovate/gh/brummelte/eslint-config\" -v \"/tmp/renovate-cache\":\"/tmp/renovate-cache\" -v \"/home/ubuntu/.npmrc\":\"/home/ubuntu/.npmrc\" -e NPM_CONFIG_CACHE -e npm_config_store -e CI -e YARN_HTTP_TIMEOUT -e YARN_ENABLE_SCRIPTS -w \"/mnt/renovate/gh/brummelte/eslint-config\" docker.io/renovate/node bash -l -c \"npm i -g yarn && yarn install\""
}
DEBUG: exec completed(branch="renovate/eslint-config-prettier-6.x")
{
"cmd": "docker run --rm --name=renovate_node --label=renovate_child -v \"/mnt/renovate/gh/brummelte/eslint-config\":\"/mnt/renovate/gh/brummelte/eslint-config\" -v \"/tmp/renovate-cache\":\"/tmp/renovate-cache\" -v \"/home/ubuntu/.npmrc\":\"/home/ubuntu/.npmrc\" -e NPM_CONFIG_CACHE -e npm_config_store -e CI -e YARN_HTTP_TIMEOUT -e YARN_ENABLE_SCRIPTS -w \"/mnt/renovate/gh/brummelte/eslint-config\" docker.io/renovate/node bash -l -c \"npm i -g yarn && yarn install\"",
"durationMs": 22139,
"stdout": "\n> [email protected] preinstall /home/ubuntu/.npm-global/lib/node_modules/yarn\n> :; (node ./preinstall.js > /dev/null 2>&1 || true)\n\n/home/ubuntu/.npm-global/bin/yarn -> /home/ubuntu/.npm-global/lib/node_modules/yarn/bin/yarn.js\n/home/ubuntu/.npm-global/bin/yarnpkg -> /home/ubuntu/.npm-global/lib/node_modules/yarn/bin/yarn.js\n+ [email protected]\nadded 1 package in 1.497s\n⤠YN0000: ā Resolution step\n⤠YN0000: ā Completed in 0.87s\n⤠YN0000: ā Fetch step\n⤠YN0013: ā 883 packages were already cached, one had to be fetched\n⤠YN0019: ā eslint-config-prettier-npm-6.14.0-10ad0a5650-8d478429bb.zip appears to be unused - removing\n⤠YN0000: ā Completed in 2.12s\n⤠YN0000: ā Link step\n⤠YN0004: ā core-js-pure@npm:3.6.5 lists build scripts, but all build scripts have been disabled.\n⤠YN0000: ā Completed in 11.02s\n⤠YN0000: Done with warnings in 14.52s\n",
"stderr": ""
}
DEBUG: yarn.lock needs updating(branch="renovate/eslint-config-prettier-6.x")
DEBUG: updateYarnOffline resolvedPaths(branch="renovate/eslint-config-prettier-6.x")
{
"resolvedPaths": [
".yarn/cache",
".pnp"
]
}
DEBUG: Updated 4 lock files(branch="renovate/eslint-config-prettier-6.x")
{
"updatedArtifacts": [
"yarn.lock",
".pnp.js",
".yarn/cache/eslint-config-prettier-npm-6.15.0-d2085588b4-a790bc6169.zip",
".yarn/cache/eslint-config-prettier-npm-6.14.0-10ad0a5650-8d478429bb.zip (delete)"
]
}
DEBUG: 5 file(s) to commit(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Committing files to branch renovate/eslint-config-prettier-6.x(branch="renovate/eslint-config-prettier-6.x")
INFO: Branch created(branch="renovate/eslint-config-prettier-6.x")
{
"commitSha": "82d5216"
}
DEBUG: Ensuring PR(branch="renovate/eslint-config-prettier-6.x")
DEBUG: There are 0 errors and 0 warnings(branch="renovate/eslint-config-prettier-6.x")
DEBUG: getBranchPr(renovate/eslint-config-prettier-6.x)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: findPr(renovate/eslint-config-prettier-6.x, undefined, open)(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Creating PR(branch="renovate/eslint-config-prettier-6.x")
{
"prTitle": "fix(deps): update dependency eslint-config-prettier to ^6.15.0"
}
DEBUG: Creating PR(branch="renovate/eslint-config-prettier-6.x")
{
"title": "fix(deps): update dependency eslint-config-prettier to ^6.15.0",
"head": "brummelte:renovate/eslint-config-prettier-6.x",
"base": "master",
"draft": false
}
DEBUG: PR created(branch="renovate/eslint-config-prettier-6.x")
{
"pr": 21,
"draft": false
}
DEBUG: Adding labels '' to #21(branch="renovate/eslint-config-prettier-6.x")
INFO: PR created(branch="renovate/eslint-config-prettier-6.x")
{
"pr": 21,
"prTitle": "fix(deps): update dependency eslint-config-prettier to ^6.15.0"
}
DEBUG: Adding assignees 'brummelte' to #21(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Added assignees(branch="renovate/eslint-config-prettier-6.x")
{
"assignees": [
"brummelte"
]
}
DEBUG: Created Pull Request #21(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Retrieved closed PR list with graphql(branch="renovate/eslint-config-prettier-6.x")
{
"prNumbers": [
1,
10,
11,
12,
13,
14,
15,
17,
19,
2,
20,
3,
4,
5,
6,
8,
9
]
}
DEBUG: Getting comments for #21(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Found 0 comments(branch="renovate/eslint-config-prettier-6.x")
DEBUG: Checking #21 for automerge(branch="renovate/eslint-config-prettier-6.x")
{
"automerge": false,
"automergeType": "pr",
"automergeComment": "automergeComment"
}
DEBUG: No automerge(branch="renovate/eslint-config-prettier-6.x")
It's set here.
So setting trustLevel to high might resolve the problem.
I guess it should work without setting trustLevel to high. But there is probably no yarn setting that does not run scripts, but generates the lock file as if scripts had been run.
Looks like there is no real solution for the app to solve this. for self-hosted the only solution is to use trustLevel=high
I'm not sure if we ever want to allow running scripts on renovate app š¤
So the pnp.js is changed without scripts, but it's changed differently with scripts enabled?
Yes.
With scripts enabled, yarn will put the packages that have a build script into an unplugged folder.
With scripts disabled, yarn will put all packages into the normal cache folder.
I've now tried running it with trustLevel set to high on a self hosted renovate and ignoreScripts not set (which means it should be defaulted to false, which means scripts should run).
It still does not run scripts and generates the wrong .pnp.js file as a result.
In the debug log I can see that it runs yarn install. It does not tell me anything about environment variables though.
Yarn output lists multiple warnings like @apollo/protobufjs@npm:1.0.5 lists build scripts, but all build scripts have been disabled..
So it seems I can't get it working even with trustLevel set to high on a self hosted instance.
@brummelte It's a known bug, see #6443. you need to set ignoreScripts=false as workaround
nope, wrong assumption. not sure whats going wrong. can you share the new debug logs please
maybe CI=true makes a difference? https://github.com/renovatebot/renovate/blob/c33da16aba2e3fff357ead02c79343ca614f827a/lib/manager/npm/post-update/yarn.ts#L67
Running it locally with CI=true still produces the correct pnp file. So that's not the problem.
Setting ignoreScript explicitly to false, also does not solve it.
Here is the debug log, but I don't think it helps. It does not print out env variables.
Click to expand debug log
DEBUG: Writing .yarnrc to /tmp/renovate/repos/gitlab/repository (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Writing any updated package files (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Writing eslint-config/package.json (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: No npmrc file found in repository (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Writing updated .npmrc file to /tmp/renovate/repos/gitlab/repository/.npmrc (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Generating yarn.lock for . (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Spawning yarn install to create /tmp/renovate/repos/gitlab/repository/yarn.lock (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: No node constraint found - using latest (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Executing command (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"command": "yarn install"
DEBUG: exec completed (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"cmd": "yarn install",
"durationMs": 23103,
"stdout": "⤠YN0000: ā Resolution step\n⤠YN0002: ⦠bcrypt@npm:5.0.0 lists build scripts, but all build scripts have been disabled.\n⤠YN0004: ā oracledb@npm:5.0.0 lists build scripts, but all build scripts have been disabled.\n⤠YN0004: ā @apollo/protobufjs@npm:1.0.5 lists build scripts, but all build scripts have been disabled.\n⤠YN0000: ā Completed in 16s 450ms\n⤠YN0000: Done with warnings in 21s 260ms\n",
"stderr": ""
DEBUG: yarn.lock needs updating (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: updateYarnOffline resolvedPaths (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"resolvedPaths": [".yarn/cache", ".pnp"]
DEBUG: Updated 2 lock files (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"updatedArtifacts": ["yarn.lock", ".pnp.js"]
DEBUG: 3 file(s) to commit (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Committing files to branch renovate/brummelte-eslint-config-8.3.x (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
INFO: Branch created (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"commitSha": "5b0d450"
DEBUG: Ensuring PR (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: There are 0 errors and 0 warnings (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: getBranchPr(renovate/brummelte-eslint-config-8.3.x) (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Got res with 1 results (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: getPr(1336) (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: getBranchStatus(renovate/brummelte-eslint-config-8.3.x) (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Got res with 0 results (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Found existing PR (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: getBranchStatus(renovate/brummelte-eslint-config-8.3.x) (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Got res with 0 results (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Processing existing PR (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: getBranchStatus(renovate/brummelte-eslint-config-8.3.x) (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: Got res with 0 results (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
DEBUG: getBranchStatus() result (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"branchStatus": "yellow",
"branchName": "renovate/brummelte-eslint-config-8.3.x"
DEBUG: PR body changed (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"prTitle": "fix(deps): update dependency @brummelte/eslint-config to ^8.3.7"
INFO: PR updated (repository=repository, branch=renovate/brummelte-eslint-config-8.3.x)
"pr": 1336,
"prTitle": "fix(deps): update dependency @brummelte/eslint-config to ^8.3.7"
Click to expand config
DEBUG: migrated config (repository=repository)
"config": {
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", ":automergePatch"],
"dependencyDashboard": true,
"dependencyDashboardAutoclose": true,
"gitLabAutomerge": true,
"rangeStrategy": "bump",
"assignees": ["brummelte", ā¦],
"trustLevel": "high",
"ignoreScripts": false,
"assigneesSampleSize": 1,
"packageRules": [
{
"updateTypes": ["minor"],
"depTypeList": ["devDependencies"],
"automerge": true
}
]
}
ha, thanks for the config. trustLevel is a admin config, so only available in bot config.
https://docs.renovatebot.com/self-hosted-configuration/#trustlevel
Thank you, I already thought it might be something like that.
I don't have an admin config, that's why I got confused. I provide CLI flags to renovate. I'm now passing --trust-level "high" and it works. š
As for the low trust level, I can't seem to think of a good solution either. It can probably only be solved in yarn. Maybe via a new environment variable that does not build, but still creates the pnp lock file as if build was enabled. But from their point of view, it is probably an "obscure" use case and I'm not sure they'd build something like that. I will create an issue there anyway.
Did you know if / how dependabot can / does handle that?
Admin config are the options from self-hosted config options. They can't be in target repo config. They can only be passed directly to the bot, eg via config.js, environment or cli args. š
Thank you, I've understood that immediately after you've told me. But not from the documentation alone.
I've created a new task for maybe clarifying that (#7595), because I did not want to let this issue get off topic.
Sorry I don't know how and if dependabot handles yarn v2.
It seems they don't support yarn v2 at all currently: https://github.com/dependabot/dependabot-core/issues/1297#issuecomment-705684044
Yarn's PnPLinker unplugs a package only if it has build scripts to run: https://github.com/yarnpkg/berry/blob/ccba9021896cf5697d3d9a2bb0479b3179cf4603/packages/plugin-pnp/sources/AbstractPnpInstaller.ts#L74-L91 https://github.com/yarnpkg/berry/blob/975376a5b7e65679ed78e66336b4e642422c4610/packages/plugin-pnp/sources/PnpLinker.ts#L218-L219
I think Yarn should have an option to unplug packages that have build scripts even if they are disabled.
_Originally posted by @ylemkimon in https://github.com/yarnpkg/berry/issues/2062#issuecomment-718053283_
@arcanis do you have any advice here? e.g. is it feasible that this unplugged behavior could be enhanced to work without install scripts being enabled?
That's an interesting one - yes, I think we could do that. Although what would happen if the user actually disabled build scripts in their configuration? In this case it would be the other way around, Renovabot would add the unplugged paths instead of the cached ones š¤
The current problem seems to be that we're changing things (unintentionally of course). Would it work if the behaviour is to "preserve" whatever is there already?
Something that would work most of the time would be that yarn does not change currently unplugged packages.
That only does not work if some package becomes unplugged or not unplugged anymore after an upgrade.
We can't preserve the existing, because we don't have notions of what the previous state was - at a high level, we generate what you should have, then compare the differences with what you have and overwrite it.
I suspect the fix would be to have a setting to completely skip the build step (on top of enableScripts, so it would be kinda duplicate), but before going into that I'd be interested to know more about this trustLevel - how does that work with things like yarnPath and plugins?
It's for self hosting only and exposes full ENV and enabled scripts on package installs. It's intended for when the operator of the bot trusts the maintainers of all repos, Eg a corporate setup.
But how does the open-source renovabot bot handles things like plugins? When running, Yarn will necessarily need to execute them in order to add support for the custom protocols, right? (Or similarly, since Yarn is checked inside the repository, it may actually be any JS script)
Yes, so blocking scripts isn't close to foolproof, but it's a useful measure. Plus a lot of repos do a silly amount with post-install scripts that add minutes per PR so it's useful to disable for that reason. Essentially the hosted app will spin up a new node container, install yarn, and then yarn install. If yarn executes plugins as part of that, they're probably already allowed (unless they're also being blocked by ignore scripts?).
BTW for Yarn 1 I created a nice "package lock only" hack which causes Yarn to write the yarn.lock and exit gracefully prior to installing node_modules.
I think it makes sense to support this use case, so I'll implement a --skip-builds flag which will tell Yarn to skip the build step but leave the build scripts enabled (they just won't run ... the difference is subtle š).
BTW for Yarn 1 I created a nice "package lock only" hack which causes Yarn to write the yarn.lock and exit gracefully prior to installing node_modules.
For Yarn 2, if you wanted that, I think the "official" way would be to write a linker that wouldn't do anything. The public Linker API is currently still in flux as we're making it more flexible, but we plan to stabilize it in the next few months.
Will be implemented in https://github.com/yarnpkg/berry/pull/2064
BTW for Yarn 1 I created a nice "package lock only" hack which causes Yarn to write the yarn.lock and exit gracefully prior to installing node_modules.
For Yarn 2, if you wanted that, I think the "official" way would be to write a linker that wouldn't do anything. The public Linker API is currently still in flux as we're making it more flexible, but we plan to stabilize it in the next few months.
@arcanis ~What do you think about adding an option to skip the whole link step, e.g., --skip-link or --dry-run, rather than --skip-builds?~ But to generate .pnp.js, the PnP linker should be run, right?
But to generate
.pnp.js, the pnpLinker should be run, right?
Exactly. I think for more unique use cases like this ("I don't want artifacts to be generated at, except if [...]"), a custom linker like the one I mentioned might be the best approach, rather than adding it in the core (once the interfaces have stabilized).
@arcanis
We can't preserve the existing, because we don't have notions of what the previous state was - at a high level, we generate what you should have, then compare the differences with what you have and overwrite it.
I thought a bit about this. Maybe the correct solution is to have one flag that says whether to unplug packages with postinstall steps and one flag just to say whether to run scripts.
--skip-builds should not change whether unplugging is enabled or not. That's what enableScripts is for.
| Flag | Unplug | Run scripts |
| ------------- |-------------| -----|
| enableScripts=true | true | true |
| enableScripts=true, --skip-builds | true | false |
| enableScripts=false | false | false |
| enableScripts=false, --skip-builds | false | false |
The naming might just be a little bit hard to convey this.
@brummelte That seems to be what I implemented in https://github.com/yarnpkg/berry/pull/2064, right ?
Ah sorry, I did not look at the code.
From your sentence A --skip-builds option will skip the build step but the packages will still be assumed to be unplugged. I understood that it always forces unplugging. That would mean enableScripts=false combined with --skip-builds would still unplug packages. If it doesn't than I think all use cases are covered.
Previously you said:
That's an interesting one - yes, I think we could do that. Although what would happen if the user actually disabled build scripts in their configuration? In this case it would be the other way around, Renovabot would add the unplugged paths instead of the cached ones š¤
So what I just wanted to point out is, that --skip-builds should not force enable unplugging. It should just always skip builds. enableScripts should be used to detemine the unplugging behavior. If you've implemented it like that, than perfect. All use cases will be covered.
Most helpful comment
I think it makes sense to support this use case, so I'll implement a
--skip-buildsflag which will tell Yarn to skip the build step but leave the build scripts enabled (they just won't run ... the difference is subtle š).For Yarn 2, if you wanted that, I think the "official" way would be to write a linker that wouldn't do anything. The public Linker API is currently still in flux as we're making it more flexible, but we plan to stabilize it in the next few months.