@smoothbricks/nx-plugin 0.7.12 → 0.7.13
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 +78 -24
- package/dist/.build-inputs.json +20 -12
- package/dist/built-output-packages.d.ts +27 -0
- package/dist/built-output-packages.d.ts.map +1 -0
- package/dist/built-output-packages.js +97 -0
- package/dist/cross-check-policy.d.ts +13 -1
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +13 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts +68 -0
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -0
- package/dist/executors/bounded-exec/admission-queue.js +131 -0
- package/dist/executors/bounded-exec/cpu-grant.d.ts +14 -0
- package/dist/executors/bounded-exec/cpu-grant.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-grant.js +18 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +1 -14
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +2 -49
- package/dist/executors/bounded-exec/executor.d.ts +5 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +51 -154
- package/dist/executors/bounded-exec/memory-retry.d.ts +39 -0
- package/dist/executors/bounded-exec/memory-retry.d.ts.map +1 -0
- package/dist/executors/bounded-exec/memory-retry.js +33 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts +43 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -0
- package/dist/executors/bounded-exec/parent-grant.js +37 -0
- package/dist/executors/bounded-exec/peak-charge.d.ts +17 -0
- package/dist/executors/bounded-exec/peak-charge.d.ts.map +1 -0
- package/dist/executors/bounded-exec/peak-charge.js +20 -0
- package/dist/executors/bounded-exec/pool-environment.d.ts +25 -0
- package/dist/executors/bounded-exec/pool-environment.d.ts.map +1 -0
- package/dist/executors/bounded-exec/pool-environment.js +34 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +3 -18
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +4 -25
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -21
- package/dist/managed-files/ci-workflow.d.ts +29 -5
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +111 -16
- package/dist/managed-files/context.d.ts.map +1 -1
- package/dist/managed-files/context.js +1 -0
- package/dist/managed-files/files.d.ts +3 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +2 -0
- package/dist/managed-files/publish-workflow.d.ts +6 -1
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +16 -11
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +48 -14
- package/dist/typecheck-route.d.ts +28 -0
- package/dist/typecheck-route.d.ts.map +1 -0
- package/dist/typecheck-route.js +109 -0
- package/dist/workspace-manifest.d.ts +50 -5
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +10 -0
- package/managed/raw/patches/ttsc@0.34.1.patch +93 -8
- package/managed/raw/tooling/direnv/apple-developer.sh +8 -1
- package/managed/raw/tooling/direnv/compiler-variables.sh +1 -1
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +4 -2
- package/managed/raw/tooling/direnv/secret-references.ts +19 -5
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -10
- package/managed/templates/github/actions/forgejo-artifact.cjs +9 -9
- package/managed/templates/github/actions/setup-devenv/action.yml +53 -0
- package/package.json +2 -2
- package/src/built-output-packages.ts +125 -0
- package/src/cross-check-policy.ts +14 -1
- package/src/executors/bounded-exec/admission-queue.ts +163 -0
- package/src/executors/bounded-exec/cpu-grant.ts +32 -0
- package/src/executors/bounded-exec/cpu-pool.ts +2 -33
- package/src/executors/bounded-exec/executor.ts +60 -201
- package/src/executors/bounded-exec/memory-retry.ts +63 -0
- package/src/executors/bounded-exec/parent-grant.ts +75 -0
- package/src/executors/bounded-exec/peak-charge.ts +25 -0
- package/src/executors/bounded-exec/pool-environment.ts +45 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -1
- package/src/executors/bounded-exec/verdict.ts +7 -35
- package/src/index.ts +70 -21
- package/src/managed-files/ci-workflow.ts +143 -16
- package/src/managed-files/context.ts +1 -0
- package/src/managed-files/files.ts +5 -0
- package/src/managed-files/publish-workflow.ts +26 -10
- package/src/owned-installation.ts +63 -14
- package/src/typecheck-route.ts +64 -0
- package/src/workspace-manifest.ts +56 -5
- package/test-timings.json +141 -139
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../platform-targets.js';
|
|
10
10
|
import type {
|
|
11
11
|
PackageCargoCredentialsConfig,
|
|
12
|
+
PackageMbxRemoteConfig,
|
|
12
13
|
PackagePrivateNpmConfig,
|
|
13
14
|
PackageRemoteCacheConfig,
|
|
14
15
|
PackageSmooGithub,
|
|
@@ -17,6 +18,7 @@ import type {
|
|
|
17
18
|
import { isSmoothBricksCodebasePackageName } from '../workspace-package-policy.js';
|
|
18
19
|
import {
|
|
19
20
|
artifactStepLines,
|
|
21
|
+
type CacheReach,
|
|
20
22
|
CI_JOB_ID,
|
|
21
23
|
CI_WORKFLOW_NAME,
|
|
22
24
|
CiWorkflowStepKind,
|
|
@@ -25,6 +27,7 @@ import {
|
|
|
25
27
|
type DeployStepSecretConfig,
|
|
26
28
|
deployStepSecretEnvLines,
|
|
27
29
|
githubActionPins,
|
|
30
|
+
mbxRemoteJobEnvLines,
|
|
28
31
|
remoteCacheJobEnvLines,
|
|
29
32
|
sourceCheckoutsStepLines,
|
|
30
33
|
TRACE_DB_ARTIFACT_GLOB,
|
|
@@ -127,6 +130,11 @@ export interface PublishWorkflowDefinitionOptions extends DeployStepSecretConfig
|
|
|
127
130
|
* built for the same hashes.
|
|
128
131
|
*/
|
|
129
132
|
remoteCache?: PackageRemoteCacheConfig;
|
|
133
|
+
/**
|
|
134
|
+
* Declared mbx remote cache. Every job here may build Cargo, so each carries mbx's remote settings; a release
|
|
135
|
+
* dispatched on the default branch publishes what it compiles.
|
|
136
|
+
*/
|
|
137
|
+
mbxRemote?: PackageMbxRemoteConfig;
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
export interface PublishWorkflowInputs {
|
|
@@ -527,7 +535,7 @@ ${options.release === false ? renderRunsOnLine(options.runsOn) : publishJobRunsO
|
|
|
527
535
|
timeout-minutes: ${options.platformTargetGlobs?.length ? 90 : 45}
|
|
528
536
|
env:
|
|
529
537
|
LMAO_GIT_REVISION: ${githubExpression('github.sha')}
|
|
530
|
-
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options)}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
538
|
+
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options, options.release === false ? 'internal' : publisherReach(options))}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
531
539
|
steps:
|
|
532
540
|
`;
|
|
533
541
|
}
|
|
@@ -821,13 +829,16 @@ function cargoCredentialsJobEnv(options: PublishWorkflowDefinitionOptions): stri
|
|
|
821
829
|
}
|
|
822
830
|
|
|
823
831
|
/**
|
|
824
|
-
* The remote
|
|
825
|
-
* reads
|
|
826
|
-
*
|
|
827
|
-
*
|
|
832
|
+
* The remote caches are job env for the same reason: every Nx target in the job
|
|
833
|
+
* reads the Nx cache and every Cargo build the mbx one, and a release build
|
|
834
|
+
* that missed them would rebuild what CI already built for the identical
|
|
835
|
+
* inputs. Only `${{ secrets.NAME }}` is rendered for a token. Malformed
|
|
836
|
+
* declarations throw here, not in CI.
|
|
828
837
|
*/
|
|
829
|
-
function remoteCacheJobEnv(options: PublishWorkflowDefinitionOptions): string {
|
|
830
|
-
const rendered =
|
|
838
|
+
function remoteCacheJobEnv(options: PublishWorkflowDefinitionOptions, reach: CacheReach): string {
|
|
839
|
+
const rendered = (
|
|
840
|
+
remoteCacheJobEnvLines(options.remoteCache, reach) + mbxRemoteJobEnvLines(options.mbxRemote, reach)
|
|
841
|
+
).trimEnd();
|
|
831
842
|
return rendered === '' ? '' : `\n${rendered}`;
|
|
832
843
|
}
|
|
833
844
|
|
|
@@ -946,7 +957,7 @@ ${renderRunsOnLine(options.runsOn)}
|
|
|
946
957
|
release-sha: ${githubExpression('steps.release-state.outputs.sha')}
|
|
947
958
|
env:
|
|
948
959
|
LMAO_GIT_REVISION: ${githubExpression('github.sha')}
|
|
949
|
-
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options)}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
960
|
+
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options, 'internal')}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
950
961
|
steps:
|
|
951
962
|
${renderLinuxReleaseCandidateSteps(steps, options)}
|
|
952
963
|
|
|
@@ -958,7 +969,7 @@ ${renderMacosJobHeaderLines(options)}
|
|
|
958
969
|
id-token: none
|
|
959
970
|
env:
|
|
960
971
|
LMAO_GIT_REVISION: ${githubExpression('github.sha')}
|
|
961
|
-
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options)}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
972
|
+
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options, options.platformProducer?.kind === 'linux-cross' ? 'internal' : 'public')}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
962
973
|
steps:
|
|
963
974
|
${renderMacosPlatformSteps(options)}
|
|
964
975
|
|
|
@@ -972,7 +983,7 @@ ${publishJobRunsOnLine(options)}
|
|
|
972
983
|
env:
|
|
973
984
|
LMAO_GIT_REVISION: ${githubExpression('github.sha')}
|
|
974
985
|
TTSC_TSGO_BINARY: ${githubExpression('github.workspace')}/node_modules/@typescript/native/bin/tsc
|
|
975
|
-
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options)}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
986
|
+
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options, publisherReach(options))}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
976
987
|
steps:
|
|
977
988
|
${renderFinalLinuxPublishSteps(options)}
|
|
978
989
|
`;
|
|
@@ -1544,6 +1555,11 @@ function publishJobRunsOnLine(options: PublishWorkflowDefinitionOptions): string
|
|
|
1544
1555
|
return renderRunsOnLine(options.actionsProvider === 'forgejo' ? options.runsOn : GITHUB_HOSTED_LINUX_RUNNER);
|
|
1545
1556
|
}
|
|
1546
1557
|
|
|
1558
|
+
/** The remote-cache reach of the runner publishJobRunsOnLine picks: Forgejo's own runners, or a GitHub-hosted one. */
|
|
1559
|
+
function publisherReach(options: PublishWorkflowDefinitionOptions): CacheReach {
|
|
1560
|
+
return options.actionsProvider === 'forgejo' ? 'internal' : 'public';
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1547
1563
|
function githubExpression(expression: string): string {
|
|
1548
1564
|
return ['$', '{{ ', expression, ' }}'].join('');
|
|
1549
1565
|
}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* test reads it. A fixture must not take an input it does not own.
|
|
10
10
|
*
|
|
11
11
|
* So the closure is copied, exactly as the witness's own census resolves it from the workspace that names it: each
|
|
12
|
-
* package once,
|
|
12
|
+
* package once, as the nodes the census holds of it (what it publishes, never its tools' state beside it), each
|
|
13
|
+
* dependency edge relinked beside
|
|
13
14
|
* its copy as Bun's isolated layout does, the top-level packages' bins in `.bin`. Every copy is a new inode, cloned
|
|
14
15
|
* where the volume allows and written otherwise, so no link count is shared with anything outside its owner.
|
|
15
16
|
*
|
|
@@ -35,7 +36,21 @@
|
|
|
35
36
|
import { spawn } from 'node:child_process';
|
|
36
37
|
import { randomUUID } from 'node:crypto';
|
|
37
38
|
import { constants, rmSync } from 'node:fs';
|
|
38
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
chmod,
|
|
41
|
+
copyFile,
|
|
42
|
+
cp,
|
|
43
|
+
lstat,
|
|
44
|
+
mkdir,
|
|
45
|
+
readdir,
|
|
46
|
+
readFile,
|
|
47
|
+
readlink,
|
|
48
|
+
realpath,
|
|
49
|
+
rename,
|
|
50
|
+
rm,
|
|
51
|
+
symlink,
|
|
52
|
+
writeFile,
|
|
53
|
+
} from 'node:fs/promises';
|
|
39
54
|
import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
40
55
|
import { expandOutputs } from 'nx/src/native';
|
|
41
56
|
import { readModulePackageJson } from 'nx/src/utils/package-json';
|
|
@@ -301,16 +316,49 @@ async function sweep(kept: string, keep: ReadonlySet<string>): Promise<void> {
|
|
|
301
316
|
}
|
|
302
317
|
}
|
|
303
318
|
|
|
304
|
-
/**
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Make the copy of the host package root `source` at its place under `root` from exactly the nodes the host census
|
|
321
|
+
* holds for it (`censused`, every node of the closure in the census's walk order, a directory before what it holds):
|
|
322
|
+
* for a package declaring `files`, what it publishes, never `node_modules` or `.git`. A censused directory's `.nx` is
|
|
323
|
+
* copied whole: @nx/workspace 24.0.3 ships templates under one, which the census does not walk, but what its `files`
|
|
324
|
+
* select there (expandOutputs) selects the directory that holds it, so a copy without it censuses less. Nothing else of the package root
|
|
325
|
+
* is content of the closure, and a workspace package's root also holds its own tools' state (a `.cache/` its tests
|
|
326
|
+
* write and remove while this copy reads), which a copy of the whole root would race. A link is copied as it reads;
|
|
327
|
+
* the nodes it reaches are the census's own. A file is cloned where the volume allows.
|
|
328
|
+
*/
|
|
329
|
+
async function copyPackage(
|
|
330
|
+
source: string,
|
|
331
|
+
root: string,
|
|
332
|
+
{ place }: Placement,
|
|
333
|
+
censused: readonly string[],
|
|
334
|
+
): Promise<void> {
|
|
335
|
+
const target = join(root, place);
|
|
336
|
+
for (const path of censused) {
|
|
337
|
+
if (path !== source && !path.startsWith(`${source}/`)) continue;
|
|
338
|
+
const destination = join(target, relative(source, path));
|
|
339
|
+
const stats = await lstat(path);
|
|
340
|
+
if (stats.isSymbolicLink()) {
|
|
341
|
+
await symlink(await readlink(path), destination);
|
|
342
|
+
} else if (stats.isDirectory()) {
|
|
343
|
+
await mkdir(destination, { recursive: true });
|
|
344
|
+
await chmod(destination, stats.mode & 0o7777);
|
|
345
|
+
// The one absence expected here: most directories hold no .nx.
|
|
346
|
+
const dotNx = join(path, '.nx');
|
|
347
|
+
const held = await lstat(dotNx).catch((error: unknown) => {
|
|
348
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return null;
|
|
349
|
+
throw error;
|
|
350
|
+
});
|
|
351
|
+
if (held?.isDirectory()) {
|
|
352
|
+
await cp(dotNx, join(destination, '.nx'), {
|
|
353
|
+
recursive: true,
|
|
354
|
+
verbatimSymlinks: true,
|
|
355
|
+
mode: constants.COPYFILE_FICLONE,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
await copyFile(path, destination, constants.COPYFILE_FICLONE);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
314
362
|
}
|
|
315
363
|
|
|
316
364
|
/** Link every resolution edge of `host` beside its copy under `root`, and the top-level packages' bins in `.bin`. */
|
|
@@ -388,6 +436,7 @@ async function proveOrCopy(censusRoot: string, kept: string, inUse: ReadonlySet<
|
|
|
388
436
|
);
|
|
389
437
|
if (host === null) throw new Error(`the Nx installation closure of ${censusRoot} cannot be read: ${unread}`);
|
|
390
438
|
const placed = await placements(host);
|
|
439
|
+
const censused = host.nodes.map(({ path }) => path);
|
|
391
440
|
const wanted = holdings(host, censusRoot, new Map([...placed].map(([source, { place }]) => [source, place])));
|
|
392
441
|
const placesIn = (root: string) => new Map([...placed.values()].map(({ place }) => [join(root, place), place]));
|
|
393
442
|
// Only a recorded copy is censused: a census of none would resolve the host's packages through the ancestor lookup.
|
|
@@ -435,10 +484,10 @@ async function proveOrCopy(censusRoot: string, kept: string, inUse: ReadonlySet<
|
|
|
435
484
|
: join(kept, `installation-${randomUUID()}`);
|
|
436
485
|
if (root === current && stale !== null) {
|
|
437
486
|
for (const [, { place }] of stale) await rm(join(root, place), { recursive: true, force: true });
|
|
438
|
-
await Promise.all(stale.map(([source, placement]) => copyPackage(source, root, placement)));
|
|
487
|
+
await Promise.all(stale.map(([source, placement]) => copyPackage(source, root, placement, censused)));
|
|
439
488
|
} else {
|
|
440
489
|
await sweep(kept, inUse);
|
|
441
|
-
await Promise.all([...placed].map(([source, placement]) => copyPackage(source, root, placement)));
|
|
490
|
+
await Promise.all([...placed].map(([source, placement]) => copyPackage(source, root, placement, censused)));
|
|
442
491
|
await linkCopies(censusRoot, root, host, placed);
|
|
443
492
|
}
|
|
444
493
|
const census = copyCensus(root, root === current ? (found ?? undefined) : undefined, (detail) => {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import typia from 'typia';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a package whose ttsc plugin lowers a dialect declares in its manifest, as `smoo.typecheck`: every project that
|
|
8
|
+
* depends on it directly compiles sources the stock checker refuses (a construct the plugin's ProgramPlugin rewrites
|
|
9
|
+
* before emit, its refusal withdrawn through the driver's DiagnosticPlugin seam), so that project's typecheck runs
|
|
10
|
+
* through ttsc, never the pinned native compiler, which cannot judge the dialect.
|
|
11
|
+
*/
|
|
12
|
+
export interface DialectTypecheck {
|
|
13
|
+
/** The compiler a dependent project's typecheck runs. */
|
|
14
|
+
readonly compiler: 'ttsc';
|
|
15
|
+
/**
|
|
16
|
+
* The Nx targets (`project:target`) that prepare the plugin binaries ttsc loads, so a typecheck loads built bytes
|
|
17
|
+
* and never compiles the plugin inside the check. The declaring package names them; the inference guesses none.
|
|
18
|
+
*/
|
|
19
|
+
readonly dependsOn: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The one manifest field this module reads. Any other field is the manifest owner's. */
|
|
23
|
+
interface DeclaringManifest {
|
|
24
|
+
readonly smoo?: { readonly typecheck?: DialectTypecheck };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const validateManifest = typia.createValidate<DeclaringManifest>();
|
|
28
|
+
|
|
29
|
+
/** A project's typecheck route: the direct dependencies that declare a dialect, and the targets they name, once each. */
|
|
30
|
+
export interface TypecheckRoute {
|
|
31
|
+
readonly declaredBy: readonly string[];
|
|
32
|
+
readonly dependsOn: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The typecheck route of the project whose manifest is `packageJsonPath`, over its direct dependencies (the ones ttsc
|
|
37
|
+
* discovers plugins on: `dependencies` and `devDependencies`). Each dependency's manifest is the one Node resolution
|
|
38
|
+
* reaches from the project, as ttsc reads it; a dependency that is not installed declares nothing. A manifest that
|
|
39
|
+
* declares `smoo.typecheck` in another shape refuses the inference by its path and the field it got wrong.
|
|
40
|
+
*/
|
|
41
|
+
export function typecheckRoute(packageJsonPath: string, dependencies: readonly string[]): TypecheckRoute {
|
|
42
|
+
const declaredBy: string[] = [];
|
|
43
|
+
const dependsOn: string[] = [];
|
|
44
|
+
const lookup = createRequire(packageJsonPath);
|
|
45
|
+
for (const name of new Set(dependencies)) {
|
|
46
|
+
const manifest = (lookup.resolve.paths(name) ?? [])
|
|
47
|
+
.map((root) => join(root, ...name.split('/'), 'package.json'))
|
|
48
|
+
.find((candidate) => existsSync(candidate));
|
|
49
|
+
if (manifest === undefined) continue;
|
|
50
|
+
const checked = validateManifest(JSON.parse(readFileSync(manifest, 'utf-8')));
|
|
51
|
+
if (!checked.success) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`${manifest}: smoo.typecheck must be { compiler: 'ttsc', dependsOn: ['<project>:<target>', ...] }: ${checked.errors
|
|
54
|
+
.map((error) => `${error.path} expected ${error.expected}`)
|
|
55
|
+
.join('; ')}`,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const declared = checked.data.smoo?.typecheck;
|
|
59
|
+
if (declared === undefined) continue;
|
|
60
|
+
declaredBy.push(name);
|
|
61
|
+
for (const target of declared.dependsOn) if (!dependsOn.includes(target)) dependsOn.push(target);
|
|
62
|
+
}
|
|
63
|
+
return { declaredBy, dependsOn };
|
|
64
|
+
}
|
|
@@ -187,7 +187,10 @@ export interface PackagePrivateNpmConfig {
|
|
|
187
187
|
* miss, but a server without a working credential fails every task with 401
|
|
188
188
|
* rather than missing quietly.
|
|
189
189
|
*/
|
|
190
|
-
export
|
|
190
|
+
export type PackageRemoteCacheConfig = RemoteCacheDeclaration & (LiteralCacheOrigin | VariableCacheOrigin);
|
|
191
|
+
|
|
192
|
+
/** The public origin written out, for a cache whose address may be published. */
|
|
193
|
+
export interface LiteralCacheOrigin {
|
|
191
194
|
/**
|
|
192
195
|
* Origin every runner and developer machine can reach, e.g.
|
|
193
196
|
* `https://nx-cache.example.net`. Credential-free, no path, and no trailing
|
|
@@ -195,12 +198,26 @@ export interface PackageRemoteCacheConfig {
|
|
|
195
198
|
* `//v1/cache/<hash>`, which is a different route and answers 404 forever.
|
|
196
199
|
*/
|
|
197
200
|
server: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The public origin named by a repository variable, for a public repository whose cache address is private: managed
|
|
205
|
+
* CI reads it as `${{ vars.<serverVariable> }}`, and a developer shell that wants the cache exports the same name.
|
|
206
|
+
*/
|
|
207
|
+
export interface VariableCacheOrigin {
|
|
208
|
+
/** Repository variable (and shell variable) holding the public origin, in the shape `server` takes. */
|
|
209
|
+
serverVariable: RepositorySecretName;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** What every declaration carries, whichever way it names the public origin. */
|
|
213
|
+
export interface RemoteCacheDeclaration {
|
|
198
214
|
/**
|
|
199
|
-
* Origin
|
|
215
|
+
* Origin the repository's own runners reach instead of the public one, e.g.
|
|
200
216
|
* `http://10.89.0.1:8765` across a container bridge. Same declaration as a
|
|
201
|
-
* git origin's `internalMirror`: declaring it says
|
|
202
|
-
*
|
|
203
|
-
* keep
|
|
217
|
+
* git origin's `internalMirror`: declaring it says those runners are inside
|
|
218
|
+
* that network, so managed CI jobs on them use it, and jobs on other runners
|
|
219
|
+
* and shells outside keep the public origin. Omitted means CI uses the public
|
|
220
|
+
* origin too.
|
|
204
221
|
*/
|
|
205
222
|
internalServer?: string;
|
|
206
223
|
/**
|
|
@@ -212,6 +229,38 @@ export interface PackageRemoteCacheConfig {
|
|
|
212
229
|
tokenSecret: RepositorySecretName;
|
|
213
230
|
}
|
|
214
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Declared mbx remote cache (`smoo.mbxRemote`): the compiler-action cache every Cargo build under mbx reads and the
|
|
234
|
+
* default branch's own runs publish into. Managed CI puts mbx's remote settings in each job's environment, and
|
|
235
|
+
* setup-devenv routes Cargo through mbx's Cargo shim whenever they are set, so a crate any runner already compiled is a
|
|
236
|
+
* download for every other runner and a one-crate change recompiles that crate. Absent means CI builds Cargo without
|
|
237
|
+
* mbx.
|
|
238
|
+
*
|
|
239
|
+
* Two tokens because the server's grants, not mbx's client-side write policy, are the access boundary: a job on the
|
|
240
|
+
* default branch (a push to it, or a release dispatched on it) gets `writeTokenSecret` and is trusted to publish
|
|
241
|
+
* (`MBX_REMOTE_TRUST_WRITES`); every other job gets `readTokenSecret`, which the server refuses to write with.
|
|
242
|
+
*/
|
|
243
|
+
export type PackageMbxRemoteConfig = MbxRemoteDeclaration & (LiteralCacheOrigin | VariableCacheOrigin);
|
|
244
|
+
|
|
245
|
+
/** What every mbx remote declaration carries, whichever way it names the public origin. */
|
|
246
|
+
export interface MbxRemoteDeclaration {
|
|
247
|
+
/**
|
|
248
|
+
* Origin the repository's own runners reach instead of the public one. mbx sends a token over plain HTTP only to a
|
|
249
|
+
* loopback address, so this is an `https://` origin or a loopback one such as `http://127.0.0.1:8766` that each
|
|
250
|
+
* runner forwards to the cache host.
|
|
251
|
+
*/
|
|
252
|
+
internalServer?: string;
|
|
253
|
+
/** Cache namespace (`MBX_REMOTE_NAMESPACE`); repositories that declare the same one reuse each other's compilations. */
|
|
254
|
+
namespace: MbxNamespace;
|
|
255
|
+
/** Repository secret holding the read+write token, given only to the default branch's own runs. */
|
|
256
|
+
writeTokenSecret: RepositorySecretName;
|
|
257
|
+
/** Repository secret holding the read-only token every other job gets. */
|
|
258
|
+
readTokenSecret: RepositorySecretName;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** `name` or `owner/name`: slash-separated segments of letters, digits, `.`, `_` and `-`, each starting alphanumeric. */
|
|
262
|
+
export type MbxNamespace = string & typia.tags.Pattern<'^[A-Za-z0-9][A-Za-z0-9._-]*(/[A-Za-z0-9][A-Za-z0-9._-]*)*$'>;
|
|
263
|
+
|
|
215
264
|
/**
|
|
216
265
|
* A `smoo.secrets` group: which operation resolves the credential. One argv
|
|
217
266
|
* word of `smoo secrets run <group> <command...>`, so whitespace would make
|
|
@@ -274,6 +323,8 @@ export interface PackageSmooConfig {
|
|
|
274
323
|
privateNpm?: PackagePrivateNpmConfig;
|
|
275
324
|
/** Declared self-hosted Nx remote cache; absent means local caching only. */
|
|
276
325
|
remoteCache?: PackageRemoteCacheConfig;
|
|
326
|
+
/** Declared mbx remote cache for Cargo builds; absent means CI builds Cargo without mbx. */
|
|
327
|
+
mbxRemote?: PackageMbxRemoteConfig;
|
|
277
328
|
/** Provider-neutral local secret commands. CI supplies these variables externally. */
|
|
278
329
|
secrets?: Record<string, PackageSecretCommand>;
|
|
279
330
|
/**
|