@smoothbricks/cli 0.11.18 → 0.11.20
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 +91 -11
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +28 -4
- package/dist/github-ci/index.d.ts.map +1 -1
- package/dist/github-ci/index.js +6 -20
- package/dist/lib/deploy-tags.d.ts +17 -3
- package/dist/lib/deploy-tags.d.ts.map +1 -1
- package/dist/lib/deploy-tags.js +23 -4
- package/dist/lib/json.d.ts +22 -1
- package/dist/lib/json.d.ts.map +1 -1
- package/dist/lib/json.js +15 -3
- package/dist/monorepo/cargo-policy.d.ts +17 -0
- package/dist/monorepo/cargo-policy.d.ts.map +1 -1
- package/dist/monorepo/cargo-policy.js +73 -1
- package/dist/monorepo/index.d.ts.map +1 -1
- package/dist/monorepo/index.js +4 -2
- package/dist/monorepo/managed-files.d.ts +5 -2
- package/dist/monorepo/managed-files.d.ts.map +1 -1
- package/dist/monorepo/managed-files.js +35 -21
- package/dist/monorepo/packs/index.d.ts.map +1 -1
- package/dist/monorepo/packs/index.js +6 -1
- package/dist/nx/index.d.ts +6 -0
- package/dist/nx/index.d.ts.map +1 -1
- package/dist/nx/index.js +14 -0
- package/dist/secrets/commands.d.ts +9 -5
- package/dist/secrets/commands.d.ts.map +1 -1
- package/dist/secrets/commands.js +122 -49
- package/dist/secrets/index.d.ts +42 -56
- package/dist/secrets/index.d.ts.map +1 -1
- package/dist/secrets/index.js +52 -79
- package/dist/secrets/resolver.d.ts +59 -0
- package/dist/secrets/resolver.d.ts.map +1 -0
- package/dist/secrets/resolver.js +100 -0
- package/dist/secrets/run.d.ts +23 -0
- package/dist/secrets/run.d.ts.map +1 -0
- package/dist/secrets/run.js +130 -0
- package/dist/secrets/status.d.ts +177 -0
- package/dist/secrets/status.d.ts.map +1 -0
- package/dist/secrets/status.js +724 -0
- package/dist/wrangler/deploy-stage.d.ts +1 -1
- package/dist/wrangler/deploy-stage.d.ts.map +1 -1
- package/dist/wrangler/deploy-stage.js +22 -20
- package/dist/wrangler/deployed-version.d.ts.map +1 -1
- package/dist/wrangler/deployed-version.js +7 -12
- package/dist/wrangler/flat-config.d.ts +1 -4
- package/dist/wrangler/flat-config.d.ts.map +1 -1
- package/dist/wrangler/flat-config.js +98 -44
- package/dist/wrangler/prepare-env.d.ts +4 -3
- package/dist/wrangler/prepare-env.d.ts.map +1 -1
- package/dist/wrangler/prepare-env.js +7 -5
- package/dist/wrangler/source-config.d.ts +24 -0
- package/dist/wrangler/source-config.d.ts.map +1 -0
- package/dist/wrangler/source-config.js +110 -0
- package/dist/wrangler/stage.d.ts +55 -23
- package/dist/wrangler/stage.d.ts.map +1 -1
- package/dist/wrangler/stage.js +81 -162
- package/managed/raw/tooling/direnv/devenv.smoo.nix +19 -3
- package/managed/raw/tooling/direnv/secret-references.ts +280 -76
- package/managed/raw/tooling/direnv/setup-environment.ts +58 -2
- package/managed/raw/tsconfig.lib.json +28 -0
- package/package.json +7 -2
- package/src/cli.ts +34 -5
- package/src/github-ci/index.test.ts +6 -7
- package/src/github-ci/index.ts +11 -19
- package/src/lib/deploy-tags.ts +22 -4
- package/src/lib/json.ts +23 -1
- package/src/monorepo/cargo-policy.test.ts +91 -1
- package/src/monorepo/cargo-policy.ts +87 -1
- package/src/monorepo/index.ts +8 -2
- package/src/monorepo/managed-files.test.ts +69 -37
- package/src/monorepo/managed-files.ts +38 -21
- package/src/monorepo/packs/index.ts +10 -1
- package/src/monorepo/secret-references.test.ts +412 -6
- package/src/monorepo/setup-environment.test.ts +181 -0
- package/src/nx/index.test.ts +8 -0
- package/src/nx/index.ts +20 -0
- package/src/secrets/commands.test.ts +186 -4
- package/src/secrets/commands.ts +142 -51
- package/src/secrets/index.test.ts +4 -10
- package/src/secrets/index.ts +54 -115
- package/src/secrets/resolver.ts +130 -0
- package/src/secrets/run.test.ts +359 -0
- package/src/secrets/run.ts +148 -0
- package/src/secrets/status.test.ts +164 -0
- package/src/secrets/status.ts +297 -0
- package/src/wrangler/deploy-stage.test.ts +95 -2
- package/src/wrangler/deploy-stage.ts +26 -23
- package/src/wrangler/deployed-version.ts +7 -11
- package/src/wrangler/flat-config.test.ts +9 -4
- package/src/wrangler/flat-config.ts +1 -20
- package/src/wrangler/format-parity.test.ts +433 -0
- package/src/wrangler/prepare-env.ts +7 -5
- package/src/wrangler/source-config.test.ts +102 -0
- package/src/wrangler/source-config.ts +110 -0
- package/src/wrangler/stage.test.ts +61 -32
- package/src/wrangler/stage.ts +124 -173
package/README.md
CHANGED
|
@@ -47,6 +47,11 @@ smoo release retag-unpublished <tag...> [--to <ref>] [--push] [--dispatch] [--re
|
|
|
47
47
|
smoo release bootstrap-npm-packages [--dry-run] [--skip-login] [--package <name...>]
|
|
48
48
|
smoo release trust-publisher [--bootstrap] [--dry-run] [--skip-login] [--package <name...>]
|
|
49
49
|
|
|
50
|
+
smoo secrets status [-R <owner/name|remote>] [--env <environment>] [--json]
|
|
51
|
+
smoo secrets set [name] [-R <owner/name|remote>] [--env <environment>]
|
|
52
|
+
smoo secrets sync [-R <owner/name|remote>] [--env <environment>]
|
|
53
|
+
smoo secrets run <group> <command...>
|
|
54
|
+
|
|
50
55
|
smoo github-ci nx-smart --target <target> [--name <check-name>] [--step <number>] [--mode <auto|affected|run-many>] [--stage <stage>]
|
|
51
56
|
smoo github-ci nx-run-many --targets <targets> [--projects <projects>] [--collect-outputs <directory>]
|
|
52
57
|
smoo github-ci nx-deploy [--stage <stage>] [--mode <auto|affected|run-many>] [--select-tag <tag>] [--verify]
|
|
@@ -430,11 +435,28 @@ access makes cleanup refuse before it deletes anything rather than half-clean a
|
|
|
430
435
|
A wrong value type anywhere in `smoo.github` fails `smoo monorepo update` and `smoo github-ci nx-deploy` with the
|
|
431
436
|
offending path, rather than silently falling back to the defaults.
|
|
432
437
|
|
|
438
|
+
#### What CI deploys: the deploy tags
|
|
439
|
+
|
|
440
|
+
A `deploy` target says a project CAN be deployed. Four Nx tags say whether CI does, and they are the only thing that
|
|
441
|
+
says so: the generated workflows and `smoo github-ci nx-deploy` read one rule, so a repository cannot render a deploy
|
|
442
|
+
job that deploys nothing, nor deploy a project no job announced.
|
|
443
|
+
|
|
444
|
+
- `stage-deploy-target`: deployed on every stage — pull-request previews, staging, and production.
|
|
445
|
+
- `staging-deploy-target`: deployed on staging only, for infrastructure the pull-request stages share.
|
|
446
|
+
- `permanent-deploy-target`: excluded from every stage deploy; deployed outside the stage flow.
|
|
447
|
+
- `production-push-deploy-target`: also deployed by the generated production-on-push job (below).
|
|
448
|
+
|
|
449
|
+
An untagged `deploy` target is deployable by hand — `nx run <project>:deploy --stage=pr42` — and invisible to CI. A
|
|
450
|
+
repository where no project carries one of these tags gets no deploy step, no `deployments: write` permission, no
|
|
451
|
+
Cloudflare credentials and no `pr-preview-cleanup.yml`, however many wrangler manifests its packages hold: a published
|
|
452
|
+
library ships one to document a Durable Object binding for its consumers, and that manifest looks exactly like a
|
|
453
|
+
deployable worker's.
|
|
454
|
+
|
|
433
455
|
Tag a project `production-push-deploy-target` to have it deployed to production by a generated `deploy-production` job
|
|
434
456
|
that runs after Validate and the e2e job succeed on a push to the staging push branch
|
|
435
|
-
(`smoo github-ci nx-deploy --stage production --select-tag production-push-deploy-target`). The project must also
|
|
436
|
-
|
|
437
|
-
|
|
457
|
+
(`smoo github-ci nx-deploy --stage production --select-tag production-push-deploy-target`). The project must also carry
|
|
458
|
+
`stage-deploy-target`, otherwise `--select-tag` finds nothing and the job logs
|
|
459
|
+
`No run-many deploy projects; skipping production.`
|
|
438
460
|
|
|
439
461
|
#### Ordering one deploy after another
|
|
440
462
|
|
|
@@ -452,9 +474,9 @@ drop.
|
|
|
452
474
|
|
|
453
475
|
What makes the edge safe is that a deploy is never cached and always cheap when there is nothing to do:
|
|
454
476
|
|
|
455
|
-
- `@smoothbricks/nx-plugin` gives
|
|
456
|
-
|
|
457
|
-
|
|
477
|
+
- `@smoothbricks/nx-plugin` gives the `deploy` it infers `cache: false`. An Nx cache hit on a deploy means "we once
|
|
478
|
+
uploaded this hash", which a rollback silently falsifies — the workspace is unchanged, so the hash is unchanged, so a
|
|
479
|
+
cached deploy would report success while the previous version keeps serving.
|
|
458
480
|
- `smoo wrangler deploy-stage` reads live state first. If the version tagged with this task's hash is already the one
|
|
459
481
|
serving 100% of traffic, it returns `remote-cache-hit` after two API calls: no upload, no migration, no traffic shift.
|
|
460
482
|
- The expensive, purely file-derived half belongs in a sibling `deploy-build` target (build the artifact, register it,
|
|
@@ -560,10 +582,58 @@ Developer shells get the pair from the managed `tooling/direnv/secret-references
|
|
|
560
582
|
none (with the reason on stderr), and never replaces a server the environment already carries, so a CI job keeps the
|
|
561
583
|
internal address its own runners reach.
|
|
562
584
|
|
|
563
|
-
`tokenSecret` may name a `smoo.secrets` entry, and then it is
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
585
|
+
`tokenSecret` may name a `smoo.secrets` entry, and then it is in group `nx-cache`: shell entry never resolves it, so an
|
|
586
|
+
unreachable secret provider loses the cache rather than the install. `op read` being unavailable in a sandboxed
|
|
587
|
+
workspace therefore costs the cache, not the shell. See the section below for what a group is.
|
|
588
|
+
|
|
589
|
+
### Local secret commands and groups (`package.json` → `smoo.secrets`)
|
|
590
|
+
|
|
591
|
+
```json
|
|
592
|
+
{
|
|
593
|
+
"smoo": {
|
|
594
|
+
"secrets": {
|
|
595
|
+
"SMOO_TOKEN": { "command": ["op", "read", "op://vault/smoo/token"] },
|
|
596
|
+
"ACME_NPM_TOKEN": { "command": ["op", "read", "op://vault/registry/token"] },
|
|
597
|
+
"DEPLOY_TOKEN": { "command": ["op", "read", "op://vault/deploy/token"], "group": "deploy" }
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
Each entry names a command whose stdout is the value. An existing nonempty environment value always wins, and CI never
|
|
604
|
+
runs these commands at all: there, every variable comes from the job's secret store.
|
|
605
|
+
|
|
606
|
+
A group says which operation resolves the credential, and shell entry — every direnv reload, every
|
|
607
|
+
`devenv shell -- <command>` — resolves the `shell` group and nothing else. A provider authorises per requesting process
|
|
608
|
+
lineage, so a command placed at shell entry is a credential prompt on every reload; a credential only one deliberate
|
|
609
|
+
command needs belongs to that command:
|
|
610
|
+
|
|
611
|
+
```bash
|
|
612
|
+
smoo secrets run registry bun install
|
|
613
|
+
smoo secrets run registry bun add -d @acme/sdk
|
|
614
|
+
smoo secrets run nx-cache nx build app
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
The group is DERIVED from declarations the repository already carries, so almost nothing declares one:
|
|
618
|
+
|
|
619
|
+
- `registry` — a variable `.npmrc` interpolates as `${VAR}`. An installed checkout contacts no registry, so shell entry
|
|
620
|
+
defers it; a request that does contact one is what resolves it.
|
|
621
|
+
- `nx-cache` — the variable `smoo.remoteCache.tokenSecret` names.
|
|
622
|
+
- `shell` — everything else, resolved at shell entry because that is when it is needed.
|
|
623
|
+
|
|
624
|
+
`group` on an entry overrides the derivation, and any label the command line can name is a group: nothing about
|
|
625
|
+
`registry` or `nx-cache` is privileged in smoo, so a repository may declare `deploy` and run it the same way. An
|
|
626
|
+
override is stated in `smoo secrets status`, because a silent one is how the next reader loses an hour.
|
|
627
|
+
|
|
628
|
+
`smoo secrets run` with no group refuses and lists the groups this repository declares with the secrets in each. It
|
|
629
|
+
resolves exactly one group — a run for `registry` never triggers the cache token's provider command — and passes the
|
|
630
|
+
values in the child's environment only: never in argv, which `ps` shows to every user on the machine, never in a file,
|
|
631
|
+
and never on stdout. Everything after the group reaches the child verbatim, flags included, and the child's exit status
|
|
632
|
+
is reproduced, including death by signal as 128+signum.
|
|
633
|
+
|
|
634
|
+
Both contexts that cannot run a provider command refuse by name instead of promising a command that would not work
|
|
635
|
+
there: CI says to inject the variable from the secret store, and a cowshed workspace says to enroll registry credentials
|
|
636
|
+
through the gateway.
|
|
567
637
|
|
|
568
638
|
## Releases
|
|
569
639
|
|
|
@@ -712,7 +782,17 @@ Publish runs converge without self-spawning another workflow run.
|
|
|
712
782
|
|
|
713
783
|
### `smoo wrangler deploy-stage --stage <stage> [--config <path>]`
|
|
714
784
|
|
|
715
|
-
Without `--config`, deploys
|
|
785
|
+
Without `--config`, deploys the project's own source configuration with `--env <stage>`; a `prN` stage is derived from
|
|
786
|
+
`[env.staging]`. The source configuration is discovered in wrangler's own precedence — `wrangler.jsonc`,
|
|
787
|
+
`wrangler.json`, `wrangler.toml` — and the two JSON spellings are read with the JSONC parser wrangler uses for them, so
|
|
788
|
+
comments and trailing commas are fine. A project carrying more than one of those files is refused by name: wrangler
|
|
789
|
+
would read the first and ignore the rest without saying so, and that is how a repo ends up deploying a config nobody is
|
|
790
|
+
editing.
|
|
791
|
+
|
|
792
|
+
Both formats parse into one model, so a stage derives identically from either: the same plan, the same resources, the
|
|
793
|
+
same refusals. The committed file is never rewritten. A `prN` stage's derived configuration is written beside it as a
|
|
794
|
+
temporary `.wrangler.smoo-*.json` that the deploy deletes afterwards — JSON whichever format the source was, because
|
|
795
|
+
wrangler selects its parser by extension and a file read once by a machine has no reader for comments.
|
|
716
796
|
|
|
717
797
|
With `--config <path>` the target is a build-generated, env-block-free `wrangler.json` (what the Cloudflare Vite and
|
|
718
798
|
Astro adapters emit). `staging` and `production` deploy it as-is, with no `--env` flag. A `prN` stage treats it as the
|
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":"AAcA,wBAAsB,MAAM,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcxE;AAQD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAiBhD"}
|
package/dist/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ import { decode, findRepoRoot, printCommandOutput } from './lib/run.js';
|
|
|
7
7
|
import { ensureChromium } from './playwright/index.js';
|
|
8
8
|
import { resolvePrConflicts } from './pr/index.js';
|
|
9
9
|
import { secretsSet, secretsStatus, secretsSync } from './secrets/commands.js';
|
|
10
|
+
import { secretsRun } from './secrets/run.js';
|
|
10
11
|
import { cleanupPullRequest, deployStage } from './wrangler/deploy-stage.js';
|
|
11
12
|
import { deployedVersion } from './wrangler/deployed-version.js';
|
|
12
13
|
import { scaffold } from './wrangler/scaffold.js';
|
|
@@ -70,6 +71,11 @@ function buildProgram() {
|
|
|
70
71
|
.description('SmoothBricks monorepo tooling')
|
|
71
72
|
.version(cliPackageVersion, '-v, --version', 'print smoo version')
|
|
72
73
|
.exitOverride()
|
|
74
|
+
// `smoo secrets run <group> <command...>` hands the rest of argv to a
|
|
75
|
+
// child verbatim, flags included. Commander only stops parsing after the
|
|
76
|
+
// first operand when positional options are enabled here, on the parent
|
|
77
|
+
// of the command that declares `passThroughOptions`.
|
|
78
|
+
.enablePositionalOptions()
|
|
73
79
|
.showHelpAfterError();
|
|
74
80
|
const monorepo = program.command('monorepo').description('Manage SmoothBricks-style monorepos');
|
|
75
81
|
monorepo
|
|
@@ -424,14 +430,32 @@ function buildProgram() {
|
|
|
424
430
|
});
|
|
425
431
|
const secrets = program
|
|
426
432
|
.command('secrets')
|
|
427
|
-
.description('Reconcile declared secrets: what Workers need, what workflows pass, what the repository holds')
|
|
433
|
+
.description('Reconcile declared secrets: what Workers need, what workflows pass, what the repository holds')
|
|
434
|
+
.enablePositionalOptions();
|
|
435
|
+
secrets
|
|
436
|
+
.command('run [group] [command...]')
|
|
437
|
+
.description('Run one command with one group of declared secrets in its environment. Shell entry resolves the ' +
|
|
438
|
+
'`shell` group only, so a registry credential or the Nx cache token is resolved here, by the command ' +
|
|
439
|
+
'that needs it, instead of by every direnv reload. The group is required and positional: with none, ' +
|
|
440
|
+
'this lists the groups this repository declares and the secrets in each')
|
|
441
|
+
// Everything after the group reaches the child verbatim, flags included:
|
|
442
|
+
// `smoo secrets run registry bun add -d @acme/x` must run `bun add -d
|
|
443
|
+
// @acme/x`, not lose `-d` to this command's own parser.
|
|
444
|
+
.passThroughOptions()
|
|
445
|
+
.action(async (group, command) => {
|
|
446
|
+
process.exitCode = await secretsRun(await findRepoRoot(), group, command);
|
|
447
|
+
});
|
|
428
448
|
secrets
|
|
429
449
|
.command('status')
|
|
430
|
-
.description('Show every declared secret with the scopes holding it
|
|
450
|
+
.description('Show every declared secret with the scopes holding it. Exits 0 when every secret a managed workflow ' +
|
|
451
|
+
'passes has a value in a scope the job reads, and 1 when one does not or when the repository, its ' +
|
|
452
|
+
'secrets or a stage declaration could not be read')
|
|
431
453
|
.option('-R, --repo <owner/name|remote>', "repository or remote name; defaults to the current branch's upstream remote")
|
|
432
454
|
.option('--env <environment>', "also read this GitHub Environment; its value takes precedence over the repository's for a job bound to it")
|
|
455
|
+
.option('--json', 'write one JSON document to stdout instead of the table, for another tool to read; the exit code is ' +
|
|
456
|
+
'unchanged, so a status that refuses still refuses')
|
|
433
457
|
.action(async (options) => {
|
|
434
|
-
process.exitCode = secretsStatus(await findRepoRoot(), options);
|
|
458
|
+
process.exitCode = await secretsStatus(await findRepoRoot(), options);
|
|
435
459
|
});
|
|
436
460
|
secrets
|
|
437
461
|
.command('set [name]')
|
|
@@ -460,7 +484,7 @@ function buildProgram() {
|
|
|
460
484
|
wrangler
|
|
461
485
|
.command('deploy-stage')
|
|
462
486
|
.requiredOption('--stage <stage>', 'staging, production, or prN')
|
|
463
|
-
.option('--config <path>',
|
|
487
|
+
.option('--config <path>', "deploy a build-generated flat wrangler.json instead of the project's own config")
|
|
464
488
|
.option('--version-endpoint <url>', 'URL served by this worker whose trimmed body is the running version tag')
|
|
465
489
|
.action(async (options) => {
|
|
466
490
|
await deployStage(process.cwd(), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/github-ci/index.ts"],"names":[],"mappings":"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E,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAClF;AAED,qBAAa,0BAA2B,YAAW,sBAAsB;IACvE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqB/E;CACF;AAED,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,KAAK,MAAM,EAAE,EAC1B,GAAG,EAAE,MAAM,EACX,kBAAkB,EAAE,MAAM,CAAC,UAAU,EACrC,MAAM,GAAE,sBAAyD,GAChE,OAAO,CAAC,IAAI,CAAC,CAyEf;AAwDD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,CAAC,UAAU,EAC9B,KAAK,EAAE,yBAAyB,GAAG,SAAS,GAC3C,OAAO,CAUT"}
|
package/dist/github-ci/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { appendFile } from 'node:fs/promises';
|
|
|
4
4
|
import { PLATFORM_TARGET_GLOBS } from '@smoothbricks/nx-plugin/workspace-config-policy';
|
|
5
5
|
import { $ } from 'bun';
|
|
6
6
|
import typia from 'typia';
|
|
7
|
-
import {
|
|
7
|
+
import { PERMANENT_DEPLOY_TAG, STAGING_DEPLOY_TAG, stageDeploysProject } from '../lib/deploy-tags.js';
|
|
8
8
|
import { ciPushBranches, isNonEmpty, parseStringArrayText, readSmooGithub, } from '../lib/json.js';
|
|
9
9
|
import { decode, printCommandOutput, run, runStatus, runText } from '../lib/run.js';
|
|
10
10
|
import { readProjectTargets } from '../nx/index.js';
|
|
@@ -25,19 +25,11 @@ const isGithubDeployment = (() => {
|
|
|
25
25
|
return input => "object" === typeof input && null !== input && _io0(input);
|
|
26
26
|
})();
|
|
27
27
|
const isNxProjectDeployTarget = (() => {
|
|
28
|
-
const
|
|
29
|
-
const _io0 = input => true && (undefined === input.targets || "object" === typeof input.targets && null !== input.targets && false === Array.isArray(input.targets) && _io1(input.targets));
|
|
30
|
-
const _io1 = input => undefined === input.deploy || "object" === typeof input.deploy && null !== input.deploy && false === Array.isArray(input.deploy) && _io2(input.deploy);
|
|
31
|
-
const _io2 = input => _ip0(input) && (undefined === input.options || "object" === typeof input.options && null !== input.options && false === Array.isArray(input.options) && _io3(input.options));
|
|
32
|
-
const _io3 = input => _ip0(input);
|
|
28
|
+
const _io0 = input => undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem);
|
|
33
29
|
return input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
34
30
|
})();
|
|
35
31
|
const parseNxProjectDeployTarget = (() => {
|
|
36
|
-
const
|
|
37
|
-
const _io0 = input => true && (undefined === input.targets || "object" === typeof input.targets && null !== input.targets && false === Array.isArray(input.targets) && _io1(input.targets));
|
|
38
|
-
const _io1 = input => undefined === input.deploy || "object" === typeof input.deploy && null !== input.deploy && false === Array.isArray(input.deploy) && _io2(input.deploy);
|
|
39
|
-
const _io2 = input => _ip0(input) && (undefined === input.options || "object" === typeof input.options && null !== input.options && false === Array.isArray(input.options) && _io3(input.options));
|
|
40
|
-
const _io3 = input => _ip0(input);
|
|
32
|
+
const _io0 = input => undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem);
|
|
41
33
|
const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
42
34
|
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
43
35
|
})();
|
|
@@ -434,17 +426,11 @@ export async function selectStageDeployProjects(candidates, stage, requireTag, l
|
|
|
434
426
|
const definition = await loadProject(project);
|
|
435
427
|
if (!isNxProjectDeployTarget(definition))
|
|
436
428
|
continue;
|
|
437
|
-
const
|
|
438
|
-
const commandValue = deploy?.options?.command ?? deploy?.command;
|
|
439
|
-
const tags = Array.isArray(definition.tags)
|
|
440
|
-
? definition.tags.filter((tag) => typeof tag === 'string')
|
|
441
|
-
: [];
|
|
442
|
-
const isStageDerived = isStageDerivedDeploy(tags, typeof commandValue === 'string' ? commandValue : undefined);
|
|
443
|
-
const isStagingOnly = tags.includes(STAGING_DEPLOY_TAG);
|
|
429
|
+
const tags = definition.tags;
|
|
444
430
|
// A required tag narrows the stage rules; it never selects a project they exclude.
|
|
445
|
-
if (requireTag && !tags
|
|
431
|
+
if (requireTag && !tags?.includes(requireTag))
|
|
446
432
|
continue;
|
|
447
|
-
if (
|
|
433
|
+
if (stageDeploysProject(tags, stage)) {
|
|
448
434
|
selected.push(project);
|
|
449
435
|
}
|
|
450
436
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DeploymentStage } from '../wrangler/stage.js';
|
|
1
2
|
/** Deployed on staging only: infrastructure the pull-request stages share. */
|
|
2
3
|
export declare const STAGING_DEPLOY_TAG = "staging-deploy-target";
|
|
3
4
|
/** Excluded from every stage deploy; deployed outside the stage flow. */
|
|
@@ -5,8 +6,21 @@ export declare const PERMANENT_DEPLOY_TAG = "permanent-deploy-target";
|
|
|
5
6
|
/** Opts a project into the generated production-on-push deploy job. */
|
|
6
7
|
export declare const PRODUCTION_PUSH_DEPLOY_TAG = "production-push-deploy-target";
|
|
7
8
|
/**
|
|
8
|
-
* Whether
|
|
9
|
-
*
|
|
9
|
+
* Whether the stage flow deploys a project, from its TAGS alone — the one rule
|
|
10
|
+
* CI selection and workflow generation both read, so a generated deploy job and
|
|
11
|
+
* the projects that job deploys cannot disagree.
|
|
12
|
+
*
|
|
13
|
+
* Having a `deploy` target is not that answer. A deploy target says a project
|
|
14
|
+
* CAN be deployed; only a tag says CI does it. A published library ships a
|
|
15
|
+
* wrangler manifest to document a Durable Object binding for its consumers, and
|
|
16
|
+
* that manifest is structurally identical to a deployable worker's — so the
|
|
17
|
+
* plugin infers `deploy` from one, and a repository that deploys nothing from CI
|
|
18
|
+
* would otherwise generate a deploy job, with cloud credentials, for it.
|
|
19
|
+
*
|
|
20
|
+
* The three tags compose as precedence, not as a set: `permanent` excludes a
|
|
21
|
+
* project from every stage, `staging` narrows it to one, `stage` generalizes it
|
|
22
|
+
* to all. `production-push` selects WITHIN this answer (see `--select-tag`) and
|
|
23
|
+
* never widens it.
|
|
10
24
|
*/
|
|
11
|
-
export declare function
|
|
25
|
+
export declare function stageDeploysProject(tags: string[] | undefined, stage: DeploymentStage): boolean;
|
|
12
26
|
//# sourceMappingURL=deploy-tags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-tags.d.ts","sourceRoot":"","sources":["../../src/lib/deploy-tags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy-tags.d.ts","sourceRoot":"","sources":["../../src/lib/deploy-tags.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAK5D,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D,uEAAuE;AACvE,eAAO,MAAM,0BAA0B,kCAAkC,CAAC;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAK/F"}
|
package/dist/lib/deploy-tags.js
CHANGED
|
@@ -9,9 +9,28 @@ export const PERMANENT_DEPLOY_TAG = 'permanent-deploy-target';
|
|
|
9
9
|
/** Opts a project into the generated production-on-push deploy job. */
|
|
10
10
|
export const PRODUCTION_PUSH_DEPLOY_TAG = 'production-push-deploy-target';
|
|
11
11
|
/**
|
|
12
|
-
* Whether
|
|
13
|
-
*
|
|
12
|
+
* Whether the stage flow deploys a project, from its TAGS alone — the one rule
|
|
13
|
+
* CI selection and workflow generation both read, so a generated deploy job and
|
|
14
|
+
* the projects that job deploys cannot disagree.
|
|
15
|
+
*
|
|
16
|
+
* Having a `deploy` target is not that answer. A deploy target says a project
|
|
17
|
+
* CAN be deployed; only a tag says CI does it. A published library ships a
|
|
18
|
+
* wrangler manifest to document a Durable Object binding for its consumers, and
|
|
19
|
+
* that manifest is structurally identical to a deployable worker's — so the
|
|
20
|
+
* plugin infers `deploy` from one, and a repository that deploys nothing from CI
|
|
21
|
+
* would otherwise generate a deploy job, with cloud credentials, for it.
|
|
22
|
+
*
|
|
23
|
+
* The three tags compose as precedence, not as a set: `permanent` excludes a
|
|
24
|
+
* project from every stage, `staging` narrows it to one, `stage` generalizes it
|
|
25
|
+
* to all. `production-push` selects WITHIN this answer (see `--select-tag`) and
|
|
26
|
+
* never widens it.
|
|
14
27
|
*/
|
|
15
|
-
export function
|
|
16
|
-
|
|
28
|
+
export function stageDeploysProject(tags, stage) {
|
|
29
|
+
if (tags === undefined)
|
|
30
|
+
return false;
|
|
31
|
+
if (tags.includes(PERMANENT_DEPLOY_TAG))
|
|
32
|
+
return false;
|
|
33
|
+
if (tags.includes(STAGING_DEPLOY_TAG))
|
|
34
|
+
return stage === 'staging';
|
|
35
|
+
return tags.includes(STAGE_DEPLOY_TAG);
|
|
17
36
|
}
|
package/dist/lib/json.d.ts
CHANGED
|
@@ -188,10 +188,31 @@ export interface PackageRemoteCacheConfig {
|
|
|
188
188
|
*/
|
|
189
189
|
tokenSecret: RepositorySecretName;
|
|
190
190
|
}
|
|
191
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* A `smoo.secrets` group: which operation resolves the credential. One argv
|
|
193
|
+
* word of `smoo secrets run <group> <command...>`, so whitespace would make
|
|
194
|
+
* that command unwritable. Only the shape is validated — the values are the
|
|
195
|
+
* repository's, and a new group must not need a new smoo release.
|
|
196
|
+
*/
|
|
197
|
+
export type SecretGroupName = string & typia.tags.MinLength<1> & typia.tags.Pattern<'^\\S+$'>;
|
|
198
|
+
/**
|
|
199
|
+
* Local bootstrap fallback; existing environment values always take
|
|
200
|
+
* precedence, and CI injects these variables instead of running commands.
|
|
201
|
+
*
|
|
202
|
+
* Shell entry resolves the `shell` group and nothing else; every other group
|
|
203
|
+
* is resolved by `smoo secrets run <group> <command...>`, the one command
|
|
204
|
+
* that needs it. The group is DERIVED from what this manifest already
|
|
205
|
+
* declares — a variable `.npmrc` interpolates as `${VAR}` is `registry`, the
|
|
206
|
+
* variable `smoo.remoteCache.tokenSecret` names is `nx-cache`, everything
|
|
207
|
+
* else is `shell` — so `group` below is only for what those declarations
|
|
208
|
+
* cannot say. The routing lives in tooling/direnv/secret-references.ts,
|
|
209
|
+
* whose header states the rule and the derivation.
|
|
210
|
+
*/
|
|
192
211
|
export interface PackageSecretCommand {
|
|
193
212
|
/** Executed directly, without a shell; stdout supplies the secret value. */
|
|
194
213
|
command: NonEmptyArray<string>;
|
|
214
|
+
/** Overrides the derived group; absent derives one from this manifest and `.npmrc`. */
|
|
215
|
+
group?: SecretGroupName;
|
|
195
216
|
}
|
|
196
217
|
export interface PackageSmooConfig {
|
|
197
218
|
github?: PackageSmooGithub;
|
package/dist/lib/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/lib/json.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAEhD,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,2DAA2D;AAC3D,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAE3C,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,IAAI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AAG,oBAAoB,CAO1E;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB,CAO1E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAMxF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAM/F;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,EAChE,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,EAChE,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAM5F;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,iBAAiB,EAC7B,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,iBAAiB,EAC7B,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT"}
|
package/dist/lib/json.js
CHANGED
|
@@ -73,7 +73,7 @@ export const parsePackageJsonText = (() => {
|
|
|
73
73
|
return true;
|
|
74
74
|
return "object" === typeof value && null !== value && _io23(value, _vctx);
|
|
75
75
|
});
|
|
76
|
-
const _io23 = (input, _vctx = {}) => Array.isArray(input.command) && ("string" === typeof input.command[0] && (Array.isArray(input.command.slice(1)) && input.command.slice(1).every(elem => "string" === typeof elem)));
|
|
76
|
+
const _io23 = (input, _vctx = {}) => Array.isArray(input.command) && ("string" === typeof input.command[0] && (Array.isArray(input.command.slice(1)) && input.command.slice(1).every(elem => "string" === typeof elem))) && (undefined === input.group || "string" === typeof input.group && (1 <= _stringLength_1._stringLength(input.group) && RegExp("^\\S+$").test(input.group)));
|
|
77
77
|
const _io3 = (input, _vctx = {}) => undefined === input.packages || Array.isArray(input.packages) && input.packages.every(elem => "string" === typeof elem);
|
|
78
78
|
const _io4 = (input, _vctx = {}) => (undefined === input.access || "string" === typeof input.access) && (undefined === input.registry || "string" === typeof input.registry);
|
|
79
79
|
const _io5 = (input, _vctx = {}) => (undefined === input.type || "string" === typeof input.type) && (undefined === input.url || "string" === typeof input.url) && (undefined === input.directory || "string" === typeof input.directory);
|
|
@@ -405,7 +405,7 @@ const validatePackageJsonText = (() => {
|
|
|
405
405
|
return true;
|
|
406
406
|
return "object" === typeof value && null !== value && _io23(value, _vctx);
|
|
407
407
|
});
|
|
408
|
-
const _io23 = (input, _vctx = {}) => Array.isArray(input.command) && ("string" === typeof input.command[0] && (Array.isArray(input.command.slice(1)) && input.command.slice(1).every(elem => "string" === typeof elem)));
|
|
408
|
+
const _io23 = (input, _vctx = {}) => Array.isArray(input.command) && ("string" === typeof input.command[0] && (Array.isArray(input.command.slice(1)) && input.command.slice(1).every(elem => "string" === typeof elem))) && (undefined === input.group || "string" === typeof input.group && (1 <= _stringLength_1._stringLength(input.group) && RegExp("^\\S+$").test(input.group)));
|
|
409
409
|
const _io3 = (input, _vctx = {}) => undefined === input.packages || Array.isArray(input.packages) && input.packages.every(elem => "string" === typeof elem);
|
|
410
410
|
const _io4 = (input, _vctx = {}) => (undefined === input.access || "string" === typeof input.access) && (undefined === input.registry || "string" === typeof input.registry);
|
|
411
411
|
const _io5 = (input, _vctx = {}) => (undefined === input.type || "string" === typeof input.type) && (undefined === input.url || "string" === typeof input.url) && (undefined === input.directory || "string" === typeof input.directory);
|
|
@@ -827,6 +827,18 @@ const validatePackageJsonText = (() => {
|
|
|
827
827
|
path: _path + ".command",
|
|
828
828
|
expected: "NonEmptyArray<string>",
|
|
829
829
|
value: input.command
|
|
830
|
+
}), undefined === input.group || "string" === typeof input.group && (1 <= _stringLength_1._stringLength(input.group) || _report(_exceptionable, {
|
|
831
|
+
path: _path + ".group",
|
|
832
|
+
expected: "string & MinLength<1>",
|
|
833
|
+
value: input.group
|
|
834
|
+
})) && (RegExp("^\\S+$").test(input.group) || _report(_exceptionable, {
|
|
835
|
+
path: _path + ".group",
|
|
836
|
+
expected: "string & Pattern<\"^\\\\S+$\">",
|
|
837
|
+
value: input.group
|
|
838
|
+
})) || _report(_exceptionable, {
|
|
839
|
+
path: _path + ".group",
|
|
840
|
+
expected: "((string & MinLength<1> & Pattern<\"^\\\\S+$\">) | undefined)",
|
|
841
|
+
value: input.group
|
|
830
842
|
})].every(flag => flag);
|
|
831
843
|
const _vo3 = (input, _path, _exceptionable = true, _vctx = {}) => [undefined === input.packages || (Array.isArray(input.packages) || _report(_exceptionable, {
|
|
832
844
|
path: _path + ".packages",
|
|
@@ -1121,7 +1133,7 @@ const isPackageJsonValue = (() => {
|
|
|
1121
1133
|
return true;
|
|
1122
1134
|
return "object" === typeof value && null !== value && _io23(value, _vctx);
|
|
1123
1135
|
});
|
|
1124
|
-
const _io23 = (input, _vctx = {}) => Array.isArray(input.command) && ("string" === typeof input.command[0] && (Array.isArray(input.command.slice(1)) && input.command.slice(1).every(elem => "string" === typeof elem)));
|
|
1136
|
+
const _io23 = (input, _vctx = {}) => Array.isArray(input.command) && ("string" === typeof input.command[0] && (Array.isArray(input.command.slice(1)) && input.command.slice(1).every(elem => "string" === typeof elem))) && (undefined === input.group || "string" === typeof input.group && (1 <= _stringLength_1._stringLength(input.group) && RegExp("^\\S+$").test(input.group)));
|
|
1125
1137
|
const _io3 = (input, _vctx = {}) => undefined === input.packages || Array.isArray(input.packages) && input.packages.every(elem => "string" === typeof elem);
|
|
1126
1138
|
const _io4 = (input, _vctx = {}) => (undefined === input.access || "string" === typeof input.access) && (undefined === input.registry || "string" === typeof input.registry);
|
|
1127
1139
|
const _io5 = (input, _vctx = {}) => (undefined === input.type || "string" === typeof input.type) && (undefined === input.url || "string" === typeof input.url) && (undefined === input.directory || "string" === typeof input.directory);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProjectTargets } from '../nx/index.js';
|
|
1
2
|
/**
|
|
2
3
|
* The one command this policy shells out to, behind a seam. `cargo hakari
|
|
3
4
|
* verify` is the only authority on whether a generated workspace-hack still
|
|
@@ -16,6 +17,22 @@ export interface CargoPolicyOptions {
|
|
|
16
17
|
shell?: CargoHakariShell;
|
|
17
18
|
}
|
|
18
19
|
export declare function validateCargoCachePolicy(root: string, options?: CargoPolicyOptions): number;
|
|
20
|
+
/**
|
|
21
|
+
* A cached cargo target must hash the toolchain that compiled it.
|
|
22
|
+
*
|
|
23
|
+
* Inference attaches the pin to every cargo target it infers, but a repository
|
|
24
|
+
* that DECLARES `inputs` for one replaces that list wholesale and silently
|
|
25
|
+
* drops it — the target then survives a toolchain bump with a stale verdict,
|
|
26
|
+
* and a pre-push cross-compile probe consults a cache entry that cannot
|
|
27
|
+
* express the change it is probing for. Measured before this policy existed:
|
|
28
|
+
* a one-byte bump to the declared pin left one repository's `cargo-lint-cross`
|
|
29
|
+
* hash unchanged.
|
|
30
|
+
*
|
|
31
|
+
* This is a generated safety property removed by a local override, which no
|
|
32
|
+
* amount of care at the override site will catch on its own, so it is checked
|
|
33
|
+
* against the RESOLVED graph rather than against any one file.
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateCargoToolchainInputs(root: string, projects: readonly ProjectTargets[]): number;
|
|
19
36
|
/**
|
|
20
37
|
* The fix `smoo monorepo update` applies for the policy above: write the
|
|
21
38
|
* nightly resolver configuration, or generate and wire the workspace-hack a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cargo-policy.d.ts","sourceRoot":"","sources":["../../src/monorepo/cargo-policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cargo-policy.d.ts","sourceRoot":"","sources":["../../src/monorepo/cargo-policy.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAqFrD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CACrG;AAusBD,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAwD/F;AAiDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAoBtG;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,IAAI,CA8BjG"}
|
|
@@ -5,8 +5,9 @@ import * as _createStandardSchema_1 from "typia/lib/internal/_createStandardSche
|
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
6
6
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
7
7
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
8
|
+
import { CARGO_TOOLCHAIN_NAMED_INPUT, isCargoToolchainInput } from '@smoothbricks/nx-plugin/cargo-toolchain-policy';
|
|
8
9
|
import typia from 'typia';
|
|
9
|
-
import { parsePackageJsonText } from '../lib/json.js';
|
|
10
|
+
import { parseNxJsonText, parsePackageJsonText } from '../lib/json.js';
|
|
10
11
|
const validateCargoManifest = (() => {
|
|
11
12
|
const _io0 = input => (undefined === input.workspace || "object" === typeof input.workspace && null !== input.workspace && false === Array.isArray(input.workspace) && _io1(input.workspace)) && (undefined === input["package"] || "object" === typeof input["package"] && null !== input["package"] && false === Array.isArray(input["package"]) && _io2(input["package"])) && (undefined === input.profile || "object" === typeof input.profile && null !== input.profile && false === Array.isArray(input.profile) && _io3(input.profile)) && (undefined === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io5(input.dependencies)) && (undefined === input["dev-dependencies"] || "object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) && _io5(input["dev-dependencies"])) && (undefined === input["build-dependencies"] || "object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) && _io5(input["build-dependencies"]));
|
|
12
13
|
const _io1 = input => (undefined === input.members || Array.isArray(input.members) && input.members.every(elem => "string" === typeof elem)) && (undefined === input.exclude || Array.isArray(input.exclude) && input.exclude.every(elem => "string" === typeof elem));
|
|
@@ -1089,6 +1090,77 @@ export function validateCargoCachePolicy(root, options = {}) {
|
|
|
1089
1090
|
reportManifestDirectoryAdvisories(repositoryRoot, ignoredDirectories);
|
|
1090
1091
|
return failures;
|
|
1091
1092
|
}
|
|
1093
|
+
/** A command that compiles or checks Rust, whichever driver spells it. */
|
|
1094
|
+
const RUNS_CARGO = /(?:^|[\s;&|])cargo[\s-]|\bnapi build\b/;
|
|
1095
|
+
const CARGO_TOOLCHAIN_FIX = `Add "${CARGO_TOOLCHAIN_NAMED_INPUT}" to its inputs, or to the named input it uses`;
|
|
1096
|
+
function commandsOf(options) {
|
|
1097
|
+
const command = options?.command;
|
|
1098
|
+
const commands = options?.commands;
|
|
1099
|
+
return [
|
|
1100
|
+
typeof command === 'string' ? command : '',
|
|
1101
|
+
...(Array.isArray(commands) ? commands.filter((entry) => typeof entry === 'string') : []),
|
|
1102
|
+
].join('\n');
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Every fileset one declared input list reaches, with nx.json's named inputs
|
|
1106
|
+
* expanded. The plugin's own `cargoToolchain` is defined per PROJECT and wins
|
|
1107
|
+
* over nx.json, so naming it counts without an entry here; a repository that
|
|
1108
|
+
* redefines it workspace-wide is expanded and judged on what it resolves to.
|
|
1109
|
+
*/
|
|
1110
|
+
function resolveInputFilesets(declared, namedInputs, seen = new Set()) {
|
|
1111
|
+
const filesets = [];
|
|
1112
|
+
for (const entry of declared) {
|
|
1113
|
+
const name = entry.startsWith('^') ? entry.slice(1) : entry;
|
|
1114
|
+
const definition = namedInputs[name];
|
|
1115
|
+
if (definition === undefined) {
|
|
1116
|
+
filesets.push(entry);
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
if (seen.has(name))
|
|
1120
|
+
continue;
|
|
1121
|
+
seen.add(name);
|
|
1122
|
+
const expanded = typeof definition === 'string' ? [definition] : definition;
|
|
1123
|
+
filesets.push(...resolveInputFilesets(expanded.filter((value) => typeof value === 'string'), namedInputs, seen));
|
|
1124
|
+
}
|
|
1125
|
+
return filesets;
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* A cached cargo target must hash the toolchain that compiled it.
|
|
1129
|
+
*
|
|
1130
|
+
* Inference attaches the pin to every cargo target it infers, but a repository
|
|
1131
|
+
* that DECLARES `inputs` for one replaces that list wholesale and silently
|
|
1132
|
+
* drops it — the target then survives a toolchain bump with a stale verdict,
|
|
1133
|
+
* and a pre-push cross-compile probe consults a cache entry that cannot
|
|
1134
|
+
* express the change it is probing for. Measured before this policy existed:
|
|
1135
|
+
* a one-byte bump to the declared pin left one repository's `cargo-lint-cross`
|
|
1136
|
+
* hash unchanged.
|
|
1137
|
+
*
|
|
1138
|
+
* This is a generated safety property removed by a local override, which no
|
|
1139
|
+
* amount of care at the override site will catch on its own, so it is checked
|
|
1140
|
+
* against the RESOLVED graph rather than against any one file.
|
|
1141
|
+
*/
|
|
1142
|
+
export function validateCargoToolchainInputs(root, projects) {
|
|
1143
|
+
const nxJsonPath = join(resolve(root), 'nx.json');
|
|
1144
|
+
const namedInputs = existsSync(nxJsonPath)
|
|
1145
|
+
? (parseNxJsonText(readFileSync(nxJsonPath, 'utf8'))?.namedInputs ?? {})
|
|
1146
|
+
: {};
|
|
1147
|
+
let failures = 0;
|
|
1148
|
+
for (const project of projects) {
|
|
1149
|
+
for (const target of [...project.targets].sort()) {
|
|
1150
|
+
if (project.targetCache?.get(target) !== true)
|
|
1151
|
+
continue;
|
|
1152
|
+
if (!RUNS_CARGO.test(commandsOf(project.targetOptions?.get(target))))
|
|
1153
|
+
continue;
|
|
1154
|
+
const declared = project.targetInputs?.get(target) ?? [];
|
|
1155
|
+
if (declared.includes(CARGO_TOOLCHAIN_NAMED_INPUT))
|
|
1156
|
+
continue;
|
|
1157
|
+
if (resolveInputFilesets(declared, namedInputs).some(isCargoToolchainInput))
|
|
1158
|
+
continue;
|
|
1159
|
+
failures += report(`${project.project}:${target}`, `cached cargo target hashes no toolchain pin, so a toolchain bump cannot invalidate it. ${CARGO_TOOLCHAIN_FIX}.`);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return failures;
|
|
1163
|
+
}
|
|
1092
1164
|
/**
|
|
1093
1165
|
* The fix `smoo monorepo update` applies for the policy above: write the
|
|
1094
1166
|
* nightly resolver configuration, or generate and wire the workspace-hack a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monorepo/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monorepo/index.ts"],"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