feat(task): support scripts in package.json (#17887)

This is a super basic initial implementation. We don't create a
`node_modules/.bin` folder at the moment and add it to the PATH like we
should which is necessary to make command name resolution in the
subprocess work properly (ex. you run a script that launches another
script that then tries to launch an "npx command"... this won't work
atm).

Closes #17492
This commit is contained in:
David Sherret 2023-02-22 22:45:35 -05:00 committed by GitHub
parent cc8e4a00aa
commit b15f9e60a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 561 additions and 197 deletions

View file

@ -2752,7 +2752,7 @@ itest!(config_not_auto_discovered_for_remote_script {
itest!(package_json_auto_discovered_for_local_script_log {
args: "run -L debug -A no_deno_json/main.ts",
output: "run/with_package_json/no_deno_json/main.out",
maybe_cwd: Some("run/with_package_json/"),
cwd: Some("run/with_package_json/"),
// prevent creating a node_modules dir in the code directory
copy_temp_dir: Some("run/with_package_json/"),
envs: env_vars_for_npm_tests_no_sync_download(),
@ -2765,7 +2765,7 @@ itest!(
package_json_auto_discovered_for_local_script_log_with_stop {
args: "run -L debug with_stop/some/nested/dir/main.ts",
output: "run/with_package_json/with_stop/main.out",
maybe_cwd: Some("run/with_package_json/"),
cwd: Some("run/with_package_json/"),
copy_temp_dir: Some("run/with_package_json/"),
envs: env_vars_for_npm_tests_no_sync_download(),
http_server: true,
@ -2777,7 +2777,7 @@ itest!(
package_json_auto_discovered_node_modules_relative_package_json {
args: "run -A main.js",
output: "run/with_package_json/no_deno_json/sub_dir/main.out",
maybe_cwd: Some("run/with_package_json/no_deno_json/sub_dir"),
cwd: Some("run/with_package_json/no_deno_json/sub_dir"),
copy_temp_dir: Some("run/with_package_json/"),
envs: env_vars_for_npm_tests_no_sync_download(),
http_server: true,
@ -2787,7 +2787,7 @@ itest!(
itest!(package_json_auto_discovered_for_npm_binary {
args: "run -L debug -A npm:@denotest/bin/cli-esm this is a test",
output: "run/with_package_json/npm_binary/main.out",
maybe_cwd: Some("run/with_package_json/npm_binary/"),
cwd: Some("run/with_package_json/npm_binary/"),
copy_temp_dir: Some("run/with_package_json/"),
envs: env_vars_for_npm_tests_no_sync_download(),
http_server: true,