Skip to content

Commit 389bf8a

Browse files
authored
Merge pull request #535 from dahlia/deps
Implement automatic dependency-aware builds using pnpm workspace filters
2 parents 7f2bb1d + 49eaddd commit 389bf8a

28 files changed

Lines changed: 133 additions & 101 deletions

File tree

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Development environment
4545
- Primary environment: [Deno]
4646
- Additional test environments: [Node.js] and [Bun]
4747
- Recommended editor: [Visual Studio Code] with [Deno extension]
48-
- **CRITICAL**: Run `mise run codegen` before working with the codebase
48+
- **CRITICAL**: Run `mise run install` (or `pnpm install`) after checkout.
49+
This automatically runs code generation and builds all packages.
4950
- Lockfiles: Both *deno.lock* and *pnpm-lock.yaml* are committed.
5051
Update them when changing dependencies.
5152

@@ -119,6 +120,9 @@ Development workflow
119120

120121
- **Code Generation**: Run `mise run codegen` whenever vocabulary YAML files
121122
or code generation scripts change.
123+
- **Building Packages**: After installation, all packages are automatically
124+
built. To rebuild a specific package and its dependencies, run `pnpm build`
125+
in that package's directory.
122126
- **Checking Code**: Run `mise run check` before committing.
123127
- **Running Tests**: Use `mise run test:deno` for Deno tests or
124128
`mise run test` for all environments.

CONTRIBUTING.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,16 @@ see the [*Set Up Your Environment* section][1] in the Deno manual.
391391

392392
> [!CAUTION]
393393
>
394-
> Fedify heavily depends on code generation, so you need to run
395-
> `mise run codegen` before coding or testing.
394+
> Fedify heavily depends on code generation and all packages must be built
395+
> before coding or testing. Running `mise run install` (or `pnpm install`)
396+
> automatically handles code generation and builds all packages.
396397
397398
Assuming you have Deno and Visual Studio Code installed, you can open
398399
the repository in Visual Studio Code and get ready to hack on Fedify by running
399400
the following commands at the *root* of the repository:
400401

401402
~~~~ bash
402-
mise run codegen
403+
mise run install # This runs codegen and builds all packages
403404
code .
404405
~~~~
405406

@@ -412,9 +413,10 @@ code .
412413
> mise run hooks:install
413414
> ~~~~
414415
415-
Note that the `mise run codegen` command is required to run only once at
416-
the very first time, or when you update the code generation scripts. Otherwise,
417-
you can skip the command and just run:
416+
Note that the `mise run install` command is required to run only once at
417+
the very first time after checkout. When you update dependencies or code
418+
generation scripts, run `mise run install` again. Otherwise, you can skip
419+
the command and just run:
418420
419421
~~~~ bash
420422
code .

mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ run = "deno task codegen"
2424
description = "Prepare the development environment (codegen, install, build fixtures)"
2525
env = { CI = "true" } # Prevent pnpm from prompting for confirmation
2626
depends = ["install"]
27-
run = "pnpm --filter '@fedify/*' --recursive --parallel build"
27+
run = "pnpm -r run build:self"
2828

2929
[tasks.prepare-each]
3030
description = "Prepare specific package(s)"

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"scripts": {
3+
"prepare": "pnpm -r run build:self"
4+
},
25
"pnpm": {
36
"onlyBuiltDependencies": [
47
"esbuild"

packages/amqp/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@
6868
"typescript": "catalog:"
6969
},
7070
"scripts": {
71-
"build": "tsdown",
72-
"prepack": "tsdown",
73-
"prepublish": "tsdown",
74-
"test": "tsdown && node --experimental-transform-types --test",
75-
"test:bun": "tsdown && bun test --timeout 15000",
71+
"build:self": "tsdown",
72+
"build": "pnpm --filter @fedify/amqp... run build:self",
73+
"prepack": "pnpm build",
74+
"prepublish": "pnpm build",
75+
"test": "pnpm build && node --experimental-transform-types --test",
76+
"test:bun": "pnpm build && bun test --timeout 15000",
7677
"test:deno": "deno task test",
7778
"test-all": "tsdown && node --experimental-transform-types --test && bun test --timeout 15000 && deno task test"
7879
}

packages/cfworkers/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@
6262
"wrangler": "^4.21.1"
6363
},
6464
"scripts": {
65-
"build": "tsdown",
66-
"prepack": "tsdown",
67-
"prepublish": "tsdown",
65+
"build:self": "tsdown",
66+
"build": "pnpm --filter @fedify/cfworkers... run build:self",
67+
"prepack": "pnpm build",
68+
"prepublish": "pnpm build",
6869
"test": "vitest run"
6970
}
7071
}

packages/cli/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@
8686
"typescript": "catalog:"
8787
},
8888
"scripts": {
89-
"codegen": "deno task -f @fedify/fedify codegen",
90-
"build": "pnpm run codegen && pnpm run --filter fedify build && pnpm run --filter relay build && pnpm run --filter sqlite build && tsdown",
91-
"prepack": "pnpm run build",
92-
"prepublish": "pnpm run build",
89+
"build:self": "tsdown",
90+
"build": "pnpm --filter @fedify/cli... run build:self",
91+
"prepack": "pnpm build",
92+
"prepublish": "pnpm build",
9393
"test": "pnpm build && node --test --experimental-transform-types 'src/**/*.test.ts' '!src/init/test/**'",
9494
"test-init": "deno task test-init",
95-
"test:bun": "tsdown && bun test",
96-
"run": "tsdown && node dist/mod.js",
95+
"test:bun": "pnpm build && bun test",
96+
"run": "pnpm build && node dist/mod.js",
9797
"runi": "tsdown && node dist/mod.js",
98-
"run:bun": "tsdown && bun dist/mod.js",
98+
"run:bun": "pnpm build && bun dist/mod.js",
9999
"runi:bun": "tsdown && bun dist/mod.js"
100100
}
101101
}

packages/elysia/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@
4646
"package.json"
4747
],
4848
"scripts": {
49-
"build": "tsdown",
50-
"prepack": "tsdown",
51-
"prepublish": "tsdown"
49+
"build:self": "tsdown",
50+
"build": "pnpm --filter @fedify/elysia... run build:self",
51+
"prepack": "pnpm build",
52+
"prepublish": "pnpm build"
5253
},
5354
"peerDependencies": {
5455
"elysia": "^1.3.6",

packages/express/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
"typescript": "catalog:"
5959
},
6060
"scripts": {
61-
"build": "tsdown",
62-
"prepack": "tsdown",
63-
"prepublish": "tsdown"
61+
"build:self": "tsdown",
62+
"build": "pnpm --filter @fedify/express... run build:self",
63+
"prepack": "pnpm build",
64+
"prepublish": "pnpm build"
6465
}
6566
}

packages/fastify/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@
5656
"typescript": "catalog:"
5757
},
5858
"scripts": {
59-
"build": "tsdown",
60-
"prepack": "tsdown",
61-
"prepublish": "tsdown",
59+
"build:self": "tsdown",
60+
"build": "pnpm --filter @fedify/fastify... run build:self",
61+
"prepack": "pnpm build",
62+
"prepublish": "pnpm build",
6263
"test": "node --experimental-transform-types --test"
6364
}
6465
}

0 commit comments

Comments
 (0)