1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-26 17:19:06 -05:00
denoland-deno/cli/tools
Nathan Whitaker ce7dc2be92
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
2024-07-10 03:06:08 +00:00
..
bench refactor: move FileCollector to deno_config (#24433) 2024-07-05 17:53:09 -04:00
coverage refactor: move FileCollector to deno_config (#24433) 2024-07-05 17:53:09 -04:00
init feat(cli): deno init --lib (#22499) 2024-07-09 21:13:34 -04:00
jupyter feat(jupyter): support confirm and prompt in notebooks (#23592) 2024-07-04 22:12:14 +00:00
lint fix(workspace): better cli file argument handling (#24447) 2024-07-08 14:12:10 +00:00
registry refactor: move FileCollector to deno_config (#24433) 2024-07-05 17:53:09 -04:00
repl refactor(jupyter): move ZeroMQ server to a separate thread (#24373) 2024-07-03 00:37:54 +02:00
run refactor: remove PermissionsContainer in deno_runtime (#24119) 2024-06-06 23:37:53 -04:00
test feat: add __tests__ to test file detection defaults (#24443) 2024-07-08 15:19:59 +02:00
vendor feat: deprecate deno vendor (#22183) 2024-07-10 03:18:10 +02:00
bundle.rs chore: enable clippy::print_stdout and clippy::print_stderr (#23732) 2024-05-08 22:45:06 -04:00
check.rs feat: npm workspace and better Deno workspace support (#24334) 2024-07-04 00:54:33 +00:00
compile.rs feat: npm workspace and better Deno workspace support (#24334) 2024-07-04 00:54:33 +00:00
doc.rs feat: npm workspace and better Deno workspace support (#24334) 2024-07-04 00:54:33 +00:00
fmt.rs fix(workspace): better cli file argument handling (#24447) 2024-07-08 14:12:10 +00:00
info.rs feat: npm workspace and better Deno workspace support (#24334) 2024-07-04 00:54:33 +00:00
installer.rs feat(cli): Add --frozen flag to error out if lockfile is out of date (#24355) 2024-07-02 15:00:16 -07:00
mod.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
task.rs feat(node): Support executing npm package lifecycle scripts (preinstall/install/postinstall) (#24487) 2024-07-10 03:06:08 +00:00
upgrade.rs refactor: don't share reqwest::HttpClient across tokio runtimes (#24092) 2024-06-03 21:17:08 +00:00