diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-07-09 20:06:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-10 03:06:08 +0000 |
commit | ce7dc2be92499f15b4b0315bfca3ee9d61fc3c5e (patch) | |
tree | f2463a8026d6f68d288c04b8671ce26f310de9fe /tests/registry/npm/is-lambda | |
parent | eb46296e974c686896486350bb00bf428a84e9fd (diff) |
feat(node): Support executing npm package lifecycle scripts (preinstall/install/postinstall) (#24487)
Adds support for running npm package lifecycle scripts, opted into via a
new `--allow-scripts` flag.
With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno
install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run
lifecycle scripts attached to the given packages.
Note at the moment this only works when `nodeModulesDir` is true (using
the local resolver).
When a package with un-run lifecycle scripts is encountered, we emit a
warning suggesting things may not work and to try running lifecycle
scripts. Additionally, if a package script implicitly requires
`node-gyp` and it's not found on the system, we emit a warning.
Extra things in this PR:
- Extracted out bits of `task.rs` into a separate module for reuse
- Added a couple fields to `process.config` in order to support
`node-gyp` (it relies on a few variables being there)
- Drive by fix to downloading new npm packages to test registry
---
TODO:
- [x] validation for allow-scripts args (make sure it looks like an npm
package)
- [x] make allow-scripts matching smarter
- [ ] figure out what issues this closes
---
Review notes:
- This adds a bunch of deps to our test registry due to using
`node-gyp`, so it's pretty noisy
Diffstat (limited to 'tests/registry/npm/is-lambda')
-rw-r--r-- | tests/registry/npm/is-lambda/is-lambda-1.0.1.tgz | bin | 0 -> 1843 bytes | |||
-rw-r--r-- | tests/registry/npm/is-lambda/registry.json | 1 |
2 files changed, 1 insertions, 0 deletions
diff --git a/tests/registry/npm/is-lambda/is-lambda-1.0.1.tgz b/tests/registry/npm/is-lambda/is-lambda-1.0.1.tgz Binary files differnew file mode 100644 index 000000000..6e52281cf --- /dev/null +++ b/tests/registry/npm/is-lambda/is-lambda-1.0.1.tgz diff --git a/tests/registry/npm/is-lambda/registry.json b/tests/registry/npm/is-lambda/registry.json new file mode 100644 index 000000000..7afca6cd2 --- /dev/null +++ b/tests/registry/npm/is-lambda/registry.json @@ -0,0 +1 @@ +{"_id":"is-lambda","_rev":"4-ad739fba71f99829f2cc965076762da8","name":"is-lambda","description":"Detect if your code is running on an AWS Lambda server","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"is-lambda","version":"1.0.0","description":"Detect if your code is running on an AWS Lambda server","main":"index.js","dependencies":{},"devDependencies":{"clear-require":"^1.0.1","standard":"^6.0.4"},"scripts":{"test":"standard && node test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/is-lambda.git"},"keywords":["aws","hosting","hosted","lambda","detect"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/is-lambda/issues"},"homepage":"https://github.com/watson/is-lambda","coordinates":[55.6665749,12.5801368],"gitHead":"c84d875f9071d174cd1be2b2f292c3d9e48bb731","_id":"is-lambda@1.0.0","_shasum":"01e25e8e83d774987f9a2bd6b1d99a88e3d93af4","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"01e25e8e83d774987f9a2bd6b1d99a88e3d93af4","tarball":"http://localhost:4260/is-lambda/is-lambda-1.0.0.tgz","integrity":"sha512-uUoTG78sR9W3a2rqeC1Ro4M9YeVwcG80yYiL1tanLiEYPe4cZmXfGUIsZKsQuh+cETLNHJoKiRLB+MLvLMZamQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgQV80RaEo4tOwKyJYK2au4/k/Qk8O0jRIOuseIvQzNgIgD3O59CiRSriM1LWBTXcT+P11JrKP5Zbi1AG5EN8PTtw="}]},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/is-lambda-1.0.0.tgz_1455301879480_0.2202226109802723"}},"1.0.1":{"name":"is-lambda","version":"1.0.1","description":"Detect if your code is running on an AWS Lambda server","main":"index.js","dependencies":{},"devDependencies":{"clear-require":"^1.0.1","standard":"^10.0.2"},"scripts":{"test":"standard && node test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/is-lambda.git"},"keywords":["aws","hosting","hosted","lambda","detect"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/is-lambda/issues"},"homepage":"https://github.com/watson/is-lambda","coordinates":[37.3859955,-122.0838831],"gitHead":"9e6734e406f4f84f1f5540a8e5115d6e00f860ff","_id":"is-lambda@1.0.1","_shasum":"3d9877899e6a53efc0160504cde15f82e6f061d5","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"3d9877899e6a53efc0160504cde15f82e6f061d5","tarball":"http://localhost:4260/is-lambda/is-lambda-1.0.1.tgz","integrity":"sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHWpJi2/bQUyBW7NDenjkyIbtXFZWLcIcpU1QjUbyp3XAiAtuGpqcPbXMtAMcDVHbc0whQvcNPh5129edWIKXieCnA=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-lambda-1.0.1.tgz_1495652830893_0.7506156389135867"}}},"readme":"# is-lambda\n\nReturns `true` if the current environment is an [AWS\nLambda](https://aws.amazon.com/lambda/) server.\n\n[](https://travis-ci.org/watson/is-lambda)\n[](https://github.com/feross/standard)\n\n## Installation\n\n```\nnpm install is-lambda\n```\n\n## Usage\n\n```js\nvar isLambda = require('is-lambda')\n\nif (isLambda) {\n console.log('The code is running on a AWS Lambda')\n}\n```\n\n## License\n\nMIT\n","maintainers":[{"name":"watson","email":"w@tson.dk"}],"time":{"modified":"2022-06-19T02:44:37.104Z","created":"2016-02-12T18:31:22.835Z","1.0.0":"2016-02-12T18:31:22.835Z","1.0.1":"2017-05-24T19:07:11.056Z"},"homepage":"https://github.com/watson/is-lambda","keywords":["aws","hosting","hosted","lambda","detect"],"repository":{"type":"git","url":"git+https://github.com/watson/is-lambda.git"},"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"bugs":{"url":"https://github.com/watson/is-lambda/issues"},"license":"MIT","readmeFilename":"README.md"}
\ No newline at end of file |