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/run/workspaces | |
| 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/run/workspaces')
17 files changed, 26 insertions, 18 deletions
diff --git a/tests/specs/run/workspaces/basic/deno.json b/tests/specs/run/workspaces/basic/deno.json index b971c4f3d..a39778a6d 100644 --- a/tests/specs/run/workspaces/basic/deno.json +++ b/tests/specs/run/workspaces/basic/deno.json @@ -1,5 +1,5 @@ { - "workspaces": [ + "workspace": [ "foo", "bar" ], diff --git a/tests/specs/run/workspaces/basic/main.out b/tests/specs/run/workspaces/basic/main.out index 57d8c9f1e..9806f7d63 100644 --- a/tests/specs/run/workspaces/basic/main.out +++ b/tests/specs/run/workspaces/basic/main.out @@ -2,19 +2,19 @@ "imports": { "chalk": "npm:chalk", "chalk/": "npm:/chalk/", - "qwerqwer": "jsr:qwerqwer@^0.0.0", - "qwerqwer/": "jsr:/qwerqwer@^0.0.0/", "asdfasdfasdf": "jsr:asdfasdfasdf@^0.0.0", - "asdfasdfasdf/": "jsr:/asdfasdfasdf@^0.0.0/" + "asdfasdfasdf/": "jsr:/asdfasdfasdf@^0.0.0/", + "qwerqwer": "jsr:qwerqwer@^0.0.0", + "qwerqwer/": "jsr:/qwerqwer@^0.0.0/" }, "scopes": { - "./foo/": { - "~/": "./foo/", - "foo/": "./foo/bar/" - }, "./bar/": { "@/": "./bar/", "secret_mod/": "./bar/some_mod/" + }, + "./foo/": { + "~/": "./foo/", + "foo/": "./foo/bar/" } } } diff --git a/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc b/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc index a7669c1ec..3b7f35c62 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc +++ b/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc @@ -1,5 +1,5 @@ { - "args": "run -A main.ts", + "args": "run -A sub_dir/child/main.ts", "output": "main.out", "tempDir": true, "exitCode": 1 diff --git a/tests/specs/run/workspaces/member_outside_root_dir/main.out b/tests/specs/run/workspaces/member_outside_root_dir/main.out index 205d95aea..72f0b0b45 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/main.out +++ b/tests/specs/run/workspaces/member_outside_root_dir/main.out @@ -1 +1,3 @@ -error: Workspace member '../other_folder' is outside root configuration directory[WILDCARD]
\ No newline at end of file +error: Workspace member must be nested in a directory under the workspace. + Member: file:///[WILDLINE]/sub_dir/other_folder/ + Workspace: file:///[WILDLINE]/sub_dir/child/ diff --git a/tests/specs/run/workspaces/member_outside_root_dir/deno.json b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/deno.json index 25feefad8..189d212b5 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/deno.json +++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/deno.json @@ -1,5 +1,5 @@ { - "workspaces": [ + "workspace": [ "foo", "../other_folder" ], diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/bar/hello.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/bar/hello.ts index c8a7e57c4..c8a7e57c4 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/foo/bar/hello.ts +++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/bar/hello.ts diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/deno.json b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/deno.json index 46d84f06f..46d84f06f 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/foo/deno.json +++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/deno.json diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/fizz/buzz.ts index 4e03777d1..4e03777d1 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts +++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/fizz/buzz.ts diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/mod.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/mod.ts index d7b16dcc0..d7b16dcc0 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/foo/mod.ts +++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/mod.ts diff --git a/tests/specs/run/workspaces/member_outside_root_dir/main.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/main.ts index 182fd8517..182fd8517 100644 --- a/tests/specs/run/workspaces/member_outside_root_dir/main.ts +++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/main.ts diff --git a/tests/specs/run/workspaces/members_are_imports/deno.json b/tests/specs/run/workspaces/members_are_imports/deno.json index 56105365a..51d1d21de 100644 --- a/tests/specs/run/workspaces/members_are_imports/deno.json +++ b/tests/specs/run/workspaces/members_are_imports/deno.json @@ -1,5 +1,5 @@ { - "workspaces": [ + "workspace": [ "foo", "bar" ], diff --git a/tests/specs/run/workspaces/nested_member/__test__.jsonc b/tests/specs/run/workspaces/nested_member/__test__.jsonc index a7669c1ec..fe02eacbc 100644 --- a/tests/specs/run/workspaces/nested_member/__test__.jsonc +++ b/tests/specs/run/workspaces/nested_member/__test__.jsonc @@ -2,5 +2,5 @@ "args": "run -A main.ts", "output": "main.out", "tempDir": true, - "exitCode": 1 + "exitCode": 0 } diff --git a/tests/specs/run/workspaces/nested_member/bar/deno.json b/tests/specs/run/workspaces/nested_member/bar/deno.json index ef3bfc37a..3bc0e52ec 100644 --- a/tests/specs/run/workspaces/nested_member/bar/deno.json +++ b/tests/specs/run/workspaces/nested_member/bar/deno.json @@ -4,5 +4,6 @@ "imports": { "@/": "./", "secret_mod/": "./some_mod/" - } + }, + "exports": "./mod.ts" } diff --git a/tests/specs/run/workspaces/nested_member/deno.json b/tests/specs/run/workspaces/nested_member/deno.json index 6d9c09d4d..8108d54fc 100644 --- a/tests/specs/run/workspaces/nested_member/deno.json +++ b/tests/specs/run/workspaces/nested_member/deno.json @@ -1,5 +1,5 @@ { - "workspaces": [ + "workspace": [ "foo", "foo/bar" ] diff --git a/tests/specs/run/workspaces/nested_member/foo/bar/deno.json b/tests/specs/run/workspaces/nested_member/foo/bar/deno.json index d40328b36..d4948ddbb 100644 --- a/tests/specs/run/workspaces/nested_member/foo/bar/deno.json +++ b/tests/specs/run/workspaces/nested_member/foo/bar/deno.json @@ -3,5 +3,6 @@ "version": "0.0.0", "imports": { "chalk": "npm:chalk" - } + }, + "exports": "./hello.ts" } diff --git a/tests/specs/run/workspaces/nested_member/foo/deno.json b/tests/specs/run/workspaces/nested_member/foo/deno.json index 68e053b02..6bc959c4d 100644 --- a/tests/specs/run/workspaces/nested_member/foo/deno.json +++ b/tests/specs/run/workspaces/nested_member/foo/deno.json @@ -3,5 +3,6 @@ "version": "0.0.0", "imports": { "~/": "./" - } + }, + "exports": "./mod.ts" } diff --git a/tests/specs/run/workspaces/nested_member/main.out b/tests/specs/run/workspaces/nested_member/main.out index 98598a306..ec46186a7 100644 --- a/tests/specs/run/workspaces/nested_member/main.out +++ b/tests/specs/run/workspaces/nested_member/main.out @@ -1 +1,4 @@ -error: Workspace member 'foo/bar' is nested within other workspace member 'foo' +Download http://localhost:4260/chalk +Download http://localhost:4260/chalk/chalk-5.0.1.tgz +buzz from foo +[Function: chalk] createChalk { level: 0 } |
