summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/run/workspaces/member_outside_root_dir
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-11-17 02:28:38 +0100
committerGitHub <noreply@github.com>2023-11-17 01:28:38 +0000
commit9534e6e1131542653c4e266f712c4067af2c8ec0 (patch)
tree1a74cccdcdb6bb12c10ab3e2a34d93fd8c4ccc55 /cli/tests/testdata/run/workspaces/member_outside_root_dir
parent544923afdc67e9946453901642746f37f22c8e24 (diff)
feat(unstable): Workspaces support (#20410)
This commit adds unstable workspace support. This is extremely bare-bones and minimal first-pass at this. With this change `deno.json` supports specifying `workspaces` key, that accepts a list of subdirectories. Each workspace can have its own import map. It's required to specify a `"name"` and `"version"` properties in the configuration file for the workspace: ```jsonc // deno.json { "workspaces": [ "a", "b" }, "imports": { "express": "npm:express@5" } } ``` ``` jsonc // a/deno.json { "name": "a", "version": "1.0.2", "imports": { "kleur": "npm:kleur" } } ``` ```jsonc // b/deno.json { "name": "b", "version": "0.51.0", "imports": { "chalk": "npm:chalk" } } ``` `--unstable-workspaces` flag is required to use this feature: ``` $ deno run --unstable-workspaces mod.ts ``` --------- Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'cli/tests/testdata/run/workspaces/member_outside_root_dir')
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/deno.json9
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts1
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json8
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts1
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts5
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/main.out1
-rw-r--r--cli/tests/testdata/run/workspaces/member_outside_root_dir/main.ts4
7 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/deno.json b/cli/tests/testdata/run/workspaces/member_outside_root_dir/deno.json
new file mode 100644
index 000000000..25feefad8
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/deno.json
@@ -0,0 +1,9 @@
+{
+ "workspaces": [
+ "foo",
+ "../other_folder"
+ ],
+ "imports": {
+ "chalk": "npm:chalk"
+ }
+}
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts
new file mode 100644
index 000000000..c8a7e57c4
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/bar/hello.ts
@@ -0,0 +1 @@
+export const hello = "hello from foo";
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json
new file mode 100644
index 000000000..46d84f06f
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "qwerqwer",
+ "version": "0.0.0",
+ "imports": {
+ "~/": "./",
+ "foo/": "./bar/"
+ }
+}
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts
new file mode 100644
index 000000000..4e03777d1
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts
@@ -0,0 +1 @@
+export const buzz = "buzz from foo";
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts
new file mode 100644
index 000000000..d7b16dcc0
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/foo/mod.ts
@@ -0,0 +1,5 @@
+import { hello } from "foo/hello.ts";
+import { buzz } from "~/fizz/buzz.ts";
+
+console.log(hello);
+console.log(buzz);
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/main.out b/cli/tests/testdata/run/workspaces/member_outside_root_dir/main.out
new file mode 100644
index 000000000..205d95aea
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/main.out
@@ -0,0 +1 @@
+error: Workspace member '../other_folder' is outside root configuration directory[WILDCARD] \ No newline at end of file
diff --git a/cli/tests/testdata/run/workspaces/member_outside_root_dir/main.ts b/cli/tests/testdata/run/workspaces/member_outside_root_dir/main.ts
new file mode 100644
index 000000000..182fd8517
--- /dev/null
+++ b/cli/tests/testdata/run/workspaces/member_outside_root_dir/main.ts
@@ -0,0 +1,4 @@
+import chalk from "chalk";
+import "./foo/mod.ts";
+
+console.log(chalk);