@smoothbricks/nx-plugin 0.4.15 → 0.4.16
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 +17 -0
- package/dist/deploy-policy.d.ts +26 -0
- package/dist/deploy-policy.d.ts.map +1 -0
- package/dist/deploy-policy.js +36 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +153 -14
- package/dist/managed-assets.d.ts +3 -0
- package/dist/managed-assets.d.ts.map +1 -0
- package/dist/managed-assets.js +3 -0
- package/dist/managed-files/ci-workflow.d.ts +215 -0
- package/dist/managed-files/ci-workflow.d.ts.map +1 -0
- package/dist/managed-files/ci-workflow.js +1082 -0
- package/dist/managed-files/context.d.ts +51 -0
- package/dist/managed-files/context.d.ts.map +1 -0
- package/dist/managed-files/context.js +206 -0
- package/dist/managed-files/files.d.ts +53 -0
- package/dist/managed-files/files.d.ts.map +1 -0
- package/dist/managed-files/files.js +248 -0
- package/dist/managed-files/generator.d.ts +16 -0
- package/dist/managed-files/generator.d.ts.map +1 -0
- package/dist/managed-files/generator.js +41 -0
- package/dist/managed-files/github-runs-on.d.ts +19 -0
- package/dist/managed-files/github-runs-on.d.ts.map +1 -0
- package/dist/managed-files/github-runs-on.js +48 -0
- package/dist/managed-files/managed-content.d.ts +45 -0
- package/dist/managed-files/managed-content.d.ts.map +1 -0
- package/dist/managed-files/managed-content.js +102 -0
- package/dist/managed-files/managed-format.d.ts +37 -0
- package/dist/managed-files/managed-format.d.ts.map +1 -0
- package/dist/managed-files/managed-format.js +94 -0
- package/dist/managed-files/paths.d.ts +8 -0
- package/dist/managed-files/paths.d.ts.map +1 -0
- package/dist/managed-files/paths.js +46 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +5 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.js +38 -0
- package/dist/managed-files/private-npm-policy.d.ts +7 -0
- package/dist/managed-files/private-npm-policy.d.ts.map +1 -0
- package/dist/managed-files/private-npm-policy.js +51 -0
- package/dist/managed-files/publish-workflow.d.ts +150 -0
- package/dist/managed-files/publish-workflow.d.ts.map +1 -0
- package/dist/managed-files/publish-workflow.js +989 -0
- package/dist/managed-files/tree.d.ts +30 -0
- package/dist/managed-files/tree.d.ts.map +1 -0
- package/dist/managed-files/tree.js +91 -0
- package/dist/platform-targets.d.ts +5 -0
- package/dist/platform-targets.d.ts.map +1 -0
- package/dist/platform-targets.js +4 -0
- package/dist/typecheck-test-policy.d.ts +5 -9
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +69 -99
- package/dist/workspace-config-policy.d.ts +2 -3
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +8 -3
- package/dist/workspace-manifest.d.ts +291 -0
- package/dist/workspace-manifest.d.ts.map +1 -0
- package/dist/workspace-manifest.js +6 -0
- package/dist/workspace-package-policy.d.ts +13 -0
- package/dist/workspace-package-policy.d.ts.map +1 -0
- package/dist/workspace-package-policy.js +24 -0
- package/generators.json +5 -0
- package/managed/raw/envrc +20 -0
- package/managed/raw/git-format-staged.yml +82 -0
- package/managed/raw/gitattributes +8 -0
- package/managed/raw/tooling/devenv +83 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +422 -0
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +251 -0
- package/managed/raw/tooling/direnv/merge-newer-pins.sh +48 -0
- package/managed/raw/tooling/direnv/repo-path +34 -0
- package/managed/raw/tooling/direnv/secret-references.ts +636 -0
- package/managed/raw/tooling/direnv/setup-environment.ts +585 -0
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +88 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +9 -0
- package/managed/raw/tooling/git-hooks/post-commit.sh +71 -0
- package/managed/raw/tooling/git-hooks/pre-commit.sh +18 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +48 -0
- package/managed/raw/tsconfig.lib.json +28 -0
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +45 -0
- package/managed/templates/github/actions/cache-node-modules/action.yml +17 -0
- package/managed/templates/github/actions/cache-nx/action.yml +21 -0
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +19 -0
- package/managed/templates/github/actions/save-nix-devenv/action.yml +32 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +241 -0
- package/managed/templates/github/workflows/managed-files.yml +127 -0
- package/package.json +89 -5
- package/src/bun-bootstrap.test.ts +0 -6
- package/src/deploy-policy.ts +40 -0
- package/src/index.test.ts +225 -2
- package/src/index.ts +180 -14
- package/src/managed-assets.ts +4 -0
- package/src/managed-files/ci-workflow.ts +1365 -0
- package/src/managed-files/context.ts +240 -0
- package/src/managed-files/files.ts +324 -0
- package/src/managed-files/generator.test.ts +151 -0
- package/src/managed-files/generator.ts +60 -0
- package/src/managed-files/github-runs-on.ts +51 -0
- package/src/managed-files/managed-content.test.ts +147 -0
- package/src/managed-files/managed-content.ts +121 -0
- package/src/managed-files/managed-format.ts +102 -0
- package/src/managed-files/paths.ts +44 -0
- package/src/managed-files/pr-preview-cleanup-workflow.ts +44 -0
- package/src/managed-files/private-npm-policy.ts +62 -0
- package/src/managed-files/publish-workflow.ts +1523 -0
- package/src/managed-files/schema.json +8 -0
- package/src/managed-files/tree-permissions.test.ts +109 -0
- package/src/managed-files/tree.test.ts +123 -0
- package/src/managed-files/tree.ts +118 -0
- package/src/platform-targets.ts +4 -0
- package/src/typecheck-test-policy.test.ts +28 -3
- package/src/typecheck-test-policy.ts +46 -121
- package/src/workspace-config-policy.test.ts +14 -2
- package/src/workspace-config-policy.ts +9 -3
- package/src/workspace-manifest.ts +327 -0
- package/src/workspace-package-policy.ts +32 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Shared `runs-on:` emission for generated GitHub workflow YAML. */
|
|
2
|
+
/**
|
|
3
|
+
* The GitHub-hosted Linux runner. Also the fork-PR fallback of every gated
|
|
4
|
+
* self-hosted label, and the only runner class npmjs accepts provenance from.
|
|
5
|
+
*/
|
|
6
|
+
export const GITHUB_HOSTED_LINUX_RUNNER = 'ubuntu-latest';
|
|
7
|
+
export function isNixosRunner(runsOn) {
|
|
8
|
+
const labels = runsOn === undefined ? [] : typeof runsOn === 'string' ? [runsOn] : runsOn;
|
|
9
|
+
return labels.some((label) => label === 'nixos' || label.startsWith('nixos-'));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Trusted jobs use configured nixos self-hosted labels; fork PRs stay on
|
|
13
|
+
* ubuntu-latest (no access to the private runner fleet).
|
|
14
|
+
*/
|
|
15
|
+
export function githubUsesNixosRunnerExpr() {
|
|
16
|
+
return "(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Full ` runs-on: …` line(s), indented for a job under `jobs.<id>:`.
|
|
20
|
+
* Nixos labels emit the multiline prettier-stable fork-gate expression.
|
|
21
|
+
*/
|
|
22
|
+
export function renderRunsOnLine(runsOn) {
|
|
23
|
+
if (!isNixosRunner(runsOn)) {
|
|
24
|
+
let value;
|
|
25
|
+
if (runsOn === undefined) {
|
|
26
|
+
value = 'ubuntu-latest';
|
|
27
|
+
}
|
|
28
|
+
else if (typeof runsOn === 'string') {
|
|
29
|
+
value = runsOn.length > 0 ? runsOn : 'ubuntu-latest';
|
|
30
|
+
}
|
|
31
|
+
else if (runsOn.length === 0) {
|
|
32
|
+
value = 'ubuntu-latest';
|
|
33
|
+
}
|
|
34
|
+
else if (runsOn.length === 1) {
|
|
35
|
+
value = runsOn[0] ?? 'ubuntu-latest';
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
value = `[${runsOn.map((label) => `'${label}'`).join(', ')}]`;
|
|
39
|
+
}
|
|
40
|
+
return ` runs-on: ${value}`;
|
|
41
|
+
}
|
|
42
|
+
const labels = typeof runsOn === 'string' ? [runsOn] : runsOn;
|
|
43
|
+
// Multiline matches prettier so checked-in workflows stay byte-identical.
|
|
44
|
+
const nixosJson = JSON.stringify(labels);
|
|
45
|
+
return ` runs-on:
|
|
46
|
+
\${{ ${githubUsesNixosRunnerExpr()} &&
|
|
47
|
+
fromJSON('${nixosJson}') || 'ubuntu-latest' }}`;
|
|
48
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Content ownership policy. No filesystem, process, environment or Nx dependencies. */
|
|
2
|
+
export declare class ManagedContentConflict extends Error {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Repos may append their own content to a managed file below this marker —
|
|
6
|
+
* e.g. extra merge drivers in .gitattributes. Everything from the marker
|
|
7
|
+
* line onward is preserved verbatim across updates and ignored by the
|
|
8
|
+
* drift check; the managed section above it stays byte-exact.
|
|
9
|
+
*/
|
|
10
|
+
export declare const LOCAL_SECTION_MARKER = "# smoo-local: everything below this line is repo-owned and preserved";
|
|
11
|
+
/** Split a managed target's content into the managed part and the repo-owned tail. */
|
|
12
|
+
export declare function splitLocalSection(current: string): {
|
|
13
|
+
managed: string;
|
|
14
|
+
localTail: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A repo-owned block INSIDE the managed section — e.g. one extra pattern
|
|
18
|
+
* spliced into a formatter's list, where a trailing marker (LOCAL_SECTION_MARKER)
|
|
19
|
+
* can't express it because it isn't at the end of the file. Wrap it in
|
|
20
|
+
* `# smoo-local-begin` / `# smoo-local-end`; the block is anchored to the line
|
|
21
|
+
* immediately before `# smoo-local-begin`. On update, the block is re-spliced
|
|
22
|
+
* right after that same anchor line in the freshly rendered template — if the
|
|
23
|
+
* anchor no longer appears there (the template reworked that section), the
|
|
24
|
+
* update refuses rather than silently dropping the repo's customization.
|
|
25
|
+
*/
|
|
26
|
+
export declare const INLINE_LOCAL_BEGIN = "# smoo-local-begin";
|
|
27
|
+
export declare const INLINE_LOCAL_END = "# smoo-local-end";
|
|
28
|
+
export interface InlineLocalBlock {
|
|
29
|
+
anchor: string;
|
|
30
|
+
lines: string;
|
|
31
|
+
markerIndent?: string;
|
|
32
|
+
/** Distinguishes no lines from one deliberately blank line. */
|
|
33
|
+
empty?: true;
|
|
34
|
+
}
|
|
35
|
+
/** Pull inline local blocks out of a managed section, returning the section
|
|
36
|
+
* with each block (and its markers) removed, plus the extracted blocks in
|
|
37
|
+
* the order they appeared. */
|
|
38
|
+
export declare function extractInlineLocalBlocks(managed: string): {
|
|
39
|
+
withoutInline: string;
|
|
40
|
+
blocks: InlineLocalBlock[];
|
|
41
|
+
};
|
|
42
|
+
/** Re-splice extracted inline blocks into freshly rendered managed content,
|
|
43
|
+
* each immediately after its anchor line. A no-op when there are no blocks. */
|
|
44
|
+
export declare function reinsertInlineLocalBlocks(content: string, blocks: InlineLocalBlock[]): string;
|
|
45
|
+
//# sourceMappingURL=managed-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-content.d.ts","sourceRoot":"","sources":["../../src/managed-files/managed-content.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,qBAAa,sBAAuB,SAAQ,KAAK;CAAG;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,yEAAyE,CAAC;AAE3G,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAUzF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED;;8BAE8B;AAC9B,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,EAAE,CAAA;CAAE,CA4C/G;AAED;+EAC+E;AAC/E,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAwB7F"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Content ownership policy. No filesystem, process, environment or Nx dependencies. */
|
|
2
|
+
export class ManagedContentConflict extends Error {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Repos may append their own content to a managed file below this marker —
|
|
6
|
+
* e.g. extra merge drivers in .gitattributes. Everything from the marker
|
|
7
|
+
* line onward is preserved verbatim across updates and ignored by the
|
|
8
|
+
* drift check; the managed section above it stays byte-exact.
|
|
9
|
+
*/
|
|
10
|
+
export const LOCAL_SECTION_MARKER = '# smoo-local: everything below this line is repo-owned and preserved';
|
|
11
|
+
/** Split a managed target's content into the managed part and the repo-owned tail. */
|
|
12
|
+
export function splitLocalSection(current) {
|
|
13
|
+
// A marker mentioned inside a value or comment is not an ownership boundary.
|
|
14
|
+
let offset = 0;
|
|
15
|
+
for (const line of current.split('\n')) {
|
|
16
|
+
if (line.replace(/\r$/, '') === LOCAL_SECTION_MARKER) {
|
|
17
|
+
return { managed: current.slice(0, offset), localTail: current.slice(offset) };
|
|
18
|
+
}
|
|
19
|
+
offset += line.length + 1;
|
|
20
|
+
}
|
|
21
|
+
return { managed: current, localTail: '' };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A repo-owned block INSIDE the managed section — e.g. one extra pattern
|
|
25
|
+
* spliced into a formatter's list, where a trailing marker (LOCAL_SECTION_MARKER)
|
|
26
|
+
* can't express it because it isn't at the end of the file. Wrap it in
|
|
27
|
+
* `# smoo-local-begin` / `# smoo-local-end`; the block is anchored to the line
|
|
28
|
+
* immediately before `# smoo-local-begin`. On update, the block is re-spliced
|
|
29
|
+
* right after that same anchor line in the freshly rendered template — if the
|
|
30
|
+
* anchor no longer appears there (the template reworked that section), the
|
|
31
|
+
* update refuses rather than silently dropping the repo's customization.
|
|
32
|
+
*/
|
|
33
|
+
export const INLINE_LOCAL_BEGIN = '# smoo-local-begin';
|
|
34
|
+
export const INLINE_LOCAL_END = '# smoo-local-end';
|
|
35
|
+
/** Pull inline local blocks out of a managed section, returning the section
|
|
36
|
+
* with each block (and its markers) removed, plus the extracted blocks in
|
|
37
|
+
* the order they appeared. */
|
|
38
|
+
export function extractInlineLocalBlocks(managed) {
|
|
39
|
+
const lines = managed.split('\n');
|
|
40
|
+
const kept = [];
|
|
41
|
+
const blocks = [];
|
|
42
|
+
let i = 0;
|
|
43
|
+
while (i < lines.length) {
|
|
44
|
+
const line = lines[i];
|
|
45
|
+
if (line !== undefined && line.trim() === INLINE_LOCAL_BEGIN) {
|
|
46
|
+
const anchor = kept.at(-1);
|
|
47
|
+
if (anchor === undefined) {
|
|
48
|
+
throw new ManagedContentConflict(`${INLINE_LOCAL_BEGIN} on line ${i + 1} has no preceding anchor line`);
|
|
49
|
+
}
|
|
50
|
+
const blockLines = [];
|
|
51
|
+
i += 1;
|
|
52
|
+
while (i < lines.length && lines[i]?.trim() !== INLINE_LOCAL_END) {
|
|
53
|
+
const blockLine = lines[i];
|
|
54
|
+
if (blockLine.trim() === INLINE_LOCAL_BEGIN) {
|
|
55
|
+
throw new ManagedContentConflict(`${INLINE_LOCAL_BEGIN} on line ${i + 1} is nested`);
|
|
56
|
+
}
|
|
57
|
+
blockLines.push(blockLine);
|
|
58
|
+
i += 1;
|
|
59
|
+
}
|
|
60
|
+
if (i >= lines.length) {
|
|
61
|
+
throw new ManagedContentConflict(`${INLINE_LOCAL_BEGIN} anchored on "${anchor}" has no matching ${INLINE_LOCAL_END}`);
|
|
62
|
+
}
|
|
63
|
+
const markerIndent = line.slice(0, line.length - line.trimStart().length);
|
|
64
|
+
blocks.push({
|
|
65
|
+
anchor,
|
|
66
|
+
lines: blockLines.join('\n'),
|
|
67
|
+
...(blockLines.length === 0 ? { empty: true } : {}),
|
|
68
|
+
...(markerIndent === '' ? {} : { markerIndent }),
|
|
69
|
+
});
|
|
70
|
+
i += 1; // skip the END marker line itself
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (line.trim() === INLINE_LOCAL_END) {
|
|
74
|
+
throw new ManagedContentConflict(`${INLINE_LOCAL_END} on line ${i + 1} has no matching ${INLINE_LOCAL_BEGIN}`);
|
|
75
|
+
}
|
|
76
|
+
kept.push(line);
|
|
77
|
+
i += 1;
|
|
78
|
+
}
|
|
79
|
+
return { withoutInline: kept.join('\n'), blocks };
|
|
80
|
+
}
|
|
81
|
+
/** Re-splice extracted inline blocks into freshly rendered managed content,
|
|
82
|
+
* each immediately after its anchor line. A no-op when there are no blocks. */
|
|
83
|
+
export function reinsertInlineLocalBlocks(content, blocks) {
|
|
84
|
+
if (blocks.length === 0)
|
|
85
|
+
return content;
|
|
86
|
+
const lines = content.split('\n');
|
|
87
|
+
const additions = new Map();
|
|
88
|
+
for (const block of blocks) {
|
|
89
|
+
const matches = lines.flatMap((line, index) => (line === block.anchor ? [index] : []));
|
|
90
|
+
if (matches.length !== 1) {
|
|
91
|
+
const reason = matches.length === 0 ? 'no line' : `${matches.length} lines`;
|
|
92
|
+
throw new ManagedContentConflict(`${INLINE_LOCAL_BEGIN} block anchored on "${block.anchor}" matches ${reason} in the updated ` +
|
|
93
|
+
'template — reconcile the repo-owned block manually');
|
|
94
|
+
}
|
|
95
|
+
const index = matches[0];
|
|
96
|
+
const markerIndent = block.markerIndent ?? '';
|
|
97
|
+
const inserted = additions.get(index) ?? [];
|
|
98
|
+
inserted.push(`${markerIndent}${INLINE_LOCAL_BEGIN}`, ...(block.empty ? [] : block.lines.split('\n')), `${markerIndent}${INLINE_LOCAL_END}`);
|
|
99
|
+
additions.set(index, inserted);
|
|
100
|
+
}
|
|
101
|
+
return lines.flatMap((line, index) => [line, ...(additions.get(index) ?? [])]).join('\n');
|
|
102
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extensions the managed `.git-format-staged.yml` routes to Biome rather than
|
|
3
|
+
* Prettier. Prettier has a parser for every one of them, so they have to be
|
|
4
|
+
* named: running Prettier over them here would fight the commit hook instead
|
|
5
|
+
* of agreeing with it, which is the failure this module exists to remove.
|
|
6
|
+
*
|
|
7
|
+
* Everything Prettier cannot parse — `.nix` (Alejandra), `.rs` (rustfmt),
|
|
8
|
+
* `.sh`, `.envrc`, `.gitattributes` — needs no entry: Prettier infers no
|
|
9
|
+
* parser and the content passes through untouched, exactly as
|
|
10
|
+
* `prettier --ignore-unknown` leaves it in the hook.
|
|
11
|
+
*
|
|
12
|
+
* `managed-format.test.ts` pins this list to that config.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BIOME_OWNED_EXTENSIONS: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* The bytes a managed target has *after* the consuming repository's commit
|
|
17
|
+
* hook has had its say.
|
|
18
|
+
*
|
|
19
|
+
* `smoo monorepo update` writes into a repository whose hook
|
|
20
|
+
* (`.git-format-staged.yml`) reformats whatever it stages. Writing the
|
|
21
|
+
* generator's own idea of formatting there means the hook rewrites the file on
|
|
22
|
+
* the next commit, the next `update` writes the generator's version back, and
|
|
23
|
+
* the drift check reports a difference forever — on a tree where nothing
|
|
24
|
+
* meaningful changed. A warning that is always on is a warning nobody reads,
|
|
25
|
+
* and it hides the real drift underneath it.
|
|
26
|
+
*
|
|
27
|
+
* So the writer renders into the consumer's own formatting space, using the
|
|
28
|
+
* config Prettier resolves for *this* path in *this* repository: overrides,
|
|
29
|
+
* `.editorconfig` and ignore files included. The written bytes are then a
|
|
30
|
+
* fixed point of the hook, `update` is idempotent, and `check` reports only
|
|
31
|
+
* differences that are real.
|
|
32
|
+
*
|
|
33
|
+
* A consumer's formatter config is the consumer's business. This reads it and
|
|
34
|
+
* obeys; it never asks the repository to change it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatManagedContent(root: string, target: string, content: string): Promise<string>;
|
|
37
|
+
//# sourceMappingURL=managed-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-format.d.ts","sourceRoot":"","sources":["../../src/managed-files/managed-format.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAcnD,CAAC;AAoBF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BzG"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* Extensions the managed `.git-format-staged.yml` routes to Biome rather than
|
|
4
|
+
* Prettier. Prettier has a parser for every one of them, so they have to be
|
|
5
|
+
* named: running Prettier over them here would fight the commit hook instead
|
|
6
|
+
* of agreeing with it, which is the failure this module exists to remove.
|
|
7
|
+
*
|
|
8
|
+
* Everything Prettier cannot parse — `.nix` (Alejandra), `.rs` (rustfmt),
|
|
9
|
+
* `.sh`, `.envrc`, `.gitattributes` — needs no entry: Prettier infers no
|
|
10
|
+
* parser and the content passes through untouched, exactly as
|
|
11
|
+
* `prettier --ignore-unknown` leaves it in the hook.
|
|
12
|
+
*
|
|
13
|
+
* `managed-format.test.ts` pins this list to that config.
|
|
14
|
+
*/
|
|
15
|
+
export const BIOME_OWNED_EXTENSIONS = [
|
|
16
|
+
'.js',
|
|
17
|
+
'.cjs',
|
|
18
|
+
'.mjs',
|
|
19
|
+
'.ts',
|
|
20
|
+
'.cts',
|
|
21
|
+
'.mts',
|
|
22
|
+
'.jsx',
|
|
23
|
+
'.tsx',
|
|
24
|
+
'.json',
|
|
25
|
+
'.jsonc',
|
|
26
|
+
'.html',
|
|
27
|
+
'.css',
|
|
28
|
+
'.graphql',
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* The ignore files Prettier's CLI consults by default, and the CLI is what
|
|
32
|
+
* `.git-format-staged.yml` invokes. A repository that tells Prettier to leave
|
|
33
|
+
* a path alone means the hook leaves it alone, so this writer must too.
|
|
34
|
+
*/
|
|
35
|
+
const IGNORE_FILES = ['.gitignore', '.prettierignore'];
|
|
36
|
+
/**
|
|
37
|
+
* Loaded on first use, not at import: most `smoo` commands never write a
|
|
38
|
+
* managed file, and Prettier is not a cheap module to pull into every one.
|
|
39
|
+
*/
|
|
40
|
+
let prettierModule;
|
|
41
|
+
function loadPrettier() {
|
|
42
|
+
prettierModule ??= import('prettier');
|
|
43
|
+
return prettierModule;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The bytes a managed target has *after* the consuming repository's commit
|
|
47
|
+
* hook has had its say.
|
|
48
|
+
*
|
|
49
|
+
* `smoo monorepo update` writes into a repository whose hook
|
|
50
|
+
* (`.git-format-staged.yml`) reformats whatever it stages. Writing the
|
|
51
|
+
* generator's own idea of formatting there means the hook rewrites the file on
|
|
52
|
+
* the next commit, the next `update` writes the generator's version back, and
|
|
53
|
+
* the drift check reports a difference forever — on a tree where nothing
|
|
54
|
+
* meaningful changed. A warning that is always on is a warning nobody reads,
|
|
55
|
+
* and it hides the real drift underneath it.
|
|
56
|
+
*
|
|
57
|
+
* So the writer renders into the consumer's own formatting space, using the
|
|
58
|
+
* config Prettier resolves for *this* path in *this* repository: overrides,
|
|
59
|
+
* `.editorconfig` and ignore files included. The written bytes are then a
|
|
60
|
+
* fixed point of the hook, `update` is idempotent, and `check` reports only
|
|
61
|
+
* differences that are real.
|
|
62
|
+
*
|
|
63
|
+
* A consumer's formatter config is the consumer's business. This reads it and
|
|
64
|
+
* obeys; it never asks the repository to change it.
|
|
65
|
+
*/
|
|
66
|
+
export async function formatManagedContent(root, target, content) {
|
|
67
|
+
if (BIOME_OWNED_EXTENSIONS.some((extension) => target.endsWith(extension))) {
|
|
68
|
+
return content;
|
|
69
|
+
}
|
|
70
|
+
const prettier = await loadPrettier();
|
|
71
|
+
const path = join(root, target);
|
|
72
|
+
const ignorePath = IGNORE_FILES.map((file) => join(root, file));
|
|
73
|
+
// `resolveConfig` so a repository that assigns a parser through an override
|
|
74
|
+
// gets the parser its own Prettier run would infer.
|
|
75
|
+
const info = await prettier.getFileInfo(path, { ignorePath, resolveConfig: true });
|
|
76
|
+
if (info.ignored || info.inferredParser === null) {
|
|
77
|
+
return content;
|
|
78
|
+
}
|
|
79
|
+
// Prettier resolves configuration from disk, not pending Nx Tree edits. If
|
|
80
|
+
// another generator stages formatter config, the next run after flush converges.
|
|
81
|
+
let options;
|
|
82
|
+
try {
|
|
83
|
+
options = await prettier.resolveConfig(path, { editorconfig: true });
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
throw new Error(`${target}: the repository's Prettier configuration could not be read, so managed content cannot be written in the bytes its commit hook would leave behind`, { cause: error });
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
return await prettier.format(content, { ...options, filepath: path });
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
throw new Error(`${target}: generated managed content is not valid ${info.inferredParser}`, { cause: error });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ManagedPathInfo } from './tree.js';
|
|
2
|
+
/**
|
|
3
|
+
* Small filesystem boundary for permissions and links, which Nx Tree cannot
|
|
4
|
+
* read. Never reads content and never writes. In-memory generator tests supply
|
|
5
|
+
* these facts directly; real-filesystem tests exercise this boundary separately.
|
|
6
|
+
*/
|
|
7
|
+
export declare function inspectManagedPaths(root: string, targets: readonly string[]): Map<string, ManagedPathInfo>;
|
|
8
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/managed-files/paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAG1G"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { lstatSync, realpathSync, statSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
3
|
+
import { isManagedTarget } from './tree.js';
|
|
4
|
+
/**
|
|
5
|
+
* Small filesystem boundary for permissions and links, which Nx Tree cannot
|
|
6
|
+
* read. Never reads content and never writes. In-memory generator tests supply
|
|
7
|
+
* these facts directly; real-filesystem tests exercise this boundary separately.
|
|
8
|
+
*/
|
|
9
|
+
export function inspectManagedPaths(root, targets) {
|
|
10
|
+
const canonicalRoot = realpathSync(root);
|
|
11
|
+
return new Map(targets.map((target) => [target, inspectPath(canonicalRoot, target)]));
|
|
12
|
+
}
|
|
13
|
+
function inspectPath(root, target) {
|
|
14
|
+
if (!isManagedTarget(target))
|
|
15
|
+
return { error: 'invalid managed path' };
|
|
16
|
+
const parts = target.split('/');
|
|
17
|
+
for (let i = 1; i < parts.length; i++) {
|
|
18
|
+
const parent = lstatSync(resolve(root, ...parts.slice(0, i)), { throwIfNoEntry: false });
|
|
19
|
+
if (parent === undefined)
|
|
20
|
+
return {};
|
|
21
|
+
if (!parent.isDirectory())
|
|
22
|
+
return { error: 'parent path is not a regular directory (symlink parents are not managed)' };
|
|
23
|
+
}
|
|
24
|
+
const path = resolve(root, target);
|
|
25
|
+
const info = lstatSync(path, { throwIfNoEntry: false });
|
|
26
|
+
if (info === undefined)
|
|
27
|
+
return {};
|
|
28
|
+
if (!info.isSymbolicLink()) {
|
|
29
|
+
return info.isFile() ? { executable: (info.mode & 0o100) !== 0 } : { error: 'target is not a regular file' };
|
|
30
|
+
}
|
|
31
|
+
let destination;
|
|
32
|
+
try {
|
|
33
|
+
destination = realpathSync(path);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return { error: 'symlink is broken, cyclic or inaccessible; refusing to follow it' };
|
|
37
|
+
}
|
|
38
|
+
const fromRoot = relative(root, destination);
|
|
39
|
+
if (isAbsolute(fromRoot) || fromRoot === '..' || fromRoot.startsWith(`..${sep}`)) {
|
|
40
|
+
return { error: 'symlink resolves outside the workspace' };
|
|
41
|
+
}
|
|
42
|
+
const linked = statSync(destination);
|
|
43
|
+
return linked.isFile()
|
|
44
|
+
? { symlink: true, executable: (linked.mode & 0o100) !== 0 }
|
|
45
|
+
: { error: 'symlink does not resolve to a regular file' };
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-preview-cleanup-workflow.d.ts","sourceRoot":"","sources":["../../src/managed-files/pr-preview-cleanup-workflow.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAED,wBAAgB,kCAAkC,CAAC,OAAO,GAAE,+BAAoC,GAAG,MAAM,CAmCxG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub Actions expressions are emitted literally. */
|
|
2
|
+
import { renderRunsOnLine } from './github-runs-on.js';
|
|
3
|
+
export function renderPrPreviewCleanupWorkflowYaml(options = {}) {
|
|
4
|
+
return `name: PR Preview Cleanup
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [closed]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
cleanup:
|
|
15
|
+
name: Cleanup PR environment
|
|
16
|
+
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
17
|
+
${renderRunsOnLine(options.runsOn)}
|
|
18
|
+
timeout-minutes: 15
|
|
19
|
+
defaults:
|
|
20
|
+
run:
|
|
21
|
+
working-directory: tooling/direnv
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@v6.0.2
|
|
25
|
+
with:
|
|
26
|
+
filter: blob:none
|
|
27
|
+
fetch-depth: 1
|
|
28
|
+
|
|
29
|
+
- name: Setup Nix/devenv
|
|
30
|
+
uses: ./.github/actions/setup-devenv
|
|
31
|
+
|
|
32
|
+
- name: Cleanup PR environment
|
|
33
|
+
env:
|
|
34
|
+
CLOUDFLARE_API_TOKEN: \${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
35
|
+
CLOUDFLARE_ACCOUNT_ID: \${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
36
|
+
run: smoo wrangler cleanup-pr --pr \${{ github.event.pull_request.number }}
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PackageJson, PackagePrivateNpmConfig } from '../workspace-manifest.js';
|
|
2
|
+
/** Committed npmrc values only; workflow generation must not depend on a user's home. */
|
|
3
|
+
export declare function npmrcValueFromText(text: string, key: string): string | undefined;
|
|
4
|
+
export declare function npmrcTokenEnvFromText(text: string, scope: string): string | undefined;
|
|
5
|
+
/** Resolve workflow credential NAMES without obtaining, interpolating, or persisting any secret. */
|
|
6
|
+
export declare function privateNpmWorkflowConfig(declared: PackagePrivateNpmConfig | undefined, root: PackageJson, packages: readonly PackageJson[], npmrc: string): PackagePrivateNpmConfig | undefined;
|
|
7
|
+
//# sourceMappingURL=private-npm-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-npm-policy.d.ts","sourceRoot":"","sources":["../../src/managed-files/private-npm-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAGrF,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQhF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAarF;AAED,oGAAoG;AACpG,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,uBAAuB,GAAG,SAAS,EAC7C,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,KAAK,EAAE,MAAM,GACZ,uBAAuB,GAAG,SAAS,CA0BrC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { isPublishablePackage } from '../workspace-package-policy.js';
|
|
2
|
+
/** Committed npmrc values only; workflow generation must not depend on a user's home. */
|
|
3
|
+
export function npmrcValueFromText(text, key) {
|
|
4
|
+
for (const line of text.split(/\r?\n/)) {
|
|
5
|
+
const trimmed = line.trim();
|
|
6
|
+
if (trimmed.startsWith('#') || trimmed.startsWith(';'))
|
|
7
|
+
continue;
|
|
8
|
+
const separator = trimmed.indexOf('=');
|
|
9
|
+
if (separator > 0 && trimmed.slice(0, separator).trim() === key)
|
|
10
|
+
return trimmed.slice(separator + 1).trim();
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
export function npmrcTokenEnvFromText(text, scope) {
|
|
15
|
+
const registry = npmrcValueFromText(text, `${scope}:registry`);
|
|
16
|
+
if (!registry)
|
|
17
|
+
return undefined;
|
|
18
|
+
let url;
|
|
19
|
+
try {
|
|
20
|
+
url = new URL(registry);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const pathname = url.pathname.endsWith('/') ? url.pathname : `${url.pathname}/`;
|
|
26
|
+
return /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(npmrcValueFromText(text, `//${url.host}${pathname}:_authToken`) ?? '')?.[1];
|
|
27
|
+
}
|
|
28
|
+
/** Resolve workflow credential NAMES without obtaining, interpolating, or persisting any secret. */
|
|
29
|
+
export function privateNpmWorkflowConfig(declared, root, packages, npmrc) {
|
|
30
|
+
if (!declared)
|
|
31
|
+
return undefined;
|
|
32
|
+
const inScope = (name) => name === declared.scope || name.startsWith(`${declared.scope}/`);
|
|
33
|
+
const consumes = [root, ...packages].some((pkg) => [pkg.dependencies, pkg.devDependencies, pkg.peerDependencies, pkg.optionalDependencies].some((deps) => Object.entries(deps ?? {}).some(([name, spec]) => inScope(name) && !/^(workspace|link|file):/.test(spec))));
|
|
34
|
+
const publishes = packages.some((pkg) => pkg.name &&
|
|
35
|
+
pkg.version &&
|
|
36
|
+
inScope(pkg.name) &&
|
|
37
|
+
isPublishablePackage({ private: pkg.private === true, tags: pkg.nx?.tags ?? [] }) &&
|
|
38
|
+
pkg.nx?.tags?.includes('npm:private'));
|
|
39
|
+
if (!consumes && !publishes)
|
|
40
|
+
return undefined;
|
|
41
|
+
const npmrcEnv = npmrcTokenEnvFromText(npmrc, declared.scope);
|
|
42
|
+
const readTokenEnv = declared.readTokenEnv ?? (consumes ? npmrcEnv : undefined);
|
|
43
|
+
const publishTokenEnv = publishes ? (declared.publishTokenEnv ?? npmrcEnv) : undefined;
|
|
44
|
+
if (!readTokenEnv && !publishTokenEnv)
|
|
45
|
+
return undefined;
|
|
46
|
+
return {
|
|
47
|
+
scope: declared.scope,
|
|
48
|
+
...(readTokenEnv ? { readTokenEnv } : {}),
|
|
49
|
+
...(publishTokenEnv ? { publishTokenEnv } : {}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { PackageCargoCredentialsConfig, PackagePrivateNpmConfig, PackageRemoteCacheConfig, PackageSmooGithub, PackageSourceCheckoutConfig } from '../workspace-manifest.js';
|
|
2
|
+
import { type DeployStepSecretConfig } from './ci-workflow.js';
|
|
3
|
+
import { type WorkflowRunsOn } from './github-runs-on.js';
|
|
4
|
+
export type PublishWorkflowBump = 'auto' | 'patch' | 'minor' | 'major' | 'prerelease';
|
|
5
|
+
export type PublishWorkflowCondition = 'plan-mode-not-none' | 'version-mode-not-none' | 'deploy-production' | 'deploy-production-standalone' | 'failure' | 'always';
|
|
6
|
+
export type PublishWorkflowNxTarget = 'build' | 'lint' | 'test';
|
|
7
|
+
export type PublishWorkflowDeployStage = 'none' | 'production';
|
|
8
|
+
export declare enum PublishWorkflowStepKind {
|
|
9
|
+
Checkout = "checkout",
|
|
10
|
+
SourceCheckouts = "source-checkouts",
|
|
11
|
+
CargoCredentials = "cargo-credentials",
|
|
12
|
+
SetupDevenv = "setup-devenv",
|
|
13
|
+
ConfigureReleaseAuthor = "configure-release-author",
|
|
14
|
+
BuildNxVersionActions = "build-nx-version-actions",
|
|
15
|
+
RepairPendingReleases = "repair-pending-releases",
|
|
16
|
+
PlanRelease = "plan-release",
|
|
17
|
+
VersionRelease = "version-release",
|
|
18
|
+
CheckManagedMonorepoFiles = "check-managed-monorepo-files",
|
|
19
|
+
Build = "build",
|
|
20
|
+
Lint = "lint",
|
|
21
|
+
UnitTests = "unit-tests",
|
|
22
|
+
UploadTraceDbs = "upload-trace-dbs",
|
|
23
|
+
ValidateMonorepoConfig = "validate-monorepo-config",
|
|
24
|
+
TagRelease = "tag-release",
|
|
25
|
+
PublishRelease = "publish-release",
|
|
26
|
+
DeployProduction = "deploy-production",
|
|
27
|
+
SaveNixDevenv = "save-nix-devenv"
|
|
28
|
+
}
|
|
29
|
+
export interface PublishWorkflowStep {
|
|
30
|
+
kind: PublishWorkflowStepKind;
|
|
31
|
+
name: string;
|
|
32
|
+
number: number;
|
|
33
|
+
id?: string;
|
|
34
|
+
condition?: PublishWorkflowCondition;
|
|
35
|
+
nxTarget?: PublishWorkflowNxTarget;
|
|
36
|
+
}
|
|
37
|
+
export interface PublishWorkflowDefinition {
|
|
38
|
+
steps: PublishWorkflowStep[];
|
|
39
|
+
}
|
|
40
|
+
export interface PublishWorkflowDefinitionOptions extends DeployStepSecretConfig {
|
|
41
|
+
deploy?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the repo owns packages this workflow can release. False drops the
|
|
44
|
+
* release half entirely: a repo publishing nothing has no version to gate a
|
|
45
|
+
* production deploy on, and every `smoo release` command throws without one.
|
|
46
|
+
*/
|
|
47
|
+
release?: boolean;
|
|
48
|
+
repoName?: string;
|
|
49
|
+
platformTargetGlobs?: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* Architectures the macOS platform job fans out over, one job per entry.
|
|
52
|
+
* Empty falls back to a single job selecting every macOS platform family.
|
|
53
|
+
*/
|
|
54
|
+
macosPlatformArchitectures?: readonly string[];
|
|
55
|
+
/** Linux jobs only. Default ubuntu-latest. Same smoo.github.runsOn as CI. */
|
|
56
|
+
runsOn?: WorkflowRunsOn;
|
|
57
|
+
/** macOS platform job runs-on labels. Default macos-latest. Same smoo.github.macosRunsOn as CI. */
|
|
58
|
+
macosRunsOn?: WorkflowRunsOn;
|
|
59
|
+
platformProducer?: PackageSmooGithub['platformProducer'];
|
|
60
|
+
actionsProvider?: PackageSmooGithub['actionsProvider'];
|
|
61
|
+
/**
|
|
62
|
+
* Declared private-npm opt-in. The publish step is the only place receiving
|
|
63
|
+
* the publish token; the read token rides along for `.npmrc` `${TOKEN}`
|
|
64
|
+
* expansion. The registry URL is not a job env. No env is emitted without
|
|
65
|
+
* this configuration.
|
|
66
|
+
*/
|
|
67
|
+
privateNpm?: PackagePrivateNpmConfig;
|
|
68
|
+
/** Declared sibling source checkouts cloned before SetupDevenv. */
|
|
69
|
+
sourceCheckouts?: PackageSourceCheckoutConfig[];
|
|
70
|
+
/**
|
|
71
|
+
* Declared Cargo private-dependency credentials. Private git origins add a
|
|
72
|
+
* host-gated credential helper step before SetupDevenv; the named secrets
|
|
73
|
+
* become job env because every later cargo fetch resolves them.
|
|
74
|
+
*/
|
|
75
|
+
cargoCredentials?: PackageCargoCredentialsConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Declared self-hosted Nx remote cache. Every job here runs Nx targets —
|
|
78
|
+
* the release-candidate build, the platform build, the publish gate — so
|
|
79
|
+
* each carries the server and access token and reuses what CI already
|
|
80
|
+
* built for the same hashes.
|
|
81
|
+
*/
|
|
82
|
+
remoteCache?: PackageRemoteCacheConfig;
|
|
83
|
+
}
|
|
84
|
+
export interface PublishWorkflowInputs {
|
|
85
|
+
bump: PublishWorkflowBump;
|
|
86
|
+
deployStage: PublishWorkflowDeployStage;
|
|
87
|
+
dryRun: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface PublishWorkflowVersionOutputs {
|
|
90
|
+
mode: 'new' | 'none';
|
|
91
|
+
projects: string[];
|
|
92
|
+
}
|
|
93
|
+
export interface PublishWorkflowSetupOutputs {
|
|
94
|
+
nixCacheHit: string;
|
|
95
|
+
devenvCacheHit: string;
|
|
96
|
+
}
|
|
97
|
+
export interface PublishWorkflowCallbacks {
|
|
98
|
+
checkout(): Promise<void>;
|
|
99
|
+
setupDevenv(): Promise<PublishWorkflowSetupOutputs>;
|
|
100
|
+
configureReleaseAuthor(): Promise<void>;
|
|
101
|
+
buildNxVersionActions(): Promise<void>;
|
|
102
|
+
repairPendingReleases(input: {
|
|
103
|
+
dryRun: boolean;
|
|
104
|
+
}): Promise<void>;
|
|
105
|
+
versionRelease(input: {
|
|
106
|
+
bump: PublishWorkflowBump;
|
|
107
|
+
dryRun: boolean;
|
|
108
|
+
}): Promise<PublishWorkflowVersionOutputs>;
|
|
109
|
+
/**
|
|
110
|
+
* The selection the bump WILL make, computed without writing anything, so the
|
|
111
|
+
* gates that run before the version commit know what to run over. Defaults to
|
|
112
|
+
* a dry-run `versionRelease` when a caller supplies none.
|
|
113
|
+
*/
|
|
114
|
+
planRelease?(input: {
|
|
115
|
+
bump: PublishWorkflowBump;
|
|
116
|
+
}): Promise<PublishWorkflowVersionOutputs>;
|
|
117
|
+
checkManagedMonorepoFiles(): Promise<void>;
|
|
118
|
+
nxRunMany(input: {
|
|
119
|
+
target: PublishWorkflowNxTarget;
|
|
120
|
+
projects: string[];
|
|
121
|
+
}): Promise<void>;
|
|
122
|
+
uploadTraceDbs(): Promise<void>;
|
|
123
|
+
validateMonorepoConfig(): Promise<void>;
|
|
124
|
+
tagRelease(input: {
|
|
125
|
+
dryRun: boolean;
|
|
126
|
+
}): Promise<void>;
|
|
127
|
+
publishRelease(input: {
|
|
128
|
+
bump: PublishWorkflowBump;
|
|
129
|
+
dryRun: boolean;
|
|
130
|
+
}): Promise<void>;
|
|
131
|
+
deployProduction(): Promise<void>;
|
|
132
|
+
saveNixDevenv(input: PublishWorkflowSetupOutputs): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
export interface PublishWorkflowRunContext {
|
|
135
|
+
inputs: PublishWorkflowInputs;
|
|
136
|
+
callbacks: PublishWorkflowCallbacks;
|
|
137
|
+
}
|
|
138
|
+
export interface PublishWorkflowRunResult {
|
|
139
|
+
version: PublishWorkflowVersionOutputs;
|
|
140
|
+
failed: boolean;
|
|
141
|
+
}
|
|
142
|
+
export declare function definePublishWorkflow(options?: PublishWorkflowDefinitionOptions): PublishWorkflowDefinition;
|
|
143
|
+
export declare function runPublishWorkflow(workflow: PublishWorkflowDefinition, context: PublishWorkflowRunContext): Promise<PublishWorkflowRunResult>;
|
|
144
|
+
/**
|
|
145
|
+
* The workflow as this generator composes it. The consumer's own formatter has
|
|
146
|
+
* the last word on the bytes that land on disk — see `formatManagedContent` —
|
|
147
|
+
* so nothing here encodes one repository's Prettier preferences.
|
|
148
|
+
*/
|
|
149
|
+
export declare function renderPublishWorkflowYaml(options?: PublishWorkflowDefinitionOptions): string;
|
|
150
|
+
//# sourceMappingURL=publish-workflow.d.ts.map
|