diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-07-03 20:54:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-04 00:54:33 +0000 |
commit | 147411e64b22fe74cb258125acab83f9182c9f81 (patch) | |
tree | a1f63dcbf0404c20534986b10f02b649df5a3ad5 /tests/specs/task/workspace | |
parent | dd6d19e12051fac2ea5639f621501f4710a1b8e1 (diff) |
feat: npm workspace and better Deno workspace support (#24334)
Adds much better support for the unstable Deno workspaces as well as
support for npm workspaces. npm workspaces is still lacking in that we
only install packages into the root node_modules folder. We'll make it
smarter over time in order for it to figure out when to add node_modules
folders within packages.
This includes a breaking change in config file resolution where we stop
searching for config files on the first found package.json unless it's
in a workspace. For the previous behaviour, the root deno.json needs to
be updated to be a workspace by adding `"workspace":
["./path-to-pkg-json-folder-goes-here"]`. See details in
https://github.com/denoland/deno_config/pull/66
Closes #24340
Closes #24159
Closes #24161
Closes #22020
Closes #18546
Closes #16106
Closes #24160
Diffstat (limited to 'tests/specs/task/workspace')
-rw-r--r-- | tests/specs/task/workspace/__test__.jsonc | 52 | ||||
-rw-r--r-- | tests/specs/task/workspace/deno.json | 9 | ||||
-rw-r--r-- | tests/specs/task/workspace/package-a.out | 9 | ||||
-rw-r--r-- | tests/specs/task/workspace/package-a/deno.json | 5 | ||||
-rw-r--r-- | tests/specs/task/workspace/package-b.out | 11 | ||||
-rw-r--r-- | tests/specs/task/workspace/package-b/deno.json | 6 | ||||
-rw-r--r-- | tests/specs/task/workspace/package-b/package.json | 6 | ||||
-rw-r--r-- | tests/specs/task/workspace/package.json | 6 | ||||
-rw-r--r-- | tests/specs/task/workspace/root.out | 7 | ||||
-rw-r--r-- | tests/specs/task/workspace/scripts.out | 7 | ||||
-rw-r--r-- | tests/specs/task/workspace/scripts/main.ts | 1 |
11 files changed, 119 insertions, 0 deletions
diff --git a/tests/specs/task/workspace/__test__.jsonc b/tests/specs/task/workspace/__test__.jsonc new file mode 100644 index 000000000..b08f35afc --- /dev/null +++ b/tests/specs/task/workspace/__test__.jsonc @@ -0,0 +1,52 @@ +{ + "tests": { + "root": { + "args": "task", + "output": "root.out", + "exitCode": 1 + }, + "package_a": { + "args": "task", + "cwd": "package-a", + "output": "package-a.out", + "exitCode": 1 + }, + "package_b": { + "args": "task", + "cwd": "package-b", + "output": "package-b.out", + "exitCode": 1 + }, + "scripts": { + "args": "task", + "cwd": "scripts", + "output": "scripts.out", + "exitCode": 1 + }, + "package_b_tasks": { + "steps": [{ + "args": "task --quiet pkg-json-root", + "cwd": "package-b", + // uses the workspace as cwd + "output": "pkg-json [WILDLINE]workspace\n" + }, { + "args": "task --quiet pkg-json-root-2", + "cwd": "package-b", + // uses package-b as cwd + "output": "override [WILDLINE]package-b\n" + }, { + "args": "task --quiet echo-package-b", + "cwd": "package-b", + "output": "hi [WILDLINE]package-b\n" + }, { + "args": "task --quiet echo-root", + "cwd": "package-b", + "output": "override root [WILDLINE]package-b\n" + }, { + "args": "task --quiet echo-root", + "cwd": "package-a", + "output": "[WILDLINE]workspace\n" + }] + } + } +} diff --git a/tests/specs/task/workspace/deno.json b/tests/specs/task/workspace/deno.json new file mode 100644 index 000000000..aead0490e --- /dev/null +++ b/tests/specs/task/workspace/deno.json @@ -0,0 +1,9 @@ +{ + "workspace": [ + "./package-a", + "./package-b" + ], + "tasks": { + "echo-root": "echo $PWD" + } +} diff --git a/tests/specs/task/workspace/package-a.out b/tests/specs/task/workspace/package-a.out new file mode 100644 index 000000000..f68d5d24b --- /dev/null +++ b/tests/specs/task/workspace/package-a.out @@ -0,0 +1,9 @@ +Available tasks: +- echo-package-b + echo 'bye' +- pkg-json-root (workspace package.json) + echo pkg-json $PWD +- pkg-json-root-2 (workspace package.json) + echo hi +- echo-root (workspace) + echo $PWD diff --git a/tests/specs/task/workspace/package-a/deno.json b/tests/specs/task/workspace/package-a/deno.json new file mode 100644 index 000000000..5167ad857 --- /dev/null +++ b/tests/specs/task/workspace/package-a/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "echo-package-b": "echo 'bye'" + } +} diff --git a/tests/specs/task/workspace/package-b.out b/tests/specs/task/workspace/package-b.out new file mode 100644 index 000000000..4abd90d23 --- /dev/null +++ b/tests/specs/task/workspace/package-b.out @@ -0,0 +1,11 @@ +Available tasks: +- echo-package-b + echo 'hi' $PWD +- echo-root + echo 'override root' $PWD +- pkg-json-root-2 (package.json) + echo override $PWD +- package-b-json (package.json) + echo 'hi from pkg json' +- pkg-json-root (workspace package.json) + echo pkg-json $PWD diff --git a/tests/specs/task/workspace/package-b/deno.json b/tests/specs/task/workspace/package-b/deno.json new file mode 100644 index 000000000..0c6420834 --- /dev/null +++ b/tests/specs/task/workspace/package-b/deno.json @@ -0,0 +1,6 @@ +{ + "tasks": { + "echo-package-b": "echo 'hi' $PWD", + "echo-root": "echo 'override root' $PWD" + } +} diff --git a/tests/specs/task/workspace/package-b/package.json b/tests/specs/task/workspace/package-b/package.json new file mode 100644 index 000000000..bc1bdc712 --- /dev/null +++ b/tests/specs/task/workspace/package-b/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "pkg-json-root-2": "echo override $PWD", + "package-b-json": "echo 'hi from pkg json'" + } +} diff --git a/tests/specs/task/workspace/package.json b/tests/specs/task/workspace/package.json new file mode 100644 index 000000000..a468ec494 --- /dev/null +++ b/tests/specs/task/workspace/package.json @@ -0,0 +1,6 @@ +{ + "scripts": { + "pkg-json-root": "echo pkg-json $PWD", + "pkg-json-root-2": "echo hi" + } +} diff --git a/tests/specs/task/workspace/root.out b/tests/specs/task/workspace/root.out new file mode 100644 index 000000000..808106c92 --- /dev/null +++ b/tests/specs/task/workspace/root.out @@ -0,0 +1,7 @@ +Available tasks: +- echo-root + echo $PWD +- pkg-json-root (package.json) + echo pkg-json $PWD +- pkg-json-root-2 (package.json) + echo hi diff --git a/tests/specs/task/workspace/scripts.out b/tests/specs/task/workspace/scripts.out new file mode 100644 index 000000000..808106c92 --- /dev/null +++ b/tests/specs/task/workspace/scripts.out @@ -0,0 +1,7 @@ +Available tasks: +- echo-root + echo $PWD +- pkg-json-root (package.json) + echo pkg-json $PWD +- pkg-json-root-2 (package.json) + echo hi diff --git a/tests/specs/task/workspace/scripts/main.ts b/tests/specs/task/workspace/scripts/main.ts new file mode 100644 index 000000000..9c11c78bb --- /dev/null +++ b/tests/specs/task/workspace/scripts/main.ts @@ -0,0 +1 @@ +console.log("some file"); |