Skip to content

Commit

Permalink
fix(workspace): support wildcard packages (#26568)
Browse files Browse the repository at this point in the history
This commit adds support for wildcard packages in `workspace`
configuration option in `deno.json`. This is now supported:
```
{
  "workspace": [
    "./packages/*"
  ]
}
```

Closes #25783
  • Loading branch information
bartlomieju committed Nov 5, 2024
1 parent 331f101 commit 69879d8
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ winres.workspace = true
[dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_cache_dir = { workspace = true }
deno_config = { version = "=0.37.2", features = ["workspace", "sync"] }
deno_config = { version = "=0.38.2", features = ["workspace", "sync"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "0.156.0", default-features = false, features = ["rust", "html", "syntect"] }
deno_graph = { version = "=0.84.1" }
Expand Down
5 changes: 5 additions & 0 deletions tests/specs/run/workspaces/wildcard/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "run -L debug -A main.ts",
"output": "main.out",
"tempDir": true
}
8 changes: 8 additions & 0 deletions tests/specs/run/workspaces/wildcard/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"workspace": [
"./packages/*"
],
"imports": {
"chalk": "npm:chalk"
}
}
22 changes: 22 additions & 0 deletions tests/specs/run/workspaces/wildcard/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[WILDCARD]Workspace config generated this import map {
"imports": {
"chalk": "npm:chalk",
"chalk/": "npm:/chalk/"
},
"scopes": {
"./packages/bar/": {
"@/": "./packages/bar/",
"secret_mod/": "./packages/bar/some_mod/"
},
"./packages/foo/": {
"~/": "./packages/foo/",
"foo/": "./packages/foo/bar/"
}
}
}
[WILDCARD]
hello from foo
buzz from foo
hello from bar
buzz from bar
[Function: chalk][WILDCARD]
5 changes: 5 additions & 0 deletions tests/specs/run/workspaces/wildcard/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import chalk from "chalk";
import "./packages/foo/mod.ts";
import "./packages/bar/mod.ts";

console.log(chalk);
8 changes: 8 additions & 0 deletions tests/specs/run/workspaces/wildcard/packages/bar/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "asdfasdfasdf",
"version": "0.0.0",
"imports": {
"@/": "./",
"secret_mod/": "./some_mod/"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const buzz = "buzz from bar";
5 changes: 5 additions & 0 deletions tests/specs/run/workspaces/wildcard/packages/bar/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { hello } from "secret_mod/hello.ts";
import { buzz } from "@/fizz/buzz.ts";

console.log(hello);
console.log(buzz);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const hello = "hello from bar";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const hello = "hello from foo";
8 changes: 8 additions & 0 deletions tests/specs/run/workspaces/wildcard/packages/foo/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "qwerqwer",
"version": "0.0.0",
"imports": {
"~/": "./",
"foo/": "./bar/"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const buzz = "buzz from foo";
5 changes: 5 additions & 0 deletions tests/specs/run/workspaces/wildcard/packages/foo/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { hello } from "foo/hello.ts";
import { buzz } from "~/fizz/buzz.ts";

console.log(hello);
console.log(buzz);

0 comments on commit 69879d8

Please sign in to comment.