@smoothbricks/cli 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -32
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +110 -10
- package/dist/devenv/index.d.ts +10 -0
- package/dist/devenv/index.d.ts.map +1 -0
- package/dist/devenv/index.js +27 -0
- package/dist/generate/index.d.ts +20 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +47 -0
- package/dist/lib/cli-package.d.ts +4 -0
- package/dist/lib/cli-package.d.ts.map +1 -0
- package/dist/lib/cli-package.js +15 -0
- package/dist/lib/run.d.ts +6 -0
- package/dist/lib/run.d.ts.map +1 -1
- package/dist/lib/run.js +32 -0
- package/dist/lib/workspace.d.ts +25 -1
- package/dist/lib/workspace.d.ts.map +1 -1
- package/dist/lib/workspace.js +79 -17
- package/dist/monorepo/commit-msg.d.ts +8 -1
- package/dist/monorepo/commit-msg.d.ts.map +1 -1
- package/dist/monorepo/commit-msg.js +85 -7
- package/dist/monorepo/index.d.ts +19 -2
- package/dist/monorepo/index.d.ts.map +1 -1
- package/dist/monorepo/index.js +104 -16
- package/dist/monorepo/lockfile.d.ts.map +1 -1
- package/dist/monorepo/lockfile.js +9 -0
- package/dist/monorepo/managed-files.js +1 -1
- package/dist/monorepo/nx-sync.d.ts +2 -1
- package/dist/monorepo/nx-sync.d.ts.map +1 -1
- package/dist/monorepo/nx-sync.js +8 -2
- package/dist/monorepo/package-hygiene.d.ts +6 -2
- package/dist/monorepo/package-hygiene.d.ts.map +1 -1
- package/dist/monorepo/package-hygiene.js +12 -4
- package/dist/monorepo/package-policy.d.ts +13 -4
- package/dist/monorepo/package-policy.d.ts.map +1 -1
- package/dist/monorepo/package-policy.js +208 -113
- package/dist/monorepo/packed-package.d.ts +3 -0
- package/dist/monorepo/packed-package.d.ts.map +1 -1
- package/dist/monorepo/packed-package.js +68 -36
- package/dist/monorepo/packs/index.d.ts +20 -1
- package/dist/monorepo/packs/index.d.ts.map +1 -1
- package/dist/monorepo/packs/index.js +238 -19
- package/dist/monorepo/publish-workflow.d.ts +0 -4
- package/dist/monorepo/publish-workflow.d.ts.map +1 -1
- package/dist/monorepo/publish-workflow.js +7 -15
- package/dist/monorepo/tool-validation.d.ts +22 -0
- package/dist/monorepo/tool-validation.d.ts.map +1 -0
- package/dist/monorepo/tool-validation.js +399 -0
- package/dist/nx/index.d.ts +25 -0
- package/dist/nx/index.d.ts.map +1 -0
- package/dist/nx/index.js +112 -0
- package/dist/release/bootstrap-npm-packages.d.ts +19 -0
- package/dist/release/bootstrap-npm-packages.d.ts.map +1 -0
- package/dist/release/bootstrap-npm-packages.js +58 -0
- package/dist/release/candidates.d.ts +11 -0
- package/dist/release/candidates.d.ts.map +1 -0
- package/dist/release/candidates.js +181 -0
- package/dist/release/core.d.ts +4 -1
- package/dist/release/core.d.ts.map +1 -1
- package/dist/release/core.js +76 -9
- package/dist/release/github-release.d.ts +1 -0
- package/dist/release/github-release.d.ts.map +1 -1
- package/dist/release/github-release.js +3 -3
- package/dist/release/index.d.ts +32 -1
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +488 -64
- package/dist/release/npm-auth.d.ts +0 -1
- package/dist/release/npm-auth.d.ts.map +1 -1
- package/dist/release/npm-auth.js +4 -16
- package/dist/release/orchestration.d.ts +11 -2
- package/dist/release/orchestration.d.ts.map +1 -1
- package/dist/release/orchestration.js +41 -3
- package/dist/release/publish-plan.js +1 -1
- package/managed/raw/git-format-staged.yml +54 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +1 -1
- package/managed/templates/github/actions/setup-devenv/action.yml +1 -7
- package/managed/templates/github/workflows/ci.yml +4 -2
- package/package.json +15 -8
- package/src/cli.ts +153 -22
- package/src/devenv/index.test.ts +49 -0
- package/src/devenv/index.ts +38 -0
- package/src/generate/index.ts +92 -0
- package/src/lib/cli-package.ts +18 -0
- package/src/lib/run.ts +44 -0
- package/src/lib/workspace.ts +112 -17
- package/src/monorepo/__tests__/publish-workflow.test.ts +16 -9
- package/src/monorepo/commit-msg.test.ts +45 -0
- package/src/monorepo/commit-msg.ts +107 -7
- package/src/monorepo/index.ts +142 -16
- package/src/monorepo/lockfile.ts +9 -0
- package/src/monorepo/managed-files.ts +1 -1
- package/src/monorepo/nx-sync.ts +9 -2
- package/src/monorepo/package-hygiene.test.ts +34 -0
- package/src/monorepo/package-hygiene.ts +26 -4
- package/src/monorepo/package-policy.test.ts +1130 -0
- package/src/monorepo/package-policy.ts +237 -114
- package/src/monorepo/packed-package.ts +89 -37
- package/src/monorepo/packs/index.test.ts +189 -0
- package/src/monorepo/packs/index.ts +311 -20
- package/src/monorepo/publish-workflow.ts +10 -19
- package/src/monorepo/setup-test-tracing.test.ts +120 -0
- package/src/monorepo/tool-validation.test.ts +261 -0
- package/src/monorepo/tool-validation.ts +462 -0
- package/src/nx/index.test.ts +73 -0
- package/src/nx/index.ts +139 -0
- package/src/release/__tests__/bootstrap-npm-packages.test.ts +127 -0
- package/src/release/__tests__/candidates.test.ts +262 -0
- package/src/release/__tests__/core-properties.test.ts +6 -6
- package/src/release/__tests__/core-scenarios.test.ts +27 -20
- package/src/release/__tests__/core.test.ts +52 -5
- package/src/release/__tests__/fixture-repo.test.ts +90 -31
- package/src/release/__tests__/github-release.test.ts +22 -24
- package/src/release/__tests__/helpers/fixture-repo.ts +1 -0
- package/src/release/__tests__/npm-auth.test.ts +12 -21
- package/src/release/__tests__/orchestration.test.ts +142 -12
- package/src/release/__tests__/publish-plan.test.ts +9 -3
- package/src/release/__tests__/retag-unpublished.test.ts +10 -10
- package/src/release/__tests__/trust-publisher.test.ts +165 -0
- package/src/release/bootstrap-npm-packages.ts +88 -0
- package/src/release/candidates.ts +225 -0
- package/src/release/core.ts +96 -10
- package/src/release/github-release.ts +3 -3
- package/src/release/index.ts +658 -74
- package/src/release/npm-auth.ts +4 -33
- package/src/release/orchestration.ts +60 -5
- package/src/release/publish-plan.ts +1 -1
- package/dist/nx-version-actions.cjs +0 -25
- package/dist/nx-version-actions.d.cts +0 -6
- package/dist/nx-version-actions.d.cts.map +0 -1
- package/managed/raw/.git-format-staged.yml +0 -47
- package/src/nx-version-actions.cts +0 -36
package/README.md
CHANGED
|
@@ -36,13 +36,15 @@ smoo monorepo validate-commit-msg <commit-msg-file>
|
|
|
36
36
|
smoo monorepo sync-bun-lockfile-versions
|
|
37
37
|
smoo monorepo list-release-packages [--fail-empty] [--github-output <path>]
|
|
38
38
|
smoo monorepo validate-public-tags
|
|
39
|
+
smoo monorepo setup-test-tracing (--all | --projects <projects>) [--dry-run]
|
|
39
40
|
|
|
40
41
|
smoo release npm-status
|
|
41
42
|
smoo release repair-pending [--dry-run]
|
|
42
43
|
smoo release version --bump <auto|patch|minor|major|prerelease> [--dry-run] [--github-output <path>]
|
|
43
44
|
smoo release publish --bump <auto|patch|minor|major|prerelease> [--dry-run]
|
|
44
45
|
smoo release retag-unpublished <tag...> [--to <ref>] [--push] [--dispatch] [--remote <remote>] [--branch <branch>] [--dry-run]
|
|
45
|
-
smoo release
|
|
46
|
+
smoo release bootstrap-npm-packages [--dry-run] [--skip-login] [--package <name...>]
|
|
47
|
+
smoo release trust-publisher [--bootstrap] [--dry-run] [--skip-login] [--package <name...>]
|
|
46
48
|
|
|
47
49
|
smoo github-ci cleanup-cache
|
|
48
50
|
smoo github-ci nx-smart --target <target> --name <check-name> --step <number>
|
|
@@ -62,6 +64,10 @@ It currently:
|
|
|
62
64
|
- Synchronizes root runtime versions inside devenv, or when `--sync-runtime` is passed.
|
|
63
65
|
- Applies safe publish metadata defaults to `npm:public` packages without inferring package ownership.
|
|
64
66
|
- Normalizes internal workspace dependency ranges to `workspace:*`.
|
|
67
|
+
- Rewrites safe package scripts in packages with workspace dependencies so developer commands like `bun run test` and
|
|
68
|
+
`bun run dev` stay available while delegating through Nx targets.
|
|
69
|
+
- `smoo monorepo validate --fix` creates/updates `tooling/package.json`, keeps `@smoothbricks/cli` there instead of the
|
|
70
|
+
root workspace package, and fills required workspace/devenv tool declarations.
|
|
65
71
|
- Runs [`sherif --fix --select highest`][sherif] for broad monorepo package hygiene.
|
|
66
72
|
- Normalizes conditional export ordering so `types` comes first and `default` comes last.
|
|
67
73
|
- Adds `src` to package `files` when development-only exports intentionally point at source files.
|
|
@@ -70,6 +76,19 @@ The workspace dependency rule is generic. `smoo` does not know about individual
|
|
|
70
76
|
For every root or workspace `package.json`, if a dependency name matches an actual package in the same workspace, `smoo`
|
|
71
77
|
rewrites that range to `workspace:*`.
|
|
72
78
|
|
|
79
|
+
Packages with internal workspace dependencies also need Nx-aware scripts so dependent builds run before local commands.
|
|
80
|
+
For safe build, test, typecheck, benchmark, dev, and preview commands, `smoo monorepo validate --fix` moves the real
|
|
81
|
+
command into `package.json` `nx.targets.<target>.options.command`, sets `cwd` to `{projectRoot}`, and replaces the
|
|
82
|
+
script with an `nx run <project>:<target>` alias. Continuous commands such as `astro dev`, `vite dev`, and previews get
|
|
83
|
+
`--tui=false --outputStyle=stream` on the alias and `continuous: true` on the Nx target. Simple leading environment
|
|
84
|
+
assignments are moved into `nx.targets.<target>.options.env` so commands such as
|
|
85
|
+
`NODE_OPTIONS='--import=extensionless/register' astro dev` remain shell-independent.
|
|
86
|
+
|
|
87
|
+
The rewrite is intentionally conservative. `smoo` does not rewrite deploy, database, release, sync, subtree, publish, or
|
|
88
|
+
pack scripts, and it rejects Nx target commands that recurse through package scripts such as `bun run test`. The reason
|
|
89
|
+
is dependency correctness without hiding unsafe operational commands behind generated Nx targets: workspace-dependent
|
|
90
|
+
packages should get `^build` ordering for ordinary development commands, while publishing and deployment stay explicit.
|
|
91
|
+
|
|
73
92
|
`smoo monorepo init --runtime-only` only synchronizes root runtime versions. It is used from direnv setup so
|
|
74
93
|
`packageManager`, `engines.node`, and `@types/node` stay aligned with the active devenv shell without duplicating that
|
|
75
94
|
policy in the direnv script.
|
|
@@ -79,6 +98,36 @@ while package manifests are not forced to depend on Bun just because a test tsco
|
|
|
79
98
|
does explicitly declare `@types/bun`, `sherif` can keep duplicate declarations consistent, but `smoo` owns the semantic
|
|
80
99
|
root `bun@x.y.z` to `@types/bun x.y.z` relationship.
|
|
81
100
|
|
|
101
|
+
## LMAO Test Tracing
|
|
102
|
+
|
|
103
|
+
`smoo monorepo setup-test-tracing` configures LMAO-backed Bun test tracing for workspace packages. It is a bulk wrapper
|
|
104
|
+
around the `@smoothbricks/nx-plugin:bun-test-tracing` generator, so the Nx plugin remains the single source of truth for
|
|
105
|
+
the files written.
|
|
106
|
+
|
|
107
|
+
Configure every workspace package:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
smoo monorepo setup-test-tracing --all
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Configure selected packages by Nx project name, package name, or package root:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
smoo monorepo setup-test-tracing --projects cli,@smoothbricks/lmao,packages/nx-plugin
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The command infers the op context module from each package's `package.json` `name`, assumes an `opContext` named export,
|
|
120
|
+
and imports `defineTestTracer` from `@smoothbricks/lmao/testing/bun`. Override those defaults when a repository uses a
|
|
121
|
+
different convention:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
smoo monorepo setup-test-tracing --projects my-lib --op-context-export myOpContext
|
|
125
|
+
smoo monorepo setup-test-tracing --projects my-lib --tracer-module @scope/testing/bun
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Use `--dry-run` to print the `nx g @smoothbricks/nx-plugin:bun-test-tracing ...` invocations without writing files.
|
|
129
|
+
After setup, run `smoo monorepo validate --fix` to apply the broader SmoothBricks monorepo policy.
|
|
130
|
+
|
|
82
131
|
## Validation
|
|
83
132
|
|
|
84
133
|
`smoo monorepo validate` is the read-only gate. It should pass in local shells and CI after packages have been built.
|
|
@@ -88,12 +137,16 @@ It checks:
|
|
|
88
137
|
- Managed file drift.
|
|
89
138
|
- Root package policy.
|
|
90
139
|
- Root Bun type version matches the Bun package manager version.
|
|
140
|
+
- Tooling policy: root `package.json` owns workspace-level tools like `nx`, `tooling/package.json` owns `smoo`, and
|
|
141
|
+
`tooling/direnv/devenv.nix` owns shell-provided tools like `bun`, `git-format-staged`, and `fmt`.
|
|
91
142
|
- Nx release policy, including project package release tags, project-level GitHub Release changelogs, and the temporary
|
|
92
143
|
Bun lockfile versionActions hook.
|
|
93
144
|
- `bun.lock` workspace versions match package manifests.
|
|
94
145
|
- Public package tag policy.
|
|
95
146
|
- Public package metadata.
|
|
96
147
|
- Workspace dependency ranges.
|
|
148
|
+
- Workspace-dependent package scripts delegate safe commands through Nx targets without recursive script runners.
|
|
149
|
+
- Nx target conventions and inferred-task setup.
|
|
97
150
|
- [`sherif`] package hygiene, with warnings treated as validation failures.
|
|
98
151
|
- Packed public package artifacts with [`publint`].
|
|
99
152
|
- Packed public package type resolution with the [`attw`][are-the-types-wrong] CLI.
|
|
@@ -146,24 +199,71 @@ package `repository.url` is a validation failure so new packages must consciousl
|
|
|
146
199
|
current repository or mirrored from another one. Init still sets `publishConfig.access = "public"`, repository type,
|
|
147
200
|
repository directory, export ordering, and source-file publish entries when those can be derived safely.
|
|
148
201
|
|
|
149
|
-
`smoo monorepo list-release-packages` prints the comma-separated
|
|
150
|
-
the current repository. Release commands, trusted-publisher setup, and the managed publish
|
|
151
|
-
release package list instead of every public package in the workspace.
|
|
202
|
+
`smoo monorepo list-release-packages` prints the comma-separated Nx project names for packages that are both
|
|
203
|
+
`npm:public` and owned by the current repository. Release commands, trusted-publisher setup, and the managed publish
|
|
204
|
+
workflow use this owned release package list instead of every public package in the workspace. smoo keeps both names in
|
|
205
|
+
release metadata: Nx commands, GitHub Release tags, and git release tags use `projectName`, while npm publish checks and
|
|
206
|
+
tarball validation use the real package `name`.
|
|
152
207
|
|
|
153
208
|
For [GitHub Actions], `smoo monorepo list-release-packages --fail-empty --github-output "$GITHUB_OUTPUT"` appends the
|
|
154
|
-
`projects=<
|
|
209
|
+
`projects=<nx-project-list>` output expected by the managed publish workflow and fails with a clear error when no owned
|
|
155
210
|
release packages exist.
|
|
156
211
|
|
|
157
212
|
`smoo release npm-status` shows whether each owned release package's current `name@version` already exists on npm. It is
|
|
158
213
|
an npm registry check, not a full release workflow status check.
|
|
159
214
|
|
|
215
|
+
`smoo release version --bump auto` first selects direct release candidates, then delegates versioning to [Nx]. Direct
|
|
216
|
+
candidates are owned public packages with package-local changes that can affect published users: files matched by the
|
|
217
|
+
package's resolved Nx `build`/`production` inputs, packaged assets listed in `package.json` `files`, package metadata
|
|
218
|
+
docs such as README/LICENSE/CHANGELOG, or user-visible `package.json` fields such as `exports`, `bin`, `types`,
|
|
219
|
+
`dependencies`, `peerDependencies`, and `publishConfig`. Test-only and local automation changes such as `scripts`, `nx`,
|
|
220
|
+
`devDependencies`, and `tsconfig.test.json` do not select a package by themselves.
|
|
221
|
+
|
|
222
|
+
Downstream dependency bumps are intentionally left to Nx release. If package A is selected and bumped, Nx may also bump
|
|
223
|
+
public package B when B depends on A, even when B has no direct file changes. `smoo` should not pre-expand direct
|
|
224
|
+
candidates to downstream dependents because that would duplicate Nx's dependency graph and can over-select packages.
|
|
225
|
+
|
|
226
|
+
## Nx Conventions
|
|
227
|
+
|
|
228
|
+
`smoo` keeps Nx target names predictable and separates tool work from aggregate workflows.
|
|
229
|
+
|
|
230
|
+
Official Nx plugins own targets they already know how to infer. For example, `@nx/js/typescript` owns TypeScript library
|
|
231
|
+
builds, so a package `tsconfig.lib.json` produces the concrete target `tsc-js`.
|
|
232
|
+
|
|
233
|
+
`@smoothbricks/nx-plugin` only fills SmoothBricks convention gaps that official plugins do not provide. Today that means
|
|
234
|
+
Bun test typechecking, non-TypeScript build-tool steps, and aggregate targets.
|
|
235
|
+
|
|
236
|
+
Concrete targets use `{tool}-{output}` names and describe the tool that runs and the artifact or purpose it produces:
|
|
237
|
+
|
|
238
|
+
- `tsc-js` comes from the official TypeScript plugin and runs `tsc` for package JavaScript/declaration output.
|
|
239
|
+
- Packages that run `bun test` must have `tsconfig.test.json`. Bun executes tests without typechecking, so smoo creates
|
|
240
|
+
a no-emit `typecheck-tests` target from that config and wires it into validation. Other test runners may own their own
|
|
241
|
+
typecheck path.
|
|
242
|
+
- Test tsconfigs are validation configs, not TypeScript build-mode projects. They must use `noEmit`, must not set
|
|
243
|
+
`composite: true`, and package root `tsconfig.json` must not reference `./tsconfig.test.json`. The inferred
|
|
244
|
+
`typecheck-tests` target runs `tsc --noEmit -p tsconfig.test.json` after `build` instead.
|
|
245
|
+
- Non-TypeScript build steps come from explicit tool configuration. For example, a package `build.zig` must expose named
|
|
246
|
+
`b.step("name", ...)` entries; each non-reserved step becomes a `zig-name` target such as `zig-wasm`.
|
|
247
|
+
- `build` is an aggregate. It exists only when there is at least one concrete build target such as `tsc-js`,
|
|
248
|
+
`tsdown-js`, or another tool-output target, and it depends on output-family wildcards such as `*-js`, `*-web`,
|
|
249
|
+
`*-html`, `*-css`, `*-ios`, `*-android`, `*-native`, `*-napi`, `*-bun`, and `*-wasm` instead of duplicating commands.
|
|
250
|
+
- `lint` is an aggregate validation target. It is not a formatting target.
|
|
251
|
+
|
|
252
|
+
Explicit Nx target names must not contain `:`. Nx already uses colon syntax at the CLI boundary:
|
|
253
|
+
`project:target:configuration`. Allowing target names like `build:wasm` makes command parsing and package-script aliases
|
|
254
|
+
look like configurations, and it prevents a clean split between concrete tool-output targets and aggregate targets.
|
|
255
|
+
|
|
256
|
+
Use tool-output names for concrete targets, such as `tsc-js`, `tsdown-js`, and `zig-wasm`. Use `build` and `lint` only
|
|
257
|
+
as aggregate targets. Package scripts may still use developer-friendly colon names, for example `build:wasm`, but those
|
|
258
|
+
scripts should delegate to unambiguous Nx targets such as `nx run pkg:zig-wasm`.
|
|
259
|
+
|
|
160
260
|
## Managed Files
|
|
161
261
|
|
|
162
262
|
`smoo monorepo update` writes the managed files into a repository.
|
|
163
263
|
|
|
164
264
|
Managed files include:
|
|
165
265
|
|
|
166
|
-
- [
|
|
266
|
+
- [`tooling/git-hooks/git-format-staged.yml`][git-format-staged]
|
|
167
267
|
- Git hook scripts under `tooling/git-hooks`
|
|
168
268
|
- [direnv]/[GitHub Actions] bootstrap scripts under `tooling/direnv`
|
|
169
269
|
- [GitHub Actions] workflows under `.github/workflows`
|
|
@@ -185,10 +285,13 @@ smoo monorepo diff
|
|
|
185
285
|
|
|
186
286
|
`check` fails when a managed file is missing or stale. `diff` reports drift without writing files.
|
|
187
287
|
|
|
188
|
-
## Git Hooks
|
|
288
|
+
## Formatting And Git Hooks
|
|
189
289
|
|
|
190
|
-
The
|
|
191
|
-
|
|
290
|
+
The root `lint:fix` script runs [`git-format-staged`][git-format-staged] with
|
|
291
|
+
`--config tooling/git-hooks/git-format-staged.yml --unstaged`. The formatter config intentionally excludes `bun.lock`.
|
|
292
|
+
|
|
293
|
+
The generated pre-commit hook runs the same formatter path from the repository root with `tooling`, `node_modules/.bin`,
|
|
294
|
+
and the [devenv] profile on `PATH`.
|
|
192
295
|
|
|
193
296
|
After formatting, the hook runs `smoo monorepo validate --fail-fast --only-if-new-workspace-package`. This keeps normal
|
|
194
297
|
commits fast while still catching incomplete package setup and conditional managed-file drift when a new workspace
|
|
@@ -197,10 +300,16 @@ package manifest is staged.
|
|
|
197
300
|
The generated commit-msg hook delegates conventional commit validation to:
|
|
198
301
|
|
|
199
302
|
```bash
|
|
200
|
-
smoo monorepo validate-commit-msg <commit-msg-file>
|
|
303
|
+
smoo monorepo validate-commit-msg --fix <commit-msg-file>
|
|
201
304
|
```
|
|
202
305
|
|
|
203
|
-
This keeps hook behavior consistent with CI and avoids duplicating commit message parsing in shell.
|
|
306
|
+
This keeps hook behavior consistent with CI and avoids duplicating commit message parsing in shell. With `--fix`, smoo
|
|
307
|
+
wraps prose body paragraphs through `fmt -w 72` while preserving fenced code blocks, quoted markdown, indented blocks,
|
|
308
|
+
bullets, trailers, URLs, and comment lines.
|
|
309
|
+
|
|
310
|
+
Conventional commit scopes should use Nx project names. For packages in the same npm scope as the root package, smoo
|
|
311
|
+
requires `package.json` `nx.name` to be the unscoped package name, such as `cli` for `@smoothbricks/cli`, so subjects
|
|
312
|
+
like `fix(cli): repair release notes` map cleanly to Nx Release.
|
|
204
313
|
|
|
205
314
|
## GitHub Actions
|
|
206
315
|
|
|
@@ -246,14 +355,26 @@ Release commands wrap [Nx Release][nx-release] but keep SmoothBricks policy in o
|
|
|
246
355
|
|
|
247
356
|
Versioning:
|
|
248
357
|
|
|
249
|
-
- `--bump auto`
|
|
250
|
-
|
|
358
|
+
- `--bump auto` first filters owned release packages to package-local candidates, then lets [Nx Release][nx-release]
|
|
359
|
+
derive the semver bump from [Conventional Commits]. A tagged package is an auto candidate only when files under its
|
|
360
|
+
package root changed since its current `projectName@version` release tag. An untagged package is an auto candidate
|
|
361
|
+
only when its package root has git history and its current version is stable. Root-only changes, workflow edits,
|
|
362
|
+
lockfile-only churn, untagged next-prerelease preparation commits, and other workspace-global changes may still affect
|
|
363
|
+
Nx tasks, but they do not make unrelated package artifacts releasable.
|
|
364
|
+
- `--bump patch|minor|major|prerelease` forces the release specifier for the full owned release package set. Forced
|
|
365
|
+
bumps intentionally bypass the package-local auto filter.
|
|
251
366
|
- Release packages are discovered from `npm:public` packages whose `repository.url` exactly matches the root package.
|
|
252
367
|
- [Nx Release][nx-release] config must use `currentVersionResolver: "git-tag"` with
|
|
253
368
|
`fallbackCurrentVersionResolver: "disk"`. Conventional-commit versioning requires git tags as the primary source,
|
|
254
369
|
while the disk fallback supports initial releases before package tags exist.
|
|
255
370
|
- [Nx Release][nx-release] config must use `versionActions: "@smoothbricks/cli/nx-version-actions"`. This wraps Nx's JS
|
|
256
371
|
version actions and temporarily syncs `bun.lock` workspace versions after Nx runs `bun install --lockfile-only`.
|
|
372
|
+
- Same-org scoped packages must define short `package.json` `nx.name` values, for example `@smoothbricks/money` uses
|
|
373
|
+
`"nx": { "name": "money" }`. This lets Nx Release understand commit scopes like `fix(money): ...` without requiring
|
|
374
|
+
the npm org in every commit subject.
|
|
375
|
+
- Nx project names and npm package names are different release identities. Nx project filters, workflow `projects=`
|
|
376
|
+
outputs, build/lint/test validation, project changelog lookup, GitHub Release tags, and durable git release tags use
|
|
377
|
+
`projectName`. npm publish checks and tarball validation use package `name`.
|
|
257
378
|
- [Nx Release][nx-release] `preVersionCommand` is intentionally not used. smoo builds exactly the packages that still
|
|
258
379
|
need npm publish immediately before packing them, while the managed workflow separately builds, lints, tests, and
|
|
259
380
|
validates newly created release commits.
|
|
@@ -265,8 +386,9 @@ Versioning:
|
|
|
265
386
|
target, versioning returns `mode=none` and leaves idempotent completion to `smoo release publish`.
|
|
266
387
|
- `smoo release version --github-output "$GITHUB_OUTPUT"` appends `mode=new|none` and `projects=<comma-list>`. The
|
|
267
388
|
managed publish workflow uses `mode != "none"` to build, lint, test, and validate exactly the commit that
|
|
268
|
-
`smoo release publish` will publish.
|
|
269
|
-
|
|
389
|
+
`smoo release publish` will publish. `projects` is a comma-separated Nx project-name list, not an npm package-name
|
|
390
|
+
list. The validation and publish step names include the selected mode so the [GitHub Actions] run shows whether it is
|
|
391
|
+
creating a new release or recording a no-op.
|
|
270
392
|
- Explicit bumps are mandatory when `HEAD` is not already a release target: after pending releases are repaired,
|
|
271
393
|
`bump=patch|minor|major|prerelease` must make Nx create a new release commit. smoo fails if Nx returns without moving
|
|
272
394
|
`HEAD`; `auto` may no-op when there are no releasable conventional commits.
|
|
@@ -278,8 +400,8 @@ Versioning:
|
|
|
278
400
|
[oven-sh/bun#18906](https://github.com/oven-sh/bun/issues/18906),
|
|
279
401
|
[oven-sh/bun#20477](https://github.com/oven-sh/bun/issues/20477), and
|
|
280
402
|
[oven-sh/bun#20829](https://github.com/oven-sh/bun/issues/20829).
|
|
281
|
-
- Package release tags must use `
|
|
282
|
-
shape and
|
|
403
|
+
- Package release tags must use the Nx project name and version, for example `nx-plugin@0.0.2`. smoo derives release
|
|
404
|
+
package/version pairs from that tag shape and maps project names back to npm package names before checking npm state.
|
|
283
405
|
- `smoo release retag-unpublished <tag...>` is a break-glass recovery command for the case where Nx already committed a
|
|
284
406
|
version bump but npm publish failed before the package version became durable. It moves exact owned release tags to
|
|
285
407
|
`HEAD` by default without bumping package manifests again. It refuses to move a tag when `package@version` already
|
|
@@ -295,7 +417,7 @@ the durable record that a package version was selected for release. It only chec
|
|
|
295
417
|
decide which tags still need work; it does not walk normal commits looking for release-shaped changes.
|
|
296
418
|
|
|
297
419
|
1. Collect owned release tags from the fetched remote tag set, sorted newest-first by annotated tag `creatordate`. Only
|
|
298
|
-
tags matching owned
|
|
420
|
+
tags matching owned Nx project release names are considered, and each tag is peeled to the commit it releases.
|
|
299
421
|
2. Classify each owned release tag before grouping by commit. A tag needs npm repair when `package@version` is missing
|
|
300
422
|
from npm, and it needs GitHub repair when the GitHub Release for that tag is missing. Tags needing neither are
|
|
301
423
|
filtered out immediately.
|
|
@@ -305,8 +427,8 @@ decide which tags still need work; it does not walk normal commits looking for r
|
|
|
305
427
|
4. Sort the remaining repair commits oldest-to-newest. Only after this sorted non-HEAD repair list exists does smoo
|
|
306
428
|
start checking out commits.
|
|
307
429
|
5. For each repair commit, check out the commit once and load that checkout's direnv environment once. If any grouped
|
|
308
|
-
tag still needs npm publish, run `nx run-many -t build --projects=<comma-separated npm-missing
|
|
309
|
-
publish those packages using the npm dist-tag implied by each package version. If the commit only needs GitHub
|
|
430
|
+
tag still needs npm publish, run `nx run-many -t build --projects=<comma-separated npm-missing Nx projects>` once,
|
|
431
|
+
then publish those packages using the npm dist-tag implied by each package version. If the commit only needs GitHub
|
|
310
432
|
Releases, skip the build. Finally, create the missing GitHub Releases for the grouped tags that need them.
|
|
311
433
|
|
|
312
434
|
Pending release state should be a suffix of the release-target timeline because `repair-pending` runs before every
|
|
@@ -320,29 +442,36 @@ Publishing:
|
|
|
320
442
|
- `smoo release publish` pushes missing branch/tag refs, publishes missing npm versions, creates or updates GitHub
|
|
321
443
|
Releases, and writes a GitHub Step Summary. Already published npm versions are skipped, so reruns after auth or
|
|
322
444
|
network failures retry only the package versions npm does not have yet.
|
|
445
|
+
- After a successful non-dry-run stable release at the branch tip, `smoo release publish` runs an untagged
|
|
446
|
+
`prerelease --preid next` version bump for the released stable packages and pushes that branch commit. This prepares
|
|
447
|
+
the codebase for the next development prerelease without creating prerelease release tags or publishing npm packages.
|
|
323
448
|
- npm registry state gates publish idempotency only. It decides which already-versioned package tarballs still need to
|
|
324
449
|
be published during a real release retry, not whether versioning should run or whether the workflow has a release to
|
|
325
450
|
publish.
|
|
326
|
-
- Before npm publish, smoo runs `nx run-many -t build --projects=<comma-separated npm-missing
|
|
327
|
-
packages whose `name@version` is not on npm yet. Nx cache makes this cheap when the managed workflow already built
|
|
328
|
-
same projects, and it keeps reruns self-sufficient when repairing a previously selected `HEAD` release target.
|
|
451
|
+
- Before npm publish, smoo runs `nx run-many -t build --projects=<comma-separated npm-missing Nx projects>` for exactly
|
|
452
|
+
the packages whose `name@version` is not on npm yet. Nx cache makes this cheap when the managed workflow already built
|
|
453
|
+
the same projects, and it keeps reruns self-sufficient when repairing a previously selected `HEAD` release target.
|
|
329
454
|
- Publish uses `bun pm pack` to create package tarballs, then publishes those tarballs with latest npm CLI and
|
|
330
455
|
`--provenance`. Each package uses the npm dist-tag implied by its own version (`next` for prereleases, `latest` for
|
|
331
456
|
stable versions). Bun pack resolves internal `workspace:*` dependency ranges to real versions in the tarball manifest;
|
|
332
457
|
smoo fails before publish if a packed manifest still contains `workspace:` or if an internal dependency does not match
|
|
333
458
|
the current workspace package version.
|
|
334
|
-
- [npm CLI][npm] owns publish authentication.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
459
|
+
- [npm CLI][npm] owns publish authentication. Packages use [trusted publishing][npm-trusted-publishing] with [GitHub
|
|
460
|
+
Actions OIDC][github-actions-oidc] from the workflow's `id-token: write` permission. Package names must exist on npm
|
|
461
|
+
before CI publish runs; use `smoo release trust-publisher --bootstrap` locally to publish `0.0.0-bootstrap.0` under
|
|
462
|
+
the `bootstrap` dist-tag for new package names before configuring trust.
|
|
463
|
+
- `smoo release bootstrap-npm-packages` scans owned `npm:public` release packages missing from npm, runs
|
|
464
|
+
`npm login --auth-type=web` through `nix shell nixpkgs#nodejs_latest` unless `--skip-login` is passed, and publishes a
|
|
465
|
+
minimal placeholder package with `--access public --tag bootstrap`. It supports `--dry-run` and `--package <name...>`
|
|
466
|
+
for targeted bootstraps.
|
|
339
467
|
- `smoo release trust-publisher` configures [npm trusted publishing][npm-trusted-publishing] for every owned release
|
|
340
468
|
package. It uses the root `package.json` `repository.url` as the GitHub `owner/repo`, uses `publish.yml` as the
|
|
341
469
|
trusted workflow, and runs `npm trust` through `nix shell nixpkgs#nodejs_latest` because the Lambda-pinned Node 24/npm
|
|
342
|
-
toolchain may lag the npm CLI feature.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
470
|
+
toolchain may lag the npm CLI feature. It does not run a separate `npm login` before trust setup; `npm trust list` and
|
|
471
|
+
`npm trust github` own authentication so npm can offer the 5-minute trust/publish challenge bypass. Pass
|
|
472
|
+
`--package <name...>` to target specific owned packages. Pass `--bootstrap` to create missing npm package names first,
|
|
473
|
+
then configure trusted publishing in the same command. With `--bootstrap`, `--skip-login` only skips the placeholder
|
|
474
|
+
publish login. Existing matching trusted publishers are skipped via `npm trust list <package> --json`.
|
|
346
475
|
|
|
347
476
|
GitHub Releases:
|
|
348
477
|
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAKA,wBAAsB,MAAM,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAexE"}
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Command, CommanderError } from 'commander';
|
|
2
|
+
import { variants } from './generate/index.js';
|
|
3
|
+
import { cliPackageVersion } from './lib/cli-package.js';
|
|
2
4
|
import { findRepoRoot } from './lib/run.js';
|
|
3
5
|
export async function runCli(argv = process.argv.slice(2)) {
|
|
4
6
|
const program = buildProgram();
|
|
@@ -19,7 +21,12 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
19
21
|
}
|
|
20
22
|
function buildProgram() {
|
|
21
23
|
const program = new Command();
|
|
22
|
-
program
|
|
24
|
+
program
|
|
25
|
+
.name('smoo')
|
|
26
|
+
.description('SmoothBricks monorepo tooling')
|
|
27
|
+
.version(cliPackageVersion, '-v, --version', 'print smoo version')
|
|
28
|
+
.exitOverride()
|
|
29
|
+
.showHelpAfterError();
|
|
23
30
|
const monorepo = program.command('monorepo').description('Manage SmoothBricks-style monorepos');
|
|
24
31
|
monorepo
|
|
25
32
|
.command('init')
|
|
@@ -31,8 +38,10 @@ function buildProgram() {
|
|
|
31
38
|
});
|
|
32
39
|
monorepo
|
|
33
40
|
.command('validate')
|
|
41
|
+
.option('--fix', 'apply safe monorepo policy fixes before validation')
|
|
34
42
|
.option('--fail-fast', 'stop after the first failing validation pack')
|
|
35
43
|
.option('--only-if-new-workspace-package', 'skip validation unless a new workspace package manifest is staged')
|
|
44
|
+
.option('--verbose', 'print validation progress and successful checks')
|
|
36
45
|
.action(async (options) => {
|
|
37
46
|
const { validateMonorepo } = await import('./monorepo/index.js');
|
|
38
47
|
await validateMonorepo(await findRepoRoot(), options);
|
|
@@ -49,9 +58,12 @@ function buildProgram() {
|
|
|
49
58
|
const { diffManagedFiles } = await import('./monorepo/index.js');
|
|
50
59
|
diffManagedFiles(await findRepoRoot());
|
|
51
60
|
});
|
|
52
|
-
monorepo
|
|
61
|
+
monorepo
|
|
62
|
+
.command('validate-commit-msg <commitMsgFile>')
|
|
63
|
+
.option('--fix', 'format the commit message before validation')
|
|
64
|
+
.action(async (commitMsgFile, options) => {
|
|
53
65
|
const { validateCommitMessageFile } = await import('./monorepo/index.js');
|
|
54
|
-
validateCommitMessageFile(commitMsgFile);
|
|
66
|
+
validateCommitMessageFile(commitMsgFile, options, await findRepoRoot());
|
|
55
67
|
});
|
|
56
68
|
monorepo.command('sync-bun-lockfile-versions').action(async () => {
|
|
57
69
|
const { syncBunLockfileVersions } = await import('./monorepo/index.js');
|
|
@@ -60,10 +72,10 @@ function buildProgram() {
|
|
|
60
72
|
monorepo
|
|
61
73
|
.command('list-release-packages')
|
|
62
74
|
.option('--fail-empty', 'fail when no owned release packages are found')
|
|
63
|
-
.option('--github-output <path>', 'append projects=<
|
|
75
|
+
.option('--github-output <path>', 'append projects=<nx-projects> to a GitHub Actions output file')
|
|
64
76
|
.action(async (options) => {
|
|
65
|
-
const {
|
|
66
|
-
const packages =
|
|
77
|
+
const { listReleaseProjectNamesForNx } = await import('./monorepo/index.js');
|
|
78
|
+
const packages = listReleaseProjectNamesForNx(await findRepoRoot(), options);
|
|
67
79
|
if (!options.githubOutput) {
|
|
68
80
|
console.log(packages);
|
|
69
81
|
}
|
|
@@ -72,6 +84,33 @@ function buildProgram() {
|
|
|
72
84
|
const { validatePublicPackageTags } = await import('./monorepo/index.js');
|
|
73
85
|
validatePublicPackageTags(await findRepoRoot());
|
|
74
86
|
});
|
|
87
|
+
monorepo
|
|
88
|
+
.command('setup-test-tracing')
|
|
89
|
+
.description('Configure LMAO Bun test tracing for workspace packages')
|
|
90
|
+
.option('--all', 'configure every workspace package')
|
|
91
|
+
.option('--projects <projects>', 'comma-separated Nx project names, package names, or package roots')
|
|
92
|
+
.option('--op-context-export <exportName>', 'named op context export imported by test-suite-tracer', 'opContext')
|
|
93
|
+
.option('--tracer-module <module>', 'module specifier that exports defineTestTracer', '@smoothbricks/lmao/testing/bun')
|
|
94
|
+
.option('--dry-run', 'print generator invocations without writing files')
|
|
95
|
+
.action(async (options) => {
|
|
96
|
+
const { setupTestTracing } = await import('./monorepo/index.js');
|
|
97
|
+
await setupTestTracing(await findRepoRoot(), options);
|
|
98
|
+
});
|
|
99
|
+
// `smoo g` / `smoo generate` — subcommands are driven by the variant
|
|
100
|
+
// registry in src/generate/index.ts. To add a new variant, add an entry
|
|
101
|
+
// there; the CLI wiring below picks it up automatically.
|
|
102
|
+
const g = program.command('g').alias('generate').description('Scaffold workspace packages and components');
|
|
103
|
+
for (const [variantName, variant] of Object.entries(variants)) {
|
|
104
|
+
const sub = g.command(`${variantName} <name>`).description(variant.description);
|
|
105
|
+
for (const opt of variant.options ?? []) {
|
|
106
|
+
sub.option(opt.flag, opt.description);
|
|
107
|
+
}
|
|
108
|
+
sub.option('--dry-run', 'preview changes without writing');
|
|
109
|
+
sub.action(async (name, options) => {
|
|
110
|
+
const { generate } = await import('./generate/index.js');
|
|
111
|
+
await generate(await findRepoRoot(), variantName, name, options);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
75
114
|
const release = program.command('release').description('Version, publish, and create GitHub Releases');
|
|
76
115
|
release.command('npm-status').action(async () => {
|
|
77
116
|
const { printReleaseState } = await import('./release/index.js');
|
|
@@ -89,7 +128,7 @@ function buildProgram() {
|
|
|
89
128
|
.command('version')
|
|
90
129
|
.option('--bump <bump>', 'auto, patch, minor, major, or prerelease', 'auto')
|
|
91
130
|
.option('--dry-run [dryRun]', 'run without writing versions or tags')
|
|
92
|
-
.option('--github-output <path>', 'append mode=<mode> and projects=<
|
|
131
|
+
.option('--github-output <path>', 'append mode=<mode> and projects=<nx-projects> to a GitHub Actions output file')
|
|
93
132
|
.action(async (options) => {
|
|
94
133
|
const { releaseVersion } = await import('./release/index.js');
|
|
95
134
|
await releaseVersion(await findRepoRoot(), {
|
|
@@ -128,20 +167,81 @@ function buildProgram() {
|
|
|
128
167
|
dryRun: booleanOption(options.dryRun),
|
|
129
168
|
});
|
|
130
169
|
});
|
|
170
|
+
release
|
|
171
|
+
.command('bootstrap-npm-packages')
|
|
172
|
+
.alias('bootstrap')
|
|
173
|
+
.description('Publish minimal npm placeholder packages so trusted publishing can be configured')
|
|
174
|
+
.option('--dry-run [dryRun]', 'show placeholder publishes without logging in or publishing')
|
|
175
|
+
.option('--skip-login', 'skip npm browser login before publishing placeholders')
|
|
176
|
+
.option('--otp <otp>', 'npm one-time password for placeholder publish operations')
|
|
177
|
+
.option('--package <name...>', 'only bootstrap the selected owned release package names')
|
|
178
|
+
.action(async (options) => {
|
|
179
|
+
const { releaseBootstrapNpmPackages } = await import('./release/index.js');
|
|
180
|
+
await releaseBootstrapNpmPackages(await findRepoRoot(), {
|
|
181
|
+
dryRun: booleanOption(options.dryRun),
|
|
182
|
+
skipLogin: options.skipLogin === true,
|
|
183
|
+
otp: options.otp,
|
|
184
|
+
packages: options.package ?? [],
|
|
185
|
+
});
|
|
186
|
+
});
|
|
131
187
|
release
|
|
132
188
|
.command('trust-publisher')
|
|
133
189
|
.description('Configure npm trusted publishing for owned release packages')
|
|
134
190
|
.option('--dry-run [dryRun]', 'show npm trust changes without saving them')
|
|
135
|
-
.option('--
|
|
136
|
-
.option('--
|
|
191
|
+
.option('--bootstrap', 'publish missing npm placeholder packages before configuring trust')
|
|
192
|
+
.option('--bootstrap-otp <otp>', 'npm one-time password for placeholder publishes during --bootstrap')
|
|
193
|
+
.option('--skip-login', 'skip npm browser login before publishing placeholders during --bootstrap')
|
|
194
|
+
.option('--package <name...>', 'only configure the selected owned release package names')
|
|
137
195
|
.action(async (options) => {
|
|
138
196
|
const { releaseTrustPublisher } = await import('./release/index.js');
|
|
139
197
|
await releaseTrustPublisher(await findRepoRoot(), {
|
|
140
198
|
dryRun: booleanOption(options.dryRun),
|
|
141
|
-
|
|
199
|
+
bootstrap: options.bootstrap === true,
|
|
200
|
+
bootstrapOtp: options.bootstrapOtp,
|
|
142
201
|
skipLogin: options.skipLogin === true,
|
|
202
|
+
packages: options.package ?? [],
|
|
143
203
|
});
|
|
144
204
|
});
|
|
205
|
+
const devenv = program.command('devenv').description('Manage the repository devenv shell');
|
|
206
|
+
devenv.command('update').action(async () => {
|
|
207
|
+
const { updateDevenv } = await import('./devenv/index.js');
|
|
208
|
+
await updateDevenv(await findRepoRoot());
|
|
209
|
+
});
|
|
210
|
+
devenv.command('reload').action(async () => {
|
|
211
|
+
const { reloadDevenv } = await import('./devenv/index.js');
|
|
212
|
+
await reloadDevenv(await findRepoRoot());
|
|
213
|
+
});
|
|
214
|
+
const nixpkgsOverlay = program.command('nixpkgs-overlay').description('Manage the repository nixpkgs overlay');
|
|
215
|
+
nixpkgsOverlay.command('update').action(async () => {
|
|
216
|
+
const { updateNixpkgsOverlay } = await import('./devenv/index.js');
|
|
217
|
+
await updateNixpkgsOverlay(await findRepoRoot());
|
|
218
|
+
});
|
|
219
|
+
const nx = program.command('nx').description('Nx workspace helpers');
|
|
220
|
+
nx.command('list-targets')
|
|
221
|
+
.description('List project:target entries for every Nx project')
|
|
222
|
+
.action(async () => {
|
|
223
|
+
const { listTargets } = await import('./nx/index.js');
|
|
224
|
+
await listTargets(await findRepoRoot());
|
|
225
|
+
});
|
|
226
|
+
nx.command('list-projects')
|
|
227
|
+
.description('List Nx projects matching filters')
|
|
228
|
+
.requiredOption('--with-target <target>', 'only include projects defining this target')
|
|
229
|
+
.action(async (options) => {
|
|
230
|
+
const { listProjects } = await import('./nx/index.js');
|
|
231
|
+
await listProjects(await findRepoRoot(), options);
|
|
232
|
+
});
|
|
233
|
+
nx.command('reset-cache')
|
|
234
|
+
.description('Run nx reset to clear Nx daemon and cache state')
|
|
235
|
+
.action(async () => {
|
|
236
|
+
const { resetCache } = await import('./nx/index.js');
|
|
237
|
+
await resetCache(await findRepoRoot());
|
|
238
|
+
});
|
|
239
|
+
nx.command('clean-cache')
|
|
240
|
+
.description('Remove local Nx cache directories when present')
|
|
241
|
+
.action(async () => {
|
|
242
|
+
const { cleanCache } = await import('./nx/index.js');
|
|
243
|
+
await cleanCache(await findRepoRoot());
|
|
244
|
+
});
|
|
145
245
|
const githubCi = program.command('github-ci').description('GitHub Actions helpers');
|
|
146
246
|
githubCi.command('cleanup-cache').action(async () => {
|
|
147
247
|
const { cleanupGithubCiCache } = await import('./github-ci/index.js');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface DevenvCommandShell {
|
|
2
|
+
run(command: string, args: string[], cwd: string): Promise<void>;
|
|
3
|
+
remove(path: string): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function updateDevenv(root: string, shell?: DevenvCommandShell): Promise<void>;
|
|
6
|
+
export declare function reloadDevenv(root: string, shell?: DevenvCommandShell): Promise<void>;
|
|
7
|
+
export declare function updateNixpkgsOverlay(root: string, shell?: DevenvCommandShell): Promise<void>;
|
|
8
|
+
export declare function direnvRoot(root: string): string;
|
|
9
|
+
export declare function nixpkgsOverlayRoot(root: string): string;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devenv/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AASD,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,kBAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CAExG;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,kBAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CAKxG;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,kBAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhH;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { rm } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { run } from '../lib/run.js';
|
|
4
|
+
const defaultShell = {
|
|
5
|
+
run,
|
|
6
|
+
async remove(path) {
|
|
7
|
+
await rm(path, { recursive: true, force: true });
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export async function updateDevenv(root, shell = defaultShell) {
|
|
11
|
+
await shell.run('devenv', ['update'], direnvRoot(root));
|
|
12
|
+
}
|
|
13
|
+
export async function reloadDevenv(root, shell = defaultShell) {
|
|
14
|
+
const cwd = direnvRoot(root);
|
|
15
|
+
await shell.remove(join(cwd, '.direnv'));
|
|
16
|
+
await shell.remove(join(cwd, '.devenv'));
|
|
17
|
+
await shell.run('direnv', ['reload'], cwd);
|
|
18
|
+
}
|
|
19
|
+
export async function updateNixpkgsOverlay(root, shell = defaultShell) {
|
|
20
|
+
await shell.run('nix', ['shell', 'nixpkgs#nvfetcher', '-c', 'nvfetcher', '-o', '_sources'], nixpkgsOverlayRoot(root));
|
|
21
|
+
}
|
|
22
|
+
export function direnvRoot(root) {
|
|
23
|
+
return join(root, 'tooling', 'direnv');
|
|
24
|
+
}
|
|
25
|
+
export function nixpkgsOverlayRoot(root) {
|
|
26
|
+
return join(direnvRoot(root), 'nixpkgs-overlay');
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface GenerateVariant {
|
|
2
|
+
/** Nx generator name inside @smoothbricks/nx-plugin (e.g. 'create-package'). */
|
|
3
|
+
generator: string;
|
|
4
|
+
/** One-line description shown in `smoo g --help`. */
|
|
5
|
+
description: string;
|
|
6
|
+
/** Build the generator-specific args from the positional <name>. */
|
|
7
|
+
args: (name: string) => string[];
|
|
8
|
+
/** Extra CLI flags beyond the universal --dry-run. */
|
|
9
|
+
options?: readonly VariantOption[];
|
|
10
|
+
}
|
|
11
|
+
interface VariantOption {
|
|
12
|
+
/** Commander flag syntax (e.g. '--public'). */
|
|
13
|
+
flag: string;
|
|
14
|
+
/** Help text for this flag. */
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const variants: Record<string, GenerateVariant>;
|
|
18
|
+
export declare function generate(root: string, variantName: string, name: string, options: Record<string, unknown>): Promise<void>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IACjC,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CACpC;AAED,UAAU,aAAa;IACrB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAkBpD,CAAC;AAMF,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|