@smoothbricks/cli 0.10.4 → 0.10.6
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/dist/cli.js +5 -5
- package/dist/github-ci/index.d.ts.map +1 -1
- package/dist/github-ci/index.js +5 -3
- package/dist/lib/json.d.ts +5 -1
- package/dist/lib/json.d.ts.map +1 -1
- package/dist/lib/json.js +18 -16
- package/dist/monorepo/ci-workflow.d.ts +2 -0
- package/dist/monorepo/ci-workflow.d.ts.map +1 -1
- package/dist/monorepo/ci-workflow.js +10 -4
- package/dist/monorepo/github-runs-on.d.ts +14 -0
- package/dist/monorepo/github-runs-on.d.ts.map +1 -0
- package/dist/monorepo/github-runs-on.js +43 -0
- package/dist/monorepo/index.d.ts +3 -3
- package/dist/monorepo/index.d.ts.map +1 -1
- package/dist/monorepo/index.js +20 -8
- package/dist/monorepo/lockfile.d.ts +2 -1
- package/dist/monorepo/lockfile.d.ts.map +1 -1
- package/dist/monorepo/lockfile.js +1 -1
- package/dist/monorepo/managed-files.d.ts +30 -3
- package/dist/monorepo/managed-files.d.ts.map +1 -1
- package/dist/monorepo/managed-files.js +83 -63
- package/dist/monorepo/packs/index.js +2 -2
- package/dist/monorepo/publish-workflow.d.ts +3 -0
- package/dist/monorepo/publish-workflow.d.ts.map +1 -1
- package/dist/monorepo/publish-workflow.js +17 -14
- package/dist/monorepo/tool-validation.d.ts +2 -2
- package/dist/monorepo/tool-validation.d.ts.map +1 -1
- package/dist/monorepo/tool-validation.js +110 -16
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +6 -0
- package/managed/raw/envrc +5 -3
- package/managed/raw/patches/ttsc@0.19.3.patch +67 -0
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +24 -7
- package/managed/raw/tooling/direnv/setup-environment.ts +23 -3
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +13 -11
- package/managed/templates/github/actions/save-nix-devenv/action.yml +34 -3
- package/managed/templates/github/actions/setup-devenv/action.yml +44 -15
- package/managed/templates/github/workflows/managed-files.yml +64 -12
- package/package.json +2 -2
- package/src/cli.ts +6 -6
- package/src/github-ci/index.test.ts +3 -3
- package/src/github-ci/index.ts +6 -3
- package/src/lib/json.ts +5 -1
- package/src/monorepo/__tests__/ci-workflow.test.ts +37 -1
- package/src/monorepo/__tests__/publish-workflow.test.ts +28 -1
- package/src/monorepo/ci-workflow.ts +14 -4
- package/src/monorepo/github-runs-on.ts +45 -0
- package/src/monorepo/index.ts +20 -8
- package/src/monorepo/lockfile.ts +3 -2
- package/src/monorepo/managed-files.test.ts +49 -0
- package/src/monorepo/managed-files.ts +105 -64
- package/src/monorepo/packs/index.ts +2 -2
- package/src/monorepo/publish-workflow.ts +23 -15
- package/src/monorepo/tool-validation.test.ts +38 -16
- package/src/monorepo/tool-validation.ts +114 -16
- package/src/release/index.ts +6 -0
package/dist/cli.js
CHANGED
|
@@ -50,18 +50,18 @@ function buildProgram() {
|
|
|
50
50
|
});
|
|
51
51
|
monorepo.command('update').action(async () => {
|
|
52
52
|
const { updateManagedFiles } = await import('./monorepo/index.js');
|
|
53
|
-
updateManagedFiles(await findRepoRoot());
|
|
53
|
+
await updateManagedFiles(await findRepoRoot());
|
|
54
54
|
});
|
|
55
55
|
monorepo
|
|
56
56
|
.command('check')
|
|
57
57
|
.option('--warn', 'report drift as warnings (GitHub annotations) instead of failing')
|
|
58
58
|
.action(async (options) => {
|
|
59
59
|
const { checkManagedFiles } = await import('./monorepo/index.js');
|
|
60
|
-
checkManagedFiles(await findRepoRoot(), { warn: options.warn });
|
|
60
|
+
await checkManagedFiles(await findRepoRoot(), { warn: options.warn });
|
|
61
61
|
});
|
|
62
62
|
monorepo.command('diff').action(async () => {
|
|
63
63
|
const { diffManagedFiles } = await import('./monorepo/index.js');
|
|
64
|
-
diffManagedFiles(await findRepoRoot());
|
|
64
|
+
await diffManagedFiles(await findRepoRoot());
|
|
65
65
|
});
|
|
66
66
|
monorepo
|
|
67
67
|
.command('validate-commit-msg <commitMsgFile>')
|
|
@@ -73,10 +73,10 @@ function buildProgram() {
|
|
|
73
73
|
monorepo
|
|
74
74
|
.command('sync-bun-lockfile-versions')
|
|
75
75
|
.option('--stage', 'stage bun.lock when versions were resynced; quiet when clean')
|
|
76
|
-
.option('--mode <mode>', 'install: match package.json (CI); publish: map unpublished -next to last stable tag (pre-pack)', '
|
|
76
|
+
.option('--mode <mode>', 'install: match package.json (default, CI); publish: map unpublished -next to last stable tag (pre-pack only)', 'install')
|
|
77
77
|
.action(async (options) => {
|
|
78
78
|
const { syncBunLockfileVersions } = await import('./monorepo/index.js');
|
|
79
|
-
const mode = options.mode === '
|
|
79
|
+
const mode = options.mode === 'publish' ? 'publish' : 'install';
|
|
80
80
|
syncBunLockfileVersions(await findRepoRoot(), {
|
|
81
81
|
mode,
|
|
82
82
|
...(options.stage ? { log: false, stage: true } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/github-ci/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAmBhD,KAAK,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/github-ci/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAmBhD,KAAK,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAKpD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBtE;AAmFD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EA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AE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAGf;AAgCD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACrG,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
package/dist/github-ci/index.js
CHANGED
|
@@ -25,6 +25,8 @@ const parseNxProjectDeployConfigurations = (() => {
|
|
|
25
25
|
const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
26
26
|
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
27
27
|
})();
|
|
28
|
+
/** Nx workers = host cores (CI runners sized for full machine use). */
|
|
29
|
+
const NX_PARALLEL = '100%';
|
|
28
30
|
export async function cleanupGithubCiCache(root) {
|
|
29
31
|
const githubOutput = process.env.GITHUB_OUTPUT;
|
|
30
32
|
const markCacheReady = async (ready) => {
|
|
@@ -127,7 +129,7 @@ export function nxSmartArgs(target, mode, configuration) {
|
|
|
127
129
|
if (configuration) {
|
|
128
130
|
args.push(`--configuration=${configuration}`);
|
|
129
131
|
}
|
|
130
|
-
args.push(`--exclude=tag:ci:skip:${target}`,
|
|
132
|
+
args.push(`--exclude=tag:ci:skip:${target}`, `--parallel=${NX_PARALLEL}`);
|
|
131
133
|
return args;
|
|
132
134
|
}
|
|
133
135
|
export async function githubCiNxSmart(root, options) {
|
|
@@ -226,7 +228,7 @@ export function nxRunManyArgs(run, configuration) {
|
|
|
226
228
|
if (configuration) {
|
|
227
229
|
nxArgs.push(`--configuration=${configuration}`);
|
|
228
230
|
}
|
|
229
|
-
nxArgs.push(
|
|
231
|
+
nxArgs.push(`--parallel=${NX_PARALLEL}`);
|
|
230
232
|
return nxArgs;
|
|
231
233
|
}
|
|
232
234
|
export async function readGitHeadSha(root) {
|
|
@@ -291,7 +293,7 @@ export async function githubCiNxDeploy(root, options) {
|
|
|
291
293
|
const projectList = projects.join(',');
|
|
292
294
|
const targets = options.verify === true ? ['build', 'lint', 'test', 'deploy'] : ['deploy'];
|
|
293
295
|
for (const target of targets) {
|
|
294
|
-
const nxArgs = ['run-many', '-t', target, `--projects=${projectList}`,
|
|
296
|
+
const nxArgs = ['run-many', '-t', target, `--projects=${projectList}`, `--parallel=${NX_PARALLEL}`];
|
|
295
297
|
if (target === 'deploy') {
|
|
296
298
|
nxArgs.push(`--configuration=${options.configuration}`);
|
|
297
299
|
}
|
package/dist/lib/json.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface PackagePublishConfig {
|
|
|
16
16
|
}
|
|
17
17
|
export interface PackageSmooGithub {
|
|
18
18
|
pushBranches?: string[];
|
|
19
|
+
/** GitHub Actions runs-on for managed CI (string or label list). Default: ubuntu-latest. */
|
|
20
|
+
runsOn?: string | string[];
|
|
19
21
|
}
|
|
20
22
|
export interface PackageSmooConfig {
|
|
21
23
|
github?: PackageSmooGithub;
|
|
@@ -42,6 +44,8 @@ export interface PackageJson {
|
|
|
42
44
|
devDependencies?: StringMap;
|
|
43
45
|
peerDependencies?: StringMap;
|
|
44
46
|
optionalDependencies?: StringMap;
|
|
47
|
+
/** Bun patchedDependencies map (package@version → patch path). */
|
|
48
|
+
patchedDependencies?: StringMap;
|
|
45
49
|
engines?: StringMap;
|
|
46
50
|
scripts?: StringMap;
|
|
47
51
|
publishConfig?: PackagePublishConfig;
|
|
@@ -98,7 +102,7 @@ export declare function isPackageJson(value: unknown): value is PackageJson;
|
|
|
98
102
|
/** Ensure package.json.scripts exists. */
|
|
99
103
|
export declare function ensureScripts(pkg: PackageJson): StringMap;
|
|
100
104
|
/** Ensure package.json.dependencies (or other string-map dep field) exists. */
|
|
101
|
-
export declare function ensureDependencyMap(pkg: PackageJson, key: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies'): StringMap;
|
|
105
|
+
export declare function ensureDependencyMap(pkg: PackageJson, key: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies' | 'patchedDependencies'): StringMap;
|
|
102
106
|
/** Ensure package.json.engines exists. */
|
|
103
107
|
export declare function ensureEngines(pkg: PackageJson): StringMap;
|
|
104
108
|
/** Ensure package.json.nx exists. */
|
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":"AAGA,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/lib/json.ts"],"names":[],"mappings":"AAGA,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC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AO,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
|
@@ -16,13 +16,14 @@ export const parsePackageJsonText = (() => {
|
|
|
16
16
|
const _ip11 = (input, _vctx = {}) => undefined === input["devDependencies"] || "object" === typeof input["devDependencies"] && null !== input["devDependencies"] && false === Array.isArray(input["devDependencies"]) && _io1(input["devDependencies"], _vctx);
|
|
17
17
|
const _ip12 = (input, _vctx = {}) => undefined === input["peerDependencies"] || "object" === typeof input["peerDependencies"] && null !== input["peerDependencies"] && false === Array.isArray(input["peerDependencies"]) && _io1(input["peerDependencies"], _vctx);
|
|
18
18
|
const _ip13 = (input, _vctx = {}) => undefined === input["optionalDependencies"] || "object" === typeof input["optionalDependencies"] && null !== input["optionalDependencies"] && false === Array.isArray(input["optionalDependencies"]) && _io1(input["optionalDependencies"], _vctx);
|
|
19
|
-
const _ip14 = (input, _vctx = {}) => undefined === input["
|
|
20
|
-
const _ip15 = (input, _vctx = {}) => undefined === input["
|
|
21
|
-
const _ip16 = (input, _vctx = {}) => undefined === input["
|
|
22
|
-
const _ip17 = (input, _vctx = {}) =>
|
|
23
|
-
const _ip18 = (input, _vctx = {}) => undefined === input["
|
|
24
|
-
const _ip19 = (input, _vctx = {}) => undefined === input["
|
|
25
|
-
const
|
|
19
|
+
const _ip14 = (input, _vctx = {}) => undefined === input["patchedDependencies"] || "object" === typeof input["patchedDependencies"] && null !== input["patchedDependencies"] && false === Array.isArray(input["patchedDependencies"]) && _io1(input["patchedDependencies"], _vctx);
|
|
20
|
+
const _ip15 = (input, _vctx = {}) => undefined === input["engines"] || "object" === typeof input["engines"] && null !== input["engines"] && false === Array.isArray(input["engines"]) && _io1(input["engines"], _vctx);
|
|
21
|
+
const _ip16 = (input, _vctx = {}) => undefined === input["scripts"] || "object" === typeof input["scripts"] && null !== input["scripts"] && false === Array.isArray(input["scripts"]) && _io1(input["scripts"], _vctx);
|
|
22
|
+
const _ip17 = (input, _vctx = {}) => undefined === input["publishConfig"] || "object" === typeof input["publishConfig"] && null !== input["publishConfig"] && false === Array.isArray(input["publishConfig"]) && _io4(input["publishConfig"], _vctx);
|
|
23
|
+
const _ip18 = (input, _vctx = {}) => null !== input["repository"] && (undefined === input["repository"] || "string" === typeof input["repository"] || "object" === typeof input["repository"] && null !== input["repository"] && false === Array.isArray(input["repository"]) && _io5(input["repository"], _vctx));
|
|
24
|
+
const _ip19 = (input, _vctx = {}) => undefined === input["nx"] || "object" === typeof input["nx"] && null !== input["nx"] && false === Array.isArray(input["nx"]) && _io6(input["nx"], _vctx);
|
|
25
|
+
const _ip20 = (input, _vctx = {}) => undefined === input["smoo"] || "object" === typeof input["smoo"] && null !== input["smoo"] && false === Array.isArray(input["smoo"]) && _io12(input["smoo"], _vctx);
|
|
26
|
+
const _io0 = (input, _vctx = {}) => _ip0(input, _vctx) && _ip1(input, _vctx) && _ip2(input, _vctx) && _ip3(input, _vctx) && _ip4(input, _vctx) && _ip5(input, _vctx) && _ip6(input, _vctx) && _ip7(input, _vctx) && _ip8(input, _vctx) && _ip9(input, _vctx) && _ip10(input, _vctx) && _ip11(input, _vctx) && _ip12(input, _vctx) && _ip13(input, _vctx) && _ip14(input, _vctx) && _ip15(input, _vctx) && _ip16(input, _vctx) && _ip17(input, _vctx) && _ip18(input, _vctx) && _ip19(input, _vctx) && _ip20(input, _vctx);
|
|
26
27
|
const _io1 = (input, _vctx = {}) => Object.keys(input).every(key => {
|
|
27
28
|
const value = input[key];
|
|
28
29
|
if (undefined === value)
|
|
@@ -42,7 +43,7 @@ export const parsePackageJsonText = (() => {
|
|
|
42
43
|
return true;
|
|
43
44
|
});
|
|
44
45
|
const _io12 = (input, _vctx = {}) => undefined === input.github || "object" === typeof input.github && null !== input.github && false === Array.isArray(input.github) && _io13(input.github, _vctx);
|
|
45
|
-
const _io13 = (input, _vctx = {}) => undefined === input.pushBranches || Array.isArray(input.pushBranches) && input.pushBranches.every(elem => "string" === typeof elem);
|
|
46
|
+
const _io13 = (input, _vctx = {}) => (undefined === input.pushBranches || Array.isArray(input.pushBranches) && input.pushBranches.every(elem => "string" === typeof elem)) && (null !== input.runsOn && (undefined === input.runsOn || "string" === typeof input.runsOn || Array.isArray(input.runsOn) && input.runsOn.every(elem => "string" === typeof elem)));
|
|
46
47
|
const _io2 = (input, _vctx = {}) => (_vctx.io2 || (_vctx.io2 = new WeakSet())).has(input) ? true : (_vctx.io2.add(input), (Object.keys(input).every(key => {
|
|
47
48
|
const value = input[key];
|
|
48
49
|
if (undefined === value)
|
|
@@ -128,13 +129,14 @@ const isPackageJsonValue = (() => {
|
|
|
128
129
|
const _ip11 = (input, _vctx = {}) => undefined === input["devDependencies"] || "object" === typeof input["devDependencies"] && null !== input["devDependencies"] && false === Array.isArray(input["devDependencies"]) && _io1(input["devDependencies"], _vctx);
|
|
129
130
|
const _ip12 = (input, _vctx = {}) => undefined === input["peerDependencies"] || "object" === typeof input["peerDependencies"] && null !== input["peerDependencies"] && false === Array.isArray(input["peerDependencies"]) && _io1(input["peerDependencies"], _vctx);
|
|
130
131
|
const _ip13 = (input, _vctx = {}) => undefined === input["optionalDependencies"] || "object" === typeof input["optionalDependencies"] && null !== input["optionalDependencies"] && false === Array.isArray(input["optionalDependencies"]) && _io1(input["optionalDependencies"], _vctx);
|
|
131
|
-
const _ip14 = (input, _vctx = {}) => undefined === input["
|
|
132
|
-
const _ip15 = (input, _vctx = {}) => undefined === input["
|
|
133
|
-
const _ip16 = (input, _vctx = {}) => undefined === input["
|
|
134
|
-
const _ip17 = (input, _vctx = {}) =>
|
|
135
|
-
const _ip18 = (input, _vctx = {}) => undefined === input["
|
|
136
|
-
const _ip19 = (input, _vctx = {}) => undefined === input["
|
|
137
|
-
const
|
|
132
|
+
const _ip14 = (input, _vctx = {}) => undefined === input["patchedDependencies"] || "object" === typeof input["patchedDependencies"] && null !== input["patchedDependencies"] && false === Array.isArray(input["patchedDependencies"]) && _io1(input["patchedDependencies"], _vctx);
|
|
133
|
+
const _ip15 = (input, _vctx = {}) => undefined === input["engines"] || "object" === typeof input["engines"] && null !== input["engines"] && false === Array.isArray(input["engines"]) && _io1(input["engines"], _vctx);
|
|
134
|
+
const _ip16 = (input, _vctx = {}) => undefined === input["scripts"] || "object" === typeof input["scripts"] && null !== input["scripts"] && false === Array.isArray(input["scripts"]) && _io1(input["scripts"], _vctx);
|
|
135
|
+
const _ip17 = (input, _vctx = {}) => undefined === input["publishConfig"] || "object" === typeof input["publishConfig"] && null !== input["publishConfig"] && false === Array.isArray(input["publishConfig"]) && _io4(input["publishConfig"], _vctx);
|
|
136
|
+
const _ip18 = (input, _vctx = {}) => null !== input["repository"] && (undefined === input["repository"] || "string" === typeof input["repository"] || "object" === typeof input["repository"] && null !== input["repository"] && false === Array.isArray(input["repository"]) && _io5(input["repository"], _vctx));
|
|
137
|
+
const _ip19 = (input, _vctx = {}) => undefined === input["nx"] || "object" === typeof input["nx"] && null !== input["nx"] && false === Array.isArray(input["nx"]) && _io6(input["nx"], _vctx);
|
|
138
|
+
const _ip20 = (input, _vctx = {}) => undefined === input["smoo"] || "object" === typeof input["smoo"] && null !== input["smoo"] && false === Array.isArray(input["smoo"]) && _io12(input["smoo"], _vctx);
|
|
139
|
+
const _io0 = (input, _vctx = {}) => _ip0(input, _vctx) && _ip1(input, _vctx) && _ip2(input, _vctx) && _ip3(input, _vctx) && _ip4(input, _vctx) && _ip5(input, _vctx) && _ip6(input, _vctx) && _ip7(input, _vctx) && _ip8(input, _vctx) && _ip9(input, _vctx) && _ip10(input, _vctx) && _ip11(input, _vctx) && _ip12(input, _vctx) && _ip13(input, _vctx) && _ip14(input, _vctx) && _ip15(input, _vctx) && _ip16(input, _vctx) && _ip17(input, _vctx) && _ip18(input, _vctx) && _ip19(input, _vctx) && _ip20(input, _vctx);
|
|
138
140
|
const _io1 = (input, _vctx = {}) => Object.keys(input).every(key => {
|
|
139
141
|
const value = input[key];
|
|
140
142
|
if (undefined === value)
|
|
@@ -154,7 +156,7 @@ const isPackageJsonValue = (() => {
|
|
|
154
156
|
return true;
|
|
155
157
|
});
|
|
156
158
|
const _io12 = (input, _vctx = {}) => undefined === input.github || "object" === typeof input.github && null !== input.github && false === Array.isArray(input.github) && _io13(input.github, _vctx);
|
|
157
|
-
const _io13 = (input, _vctx = {}) => undefined === input.pushBranches || Array.isArray(input.pushBranches) && input.pushBranches.every(elem => "string" === typeof elem);
|
|
159
|
+
const _io13 = (input, _vctx = {}) => (undefined === input.pushBranches || Array.isArray(input.pushBranches) && input.pushBranches.every(elem => "string" === typeof elem)) && (null !== input.runsOn && (undefined === input.runsOn || "string" === typeof input.runsOn || Array.isArray(input.runsOn) && input.runsOn.every(elem => "string" === typeof elem)));
|
|
158
160
|
const _io2 = (input, _vctx = {}) => (_vctx.io2 || (_vctx.io2 = new WeakSet())).has(input) ? true : (_vctx.io2.add(input), (Object.keys(input).every(key => {
|
|
159
161
|
const value = input[key];
|
|
160
162
|
if (undefined === value)
|
|
@@ -22,6 +22,8 @@ export interface CiWorkflowDefinitionOptions {
|
|
|
22
22
|
deploy: boolean;
|
|
23
23
|
deployProvider?: 'cloudflare';
|
|
24
24
|
pushBranches: string[];
|
|
25
|
+
/** Default ubuntu-latest when omitted. */
|
|
26
|
+
runsOn?: string | string[];
|
|
25
27
|
}
|
|
26
28
|
export declare function defineCiWorkflow(options: CiWorkflowDefinitionOptions): CiWorkflowStep[];
|
|
27
29
|
export declare function renderCiWorkflowYaml(options: CiWorkflowDefinitionOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../src/monorepo/ci-workflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../src/monorepo/ci-workflow.ts"],"names":[],"mappings":"AAIA,oBAAY,kBAAkB;IAC5B,QAAQ,aAAa;IACrB,WAAW,iBAAiB;IAC5B,SAAS,gBAAgB;IACzB,cAAc,qBAAqB;IACnC,KAAK,UAAU;IACf,IAAI,SAAS;IACb,SAAS,eAAe;IACxB,iBAAiB,wBAAwB;IACzC,oBAAoB,2BAA2B;IAC/C,MAAM,WAAW;IACjB,WAAW,kBAAkB;IAC7B,cAAc,qBAAqB;IACnC,aAAa,oBAAoB;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,2BAA2B,GAAG,cAAc,EAAE,CAqBvF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAGjF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub Actions expressions are emitted literally. */
|
|
2
|
+
import { renderRunsOnLine } from './github-runs-on.js';
|
|
2
3
|
export var CiWorkflowStepKind;
|
|
3
4
|
(function (CiWorkflowStepKind) {
|
|
4
5
|
CiWorkflowStepKind["Checkout"] = "checkout";
|
|
@@ -59,7 +60,7 @@ defaults:
|
|
|
59
60
|
jobs:
|
|
60
61
|
main:
|
|
61
62
|
name: Validate
|
|
62
|
-
|
|
63
|
+
${renderRunsOnLine(options.runsOn)}
|
|
63
64
|
timeout-minutes: 45
|
|
64
65
|
env:
|
|
65
66
|
NIX_STORE_NAR: ${githubExpression('github.workspace')}/nix-store.nar
|
|
@@ -124,6 +125,8 @@ function yamlLinesForStep(step, options) {
|
|
|
124
125
|
' fetch-depth: 0',
|
|
125
126
|
];
|
|
126
127
|
case CiWorkflowStepKind.SetupDevenv:
|
|
128
|
+
// One step everywhere. setup-devenv detects host-nix (GARM) vs ephemeral
|
|
129
|
+
// and skips GH install/cache steps internally — same for ci/publish/managed.
|
|
127
130
|
return [` - name: ${step.name}`, ' id: setup', ' uses: ./.github/actions/setup-devenv'];
|
|
128
131
|
case CiWorkflowStepKind.SetNxShas:
|
|
129
132
|
return [
|
|
@@ -158,7 +161,7 @@ function yamlLinesForStep(step, options) {
|
|
|
158
161
|
// recursion guard, so the default token suffices.
|
|
159
162
|
return [
|
|
160
163
|
` - name: ${step.name}`,
|
|
161
|
-
" if:
|
|
164
|
+
" if: steps.managed-drift.outputs.drifted != '' && steps.managed-drift.outputs.drifted != '0'",
|
|
162
165
|
' run: gh workflow run managed-files.yml --ref "$GITHUB_REF_NAME"',
|
|
163
166
|
];
|
|
164
167
|
case CiWorkflowStepKind.Deploy:
|
|
@@ -186,7 +189,8 @@ function yamlLinesForStep(step, options) {
|
|
|
186
189
|
case CiWorkflowStepKind.UploadTraceDbs:
|
|
187
190
|
return [
|
|
188
191
|
` - name: ${step.name}`,
|
|
189
|
-
'
|
|
192
|
+
' # success() is the default; always() keeps traces after a red build/test.',
|
|
193
|
+
' if: always()',
|
|
190
194
|
' uses: actions/upload-artifact@v7.0.1',
|
|
191
195
|
' with:',
|
|
192
196
|
' name: trace-results-${{ github.run_id }}',
|
|
@@ -198,7 +202,9 @@ function yamlLinesForStep(step, options) {
|
|
|
198
202
|
case CiWorkflowStepKind.SaveNixDevenv:
|
|
199
203
|
return [
|
|
200
204
|
` - name: ${step.name}`,
|
|
201
|
-
'
|
|
205
|
+
' # always() still saves after a red job. Nix NAR is ephemeral-only;',
|
|
206
|
+
' # devenv eval-cache also saves on host-nix when setup missed.',
|
|
207
|
+
' if: always()',
|
|
202
208
|
' uses: ./.github/actions/save-nix-devenv',
|
|
203
209
|
' with:',
|
|
204
210
|
' nix-cache-hit: ${{ steps.setup.outputs.nix-cache-hit }}',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Shared `runs-on:` emission for generated GitHub workflow YAML. */
|
|
2
|
+
export type WorkflowRunsOn = string | string[] | undefined;
|
|
3
|
+
export declare function isNixosRunner(runsOn: WorkflowRunsOn): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Trusted jobs use configured nixos self-hosted labels; fork PRs stay on
|
|
6
|
+
* ubuntu-latest (no access to the private runner fleet).
|
|
7
|
+
*/
|
|
8
|
+
export declare function githubUsesNixosRunnerExpr(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Full ` runs-on: …` line(s), indented for a job under `jobs.<id>:`.
|
|
11
|
+
* Nixos labels emit the multiline prettier-stable fork-gate expression.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderRunsOnLine(runsOn: WorkflowRunsOn): string;
|
|
14
|
+
//# sourceMappingURL=github-runs-on.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-runs-on.d.ts","sourceRoot":"","sources":["../../src/monorepo/github-runs-on.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAE3D,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAG7D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAuB/D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Shared `runs-on:` emission for generated GitHub workflow YAML. */
|
|
2
|
+
export function isNixosRunner(runsOn) {
|
|
3
|
+
const labels = runsOn === undefined ? [] : typeof runsOn === 'string' ? [runsOn] : runsOn;
|
|
4
|
+
return labels.some((label) => label === 'nixos' || label.startsWith('nixos-'));
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Trusted jobs use configured nixos self-hosted labels; fork PRs stay on
|
|
8
|
+
* ubuntu-latest (no access to the private runner fleet).
|
|
9
|
+
*/
|
|
10
|
+
export function githubUsesNixosRunnerExpr() {
|
|
11
|
+
return "(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Full ` runs-on: …` line(s), indented for a job under `jobs.<id>:`.
|
|
15
|
+
* Nixos labels emit the multiline prettier-stable fork-gate expression.
|
|
16
|
+
*/
|
|
17
|
+
export function renderRunsOnLine(runsOn) {
|
|
18
|
+
if (!isNixosRunner(runsOn)) {
|
|
19
|
+
let value;
|
|
20
|
+
if (runsOn === undefined) {
|
|
21
|
+
value = 'ubuntu-latest';
|
|
22
|
+
}
|
|
23
|
+
else if (typeof runsOn === 'string') {
|
|
24
|
+
value = runsOn.length > 0 ? runsOn : 'ubuntu-latest';
|
|
25
|
+
}
|
|
26
|
+
else if (runsOn.length === 0) {
|
|
27
|
+
value = 'ubuntu-latest';
|
|
28
|
+
}
|
|
29
|
+
else if (runsOn.length === 1) {
|
|
30
|
+
value = runsOn[0] ?? 'ubuntu-latest';
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
value = `[${runsOn.map((label) => `'${label}'`).join(', ')}]`;
|
|
34
|
+
}
|
|
35
|
+
return ` runs-on: ${value}`;
|
|
36
|
+
}
|
|
37
|
+
const labels = typeof runsOn === 'string' ? [runsOn] : runsOn;
|
|
38
|
+
// Multiline matches prettier so checked-in workflows stay byte-identical.
|
|
39
|
+
const nixosJson = JSON.stringify(labels);
|
|
40
|
+
return ` runs-on:
|
|
41
|
+
\${{ ${githubUsesNixosRunnerExpr()} &&
|
|
42
|
+
fromJSON('${nixosJson}') || 'ubuntu-latest' }}`;
|
|
43
|
+
}
|
package/dist/monorepo/index.d.ts
CHANGED
|
@@ -30,11 +30,11 @@ export interface SetupTestTracingShell {
|
|
|
30
30
|
}
|
|
31
31
|
export declare function initMonorepo(root: string, options: InitOptions): Promise<void>;
|
|
32
32
|
export declare function validateMonorepo(root: string, options?: ValidateOptions): Promise<void>;
|
|
33
|
-
export declare function updateManagedFiles(root: string): void
|
|
33
|
+
export declare function updateManagedFiles(root: string): Promise<void>;
|
|
34
34
|
export declare function checkManagedFiles(root: string, options?: {
|
|
35
35
|
warn?: boolean;
|
|
36
|
-
}): void
|
|
37
|
-
export declare function diffManagedFiles(root: string): void
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
export declare function diffManagedFiles(root: string): Promise<void>;
|
|
38
38
|
export declare function validateCommitMessageFile(path: string | undefined, options?: ValidateCommitMessageOptions, root?: string): void;
|
|
39
39
|
export declare function listReleaseProjectNamesForNx(root: string, options?: ListReleasePackagesOptions): string;
|
|
40
40
|
export declare function validatePublicPackageTags(root: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monorepo/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monorepo/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAOxD,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OA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AgB,GACnB,IAAI,CAgBN;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,0BAA+B,GAAG,MAAM,CAW3G;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI5D;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,uBAAuB,EAChC,KAAK,GAAE,qBAAoD,GAC1D,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,CAAC"}
|
package/dist/monorepo/index.js
CHANGED
|
@@ -9,12 +9,13 @@ import { applyManagedFiles, printResults, warnOnManagedFileDrift } from './manag
|
|
|
9
9
|
import { listValidCommitScopes, validatePublicTags } from './package-policy.js';
|
|
10
10
|
import { runInitPacks, runValidatePacks } from './packs/index.js';
|
|
11
11
|
import { syncRootRuntimeVersions } from './runtime.js';
|
|
12
|
+
import { applyToolConfigDefaults } from './tool-validation.js';
|
|
12
13
|
export async function initMonorepo(root, options) {
|
|
13
14
|
if (options.runtimeOnly) {
|
|
14
15
|
await syncRootRuntimeVersions(root);
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
printResults(applyManagedFiles(root, 'update'));
|
|
18
|
+
printResults(await applyManagedFiles(root, 'update'));
|
|
18
19
|
await runInitPacks({ root, syncRuntime: process.env.DEVENV_ROOT !== undefined || options.syncRuntime === true });
|
|
19
20
|
}
|
|
20
21
|
export async function validateMonorepo(root, options = {}) {
|
|
@@ -35,22 +36,33 @@ export async function validateMonorepo(root, options = {}) {
|
|
|
35
36
|
console.log('🟢 Monorepo configuration is valid.');
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
export function updateManagedFiles(root) {
|
|
39
|
-
printResults(applyManagedFiles(root, 'update'));
|
|
39
|
+
export async function updateManagedFiles(root) {
|
|
40
|
+
printResults(await applyManagedFiles(root, 'update'));
|
|
41
|
+
// Tool dependency policy (typescript API 6, @typescript/native for ttsc, nx, …)
|
|
42
|
+
// lives next to managed templates — update must install them, not only rewrite files.
|
|
43
|
+
await applyToolConfigDefaults(root);
|
|
44
|
+
syncBunLockfileVersions(root, { mode: 'install' });
|
|
45
|
+
console.log('installing workspace dependencies (bun install)');
|
|
46
|
+
const install = await $ `bun install --no-summary`.cwd(root).nothrow();
|
|
47
|
+
if (install.exitCode !== 0) {
|
|
48
|
+
const stderr = decode(install.stderr).trim();
|
|
49
|
+
const stdout = decode(install.stdout).trim();
|
|
50
|
+
throw new Error(`bun install failed after monorepo update${stderr || stdout ? `:\n${stderr || stdout}` : ''}`);
|
|
51
|
+
}
|
|
40
52
|
}
|
|
41
|
-
export function checkManagedFiles(root, options = {}) {
|
|
53
|
+
export async function checkManagedFiles(root, options = {}) {
|
|
42
54
|
if (options.warn === true) {
|
|
43
|
-
warnOnManagedFileDrift(root);
|
|
55
|
+
await warnOnManagedFileDrift(root);
|
|
44
56
|
return;
|
|
45
57
|
}
|
|
46
|
-
const results = applyManagedFiles(root, 'check');
|
|
58
|
+
const results = await applyManagedFiles(root, 'check');
|
|
47
59
|
printResults(results);
|
|
48
60
|
if (results.some((result) => result.action === 'drifted')) {
|
|
49
61
|
throw new Error('Managed monorepo files are out of date. Run: smoo monorepo update');
|
|
50
62
|
}
|
|
51
63
|
}
|
|
52
|
-
export function diffManagedFiles(root) {
|
|
53
|
-
printResults(applyManagedFiles(root, 'diff'));
|
|
64
|
+
export async function diffManagedFiles(root) {
|
|
65
|
+
printResults(await applyManagedFiles(root, 'diff'));
|
|
54
66
|
}
|
|
55
67
|
export function validateCommitMessageFile(path, options = {}, root = process.cwd()) {
|
|
56
68
|
if (!path) {
|
|
@@ -3,9 +3,10 @@ export interface SyncBunLockfileVersionsOptions {
|
|
|
3
3
|
/** `git add` bun.lock when versions were resynced. */
|
|
4
4
|
stage?: boolean;
|
|
5
5
|
/**
|
|
6
|
-
* `install` (default
|
|
6
|
+
* `install` (default): lockfile must match package.json (including -next).
|
|
7
7
|
* `publish`: rewrite unpublished prerelease package.json versions to the last
|
|
8
8
|
* stable git tag so `bun pm pack` embeds installable dependency versions.
|
|
9
|
+
* Only use publish mode around pack; never leave the tree in publish mode.
|
|
9
10
|
*/
|
|
10
11
|
mode?: 'install' | 'publish';
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../../src/monorepo/lockfile.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB
|
|
1
|
+
{"version":3,"file":"lockfile.d.ts","sourceRoot":"","sources":["../../src/monorepo/lockfile.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC9B;AAmBD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,8BAAmC,GAAG,MAAM,CAqD1G;AAED,4EAA4E;AAC5E,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BhE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE9G"}
|
|
@@ -21,7 +21,7 @@ import { escapeRegex, getWorkspacePackages } from '../lib/workspace.js';
|
|
|
21
21
|
// rewrites lockfile back to package.json and frozen CI then fails.
|
|
22
22
|
export function syncBunLockfileVersions(root, options = {}) {
|
|
23
23
|
const log = options.log ?? true;
|
|
24
|
-
const mode = options.mode ?? '
|
|
24
|
+
const mode = options.mode ?? 'install';
|
|
25
25
|
const lockfilePath = join(root, 'bun.lock');
|
|
26
26
|
if (!existsSync(lockfilePath)) {
|
|
27
27
|
throw new Error('bun.lock not found');
|
|
@@ -47,10 +47,37 @@ export interface FileResult {
|
|
|
47
47
|
target: string;
|
|
48
48
|
action: 'created' | 'updated' | 'unchanged' | 'skipped' | 'skipped-symlink' | 'drifted' | 'ok-symlink';
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
interface DeployTargetInfo {
|
|
51
|
+
exists: boolean;
|
|
52
|
+
provider?: 'cloudflare';
|
|
53
|
+
}
|
|
54
|
+
export declare function applyManagedFiles(root: string, mode: 'update' | 'check' | 'diff'): Promise<FileResult[]>;
|
|
51
55
|
export declare function platformTargetGlobsForTest(targetNames: Iterable<string>): string[];
|
|
56
|
+
/** Resolved Nx project node as returned under `graph.nodes` / project-graph.json. */
|
|
57
|
+
export type NxGraphProjectNode = {
|
|
58
|
+
data?: {
|
|
59
|
+
targets?: Record<string, NxGraphTarget>;
|
|
60
|
+
};
|
|
61
|
+
targets?: Record<string, NxGraphTarget>;
|
|
62
|
+
};
|
|
63
|
+
type NxGraphTarget = {
|
|
64
|
+
command?: string;
|
|
65
|
+
options?: {
|
|
66
|
+
command?: string;
|
|
67
|
+
};
|
|
68
|
+
configurations?: Record<string, {
|
|
69
|
+
command?: string;
|
|
70
|
+
options?: {
|
|
71
|
+
command?: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
/** Test seam: collect target names from a graph.nodes map. */
|
|
76
|
+
export declare function targetNamesFromProjects(nodes: Record<string, NxGraphProjectNode>): string[];
|
|
77
|
+
/** Test seam: deploy configuration presence/provider from graph nodes. */
|
|
78
|
+
export declare function deployTargetInfoFromProjects(nodes: Record<string, NxGraphProjectNode>, configuration: string): DeployTargetInfo;
|
|
52
79
|
export declare function printResults(results: FileResult[]): void;
|
|
53
|
-
export declare function validateManagedFiles(root: string): number
|
|
80
|
+
export declare function validateManagedFiles(root: string): Promise<number>;
|
|
54
81
|
/**
|
|
55
82
|
* Non-blocking drift report: prints the per-file table and surfaces drift as
|
|
56
83
|
* GitHub Actions warning annotations (plain stderr elsewhere) without failing
|
|
@@ -61,6 +88,6 @@ export declare function validateManagedFiles(root: string): number;
|
|
|
61
88
|
* Under GitHub Actions the drifted-file count is published as the step output
|
|
62
89
|
* `drifted`, so downstream steps gate declaratively instead of parsing logs.
|
|
63
90
|
*/
|
|
64
|
-
export declare function warnOnManagedFileDrift(root: string): void
|
|
91
|
+
export declare function warnOnManagedFileDrift(root: string): Promise<void>;
|
|
65
92
|
export {};
|
|
66
93
|
//# sourceMappingURL=managed-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managed-files.d.ts","sourceRoot":"","sources":["../../src/monorepo/managed-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"managed-files.d.ts","sourceRoot":"","sources":["../../src/monorepo/managed-files.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,yEAAyE,CAAC;AAU3G,sFAAsF;AACtF,iBAAS,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAIlF;AAED,uCAAuC;AACvC,eAAO,MAAM,wBAAwB,0BAAoB,CAAC;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;8BAE8B;AAC9B,iBAAS,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,EAAE,CAAA;CAAE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