-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Create yarnBuildHook and yarnConfigHook #318015
Conversation
7f0f1ec
to
02116e6
Compare
Just wanted to say that I am very thankful that you are working on this and trying to get this into shape. 🎉 |
--offline --frozen-lockfile \ | ||
--force --production=false \ | ||
--ignore-engines --ignore-scripts | ||
patchShebangs node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are reworking things. We cannot limit this to node_modules/.bin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are reworking things. We cannot limit this to node_modules/.bin?
What would be the value in trying that out? Here's an example of a patchShebangs
log:
node_modules/acorn/bin/acorn: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/cross-spawn/node_modules/which/bin/node-which: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/findup/bin/findup.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/browserslist/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/envinfo/dist/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/errno/build.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/errno/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/esprima/bin/esvalidate.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/esprima/bin/esparse.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/flat/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/import-local/fixtures/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/he/bin/he: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/js-yaml/bin/js-yaml.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/json5/lib/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/mkdirp/bin/cmd.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/mocha/bin/_mocha: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/mocha/bin/mocha: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/mocha/lib/cli/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/semver/bin/semver: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/terser/bin/terser: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/terser/bin/uglifyjs: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/ts-loader/node_modules/semver/bin/semver.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/tslint/bin/tslint: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/ts-node/dist/bin-script-deprecated.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/ts-node/dist/bin-script.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/ts-node/dist/bin-transpile.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/ts-node/dist/bin.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/typescript/bin/tsc: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/typescript/bin/tsserver: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/webpack/bin/webpack.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/webpack-cli/bin/cli.js: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
node_modules/which/bin/which: interpreter directive changed from "#!/usr/bin/env node" to "/nix/store/6g9n96qf1yx139xklnmy3v4xhjvjgsji-nodejs-20.12.2/bin/node"
None of the paths above includes node_modules/.bin
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or a pattern like node_modules/*/bin. They seem to be all over the place...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or a pattern like node_modules/*/bin. They seem to be all over the place...
It's worth checking in anycase whether this patchShebangs
is really needed. I'll run a nixpkgs-review
on a strong machine with and without it when I finish iterating all packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, that would be super awesome if we can avoid carrying this forward with us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to my comment to @viraptor here, I think it should be out of scope for this PR to remove that patchShebangs
command, since this is also the behavior of all of these packages before this PR.
This also helps me demonstrate in the little diff --recursive
shell loop below how the packages barely change due to this PR. I still kept the TODO comment near there though - maybe someone will be bothered by this in the future and provide a clean solution.
a335fac
to
9ef9a41
Compare
Just to confirm: did you check for potential update scripts where we can drop dowloading the package.json file fron upstream? |
9ef9a41
to
80965c7
Compare
Good comment. The files I touched in the meantime don't have an updateScript, but those who do are:
And most of them do download the |
80965c7
to
36e0652
Compare
1827318
to
238d267
Compare
Thanks @pinpox for running That I also fixed the merge conflict. |
|
Now with the additional approval, I'll merge this in a few days if no one will comment on this. |
Motivation for this change
Many packages that use
fetchYarnDeps
(104 according togit grep
), need to run the commands introduced by these new hooks, or variants of them. Any project with ayarn.lock
a contributor may wish to package, essentially will need to run some variant of these commands. It'd be better to share this functionality, document it, and hence expose it.Further more, as discussed with @yu-re-ka at #296856 ,
mkYarnPackage
has issues, and should be replaced by hooks.Other people who may be interested in this:
@SuperSandro2000 @lilyinstarlight @Scrumplex ( ❤️ )
Things done / TODO
external source.
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)