@smoothbricks/cli 0.10.6 → 0.10.8
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.d.ts.map +1 -1
- package/dist/cli.js +24 -1
- package/dist/github-ci/index.d.ts +44 -3
- package/dist/github-ci/index.d.ts.map +1 -1
- package/dist/github-ci/index.js +242 -36
- package/dist/lib/json.d.ts +1 -1
- package/dist/lib/json.d.ts.map +1 -1
- package/dist/lib/json.js +3 -18
- package/dist/lib/workspace.d.ts.map +1 -1
- package/dist/lib/workspace.js +1 -0
- package/dist/monorepo/ci-workflow.js +16 -6
- package/dist/monorepo/managed-files.d.ts +6 -22
- package/dist/monorepo/managed-files.d.ts.map +1 -1
- package/dist/monorepo/managed-files.js +31 -48
- package/dist/monorepo/package-policy.js +2 -2
- package/dist/monorepo/packs/index.d.ts.map +1 -1
- package/dist/monorepo/packs/index.js +2 -0
- package/dist/monorepo/pr-preview-cleanup-workflow.d.ts +5 -0
- package/dist/monorepo/pr-preview-cleanup-workflow.d.ts.map +1 -0
- package/dist/monorepo/pr-preview-cleanup-workflow.js +38 -0
- package/dist/monorepo/publish-workflow.js +3 -3
- package/dist/monorepo/runtime.d.ts +2 -2
- package/dist/monorepo/runtime.d.ts.map +1 -1
- package/dist/monorepo/runtime.js +11 -16
- package/dist/monorepo/tool-validation.d.ts.map +1 -1
- package/dist/monorepo/tool-validation.js +105 -28
- package/dist/nx/index.d.ts +7 -4
- package/dist/nx/index.d.ts.map +1 -1
- package/dist/nx/index.js +117 -56
- package/dist/playwright/index.d.ts +22 -0
- package/dist/playwright/index.d.ts.map +1 -0
- package/dist/playwright/index.js +44 -0
- package/dist/release/bootstrap-npm-packages.d.ts +3 -0
- package/dist/release/bootstrap-npm-packages.d.ts.map +1 -1
- package/dist/release/bootstrap-npm-packages.js +21 -0
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +17 -0
- package/dist/wrangler/cloudflare.d.ts +85 -0
- package/dist/wrangler/cloudflare.d.ts.map +1 -0
- package/dist/wrangler/cloudflare.js +235 -0
- package/dist/wrangler/deploy-environment.d.ts +48 -0
- package/dist/wrangler/deploy-environment.d.ts.map +1 -0
- package/dist/wrangler/deploy-environment.js +383 -0
- package/dist/wrangler/environment.d.ts +58 -0
- package/dist/wrangler/environment.d.ts.map +1 -0
- package/dist/wrangler/environment.js +297 -0
- package/managed/raw/tooling/devenv +71 -0
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +3 -4
- package/package.json +11 -4
- package/src/cli.ts +33 -3
- package/src/github-ci/index.test.ts +221 -1
- package/src/github-ci/index.ts +303 -32
- package/src/lib/json.ts +1 -1
- package/src/lib/workspace.ts +1 -0
- package/src/monorepo/__tests__/ci-workflow.test.ts +10 -4
- package/src/monorepo/__tests__/pr-preview-cleanup-workflow.test.ts +23 -0
- package/src/monorepo/__tests__/publish-workflow.test.ts +12 -4
- package/src/monorepo/ci-workflow.ts +16 -6
- package/src/monorepo/managed-files.test.ts +87 -23
- package/src/monorepo/managed-files.ts +35 -69
- package/src/monorepo/package-policy.test.ts +31 -0
- package/src/monorepo/package-policy.ts +2 -2
- package/src/monorepo/packs/index.ts +2 -0
- package/src/monorepo/pr-preview-cleanup-workflow.ts +44 -0
- package/src/monorepo/publish-workflow.ts +7 -2
- package/src/monorepo/runtime.test.ts +23 -17
- package/src/monorepo/runtime.ts +12 -17
- package/src/monorepo/tool-validation.test.ts +100 -8
- package/src/monorepo/tool-validation.ts +115 -31
- package/src/nx/index.test.ts +45 -14
- package/src/nx/index.ts +133 -64
- package/src/playwright/index.test.ts +90 -0
- package/src/playwright/index.ts +73 -0
- package/src/release/__tests__/bootstrap-npm-packages.test.ts +63 -2
- package/src/release/bootstrap-npm-packages.ts +34 -0
- package/src/release/index.ts +18 -0
- package/src/wrangler/cloudflare.ts +289 -0
- package/src/wrangler/deploy-environment.test.ts +354 -0
- package/src/wrangler/deploy-environment.ts +445 -0
- package/src/wrangler/environment.test.ts +173 -0
- package/src/wrangler/environment.ts +366 -0
- package/managed/raw/patches/ttsc@0.19.3.patch +0 -67
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AASA,wBAAsB,MAAM,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAexE"}
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,9 @@ import { Command, CommanderError } from 'commander';
|
|
|
2
2
|
import { variants } from './generate/index.js';
|
|
3
3
|
import { cliPackageVersion } from './lib/cli-package.js';
|
|
4
4
|
import { findRepoRoot } from './lib/run.js';
|
|
5
|
+
import { ensureChromium } from './playwright/index.js';
|
|
5
6
|
import { resolvePrConflicts } from './pr/index.js';
|
|
7
|
+
import { cleanupPullRequest, deployEnvironment } from './wrangler/deploy-environment.js';
|
|
6
8
|
import { scaffold } from './wrangler/scaffold.js';
|
|
7
9
|
export async function runCli(argv = process.argv.slice(2)) {
|
|
8
10
|
const program = buildProgram();
|
|
@@ -290,6 +292,7 @@ function buildProgram() {
|
|
|
290
292
|
.command('nx-run-many')
|
|
291
293
|
.requiredOption('--targets <targets>')
|
|
292
294
|
.option('--projects <projects>')
|
|
295
|
+
.option('--projects-with-targets <targets>', 'select projects owning any comma-separated target or target glob')
|
|
293
296
|
.option('--configuration <configuration>')
|
|
294
297
|
.option('--collect-outputs <directory>')
|
|
295
298
|
.action(async (options) => {
|
|
@@ -306,7 +309,7 @@ function buildProgram() {
|
|
|
306
309
|
});
|
|
307
310
|
githubCi
|
|
308
311
|
.command('nx-deploy')
|
|
309
|
-
.
|
|
312
|
+
.option('--environment <environment>', 'explicit staging, production, or prN override')
|
|
310
313
|
.option('--mode <mode>', 'auto, affected, or run-many', 'run-many')
|
|
311
314
|
.option('--name <name>')
|
|
312
315
|
.option('--step <step>')
|
|
@@ -326,6 +329,14 @@ function buildProgram() {
|
|
|
326
329
|
process.exitCode = exitCode;
|
|
327
330
|
}
|
|
328
331
|
});
|
|
332
|
+
const playwright = program.command('playwright').description('Manage Playwright browsers');
|
|
333
|
+
const playwrightEnsure = playwright.command('ensure').description('Ensure a Playwright browser is available');
|
|
334
|
+
playwrightEnsure
|
|
335
|
+
.command('chromium')
|
|
336
|
+
.description('Ensure Chromium is available for browser tests')
|
|
337
|
+
.action(async () => {
|
|
338
|
+
await ensureChromium();
|
|
339
|
+
});
|
|
329
340
|
const wrangler = program.command('wrangler').description('Cloudflare wrangler project helpers');
|
|
330
341
|
wrangler
|
|
331
342
|
.command('scaffold <project>')
|
|
@@ -334,6 +345,18 @@ function buildProgram() {
|
|
|
334
345
|
.action(async (project, options) => {
|
|
335
346
|
scaffold(await findRepoRoot(), project, { force: options.force });
|
|
336
347
|
});
|
|
348
|
+
wrangler
|
|
349
|
+
.command('deploy-environment')
|
|
350
|
+
.requiredOption('--environment <environment>', 'staging, production, or prN')
|
|
351
|
+
.action(async (options) => {
|
|
352
|
+
await deployEnvironment(process.cwd(), options.environment);
|
|
353
|
+
});
|
|
354
|
+
wrangler
|
|
355
|
+
.command('cleanup-pr')
|
|
356
|
+
.requiredOption('--pr <number>', 'pull-request number')
|
|
357
|
+
.action(async (options) => {
|
|
358
|
+
await cleanupPullRequest(process.cwd(), Number(options.pr));
|
|
359
|
+
});
|
|
337
360
|
return program;
|
|
338
361
|
}
|
|
339
362
|
function booleanOption(value) {
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { type ProjectTargets } from '../nx/index.js';
|
|
2
|
+
import { type EnvironmentToken } from '../wrangler/environment.js';
|
|
2
3
|
import type { NxTargetRun } from './outputs.js';
|
|
4
|
+
export interface GithubActionsEventPayload {
|
|
5
|
+
action?: string;
|
|
6
|
+
repository?: {
|
|
7
|
+
default_branch?: string;
|
|
8
|
+
full_name?: string;
|
|
9
|
+
};
|
|
10
|
+
pull_request?: {
|
|
11
|
+
number?: number;
|
|
12
|
+
head?: {
|
|
13
|
+
repo?: {
|
|
14
|
+
full_name?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
3
19
|
type NxSmartMode = 'auto' | 'affected' | 'run-many';
|
|
4
20
|
export declare function cleanupGithubCiCache(root: string): Promise<void>;
|
|
5
21
|
export declare function nxSmartArgs(target: string, mode: 'affected' | 'run-many', configuration?: string): string[];
|
|
@@ -16,6 +32,7 @@ export interface NxRunManyOptions {
|
|
|
16
32
|
configuration?: string;
|
|
17
33
|
collectOutputs?: string;
|
|
18
34
|
allowEmptyProjects?: boolean;
|
|
35
|
+
projectsWithTargets?: string;
|
|
19
36
|
}
|
|
20
37
|
export interface ExpandedNxTargetRuns {
|
|
21
38
|
runs: NxTargetRun[];
|
|
@@ -27,12 +44,36 @@ export declare function nxRunManyArgs(run: NxTargetRun, configuration?: string):
|
|
|
27
44
|
export declare function readGitHeadSha(root: string): Promise<string>;
|
|
28
45
|
export declare function githubCiNxRunMany(root: string, options: NxRunManyOptions): Promise<void>;
|
|
29
46
|
export declare function githubCiApplyOutputs(root: string, directories: string[], expectedSourceSha: string): Promise<void>;
|
|
30
|
-
export
|
|
31
|
-
|
|
47
|
+
export interface GithubCiNxDeployOptions {
|
|
48
|
+
environment?: string;
|
|
32
49
|
mode?: NxSmartMode;
|
|
33
50
|
name?: string;
|
|
34
51
|
step?: string;
|
|
35
52
|
verify?: boolean;
|
|
36
|
-
}
|
|
53
|
+
}
|
|
54
|
+
export interface GithubCiNxDeployDependencies {
|
|
55
|
+
listProjects?: (root: string, target: string, mode: 'affected' | 'run-many') => Promise<string[]>;
|
|
56
|
+
runNx?: (args: string[], root: string) => Promise<number>;
|
|
57
|
+
appendSummary?: (summaryPath: string, content: string) => Promise<void>;
|
|
58
|
+
publishDeployment?: (environment: `pr${number}`, url: string) => Promise<void>;
|
|
59
|
+
setStatus?: (state: 'pending' | 'success' | 'failure') => Promise<void>;
|
|
60
|
+
processEnv?: NodeJS.ProcessEnv;
|
|
61
|
+
eventPayload?: GithubActionsEventPayload;
|
|
62
|
+
}
|
|
63
|
+
export declare function githubCiNxDeploy(root: string, options: GithubCiNxDeployOptions, dependencies?: GithubCiNxDeployDependencies): Promise<void>;
|
|
64
|
+
export declare function resolveDeploymentEnvironment(explicit: string | undefined, environment: NodeJS.ProcessEnv, event: GithubActionsEventPayload | undefined): EnvironmentToken;
|
|
65
|
+
export declare function selectEnvironmentDeployProjects(candidates: string[], loadProject: (project: string) => Promise<unknown>): Promise<string[]>;
|
|
66
|
+
export interface GithubApiProcessResult {
|
|
67
|
+
exitCode: number;
|
|
68
|
+
stdout: string;
|
|
69
|
+
stderr: string;
|
|
70
|
+
}
|
|
71
|
+
export interface GithubApiProcessRunner {
|
|
72
|
+
run(args: string[], input: string, cwd: string): Promise<GithubApiProcessResult>;
|
|
73
|
+
}
|
|
74
|
+
export declare class NodeGithubApiProcessRunner implements GithubApiProcessRunner {
|
|
75
|
+
run(args: string[], input: string, cwd: string): Promise<GithubApiProcessResult>;
|
|
76
|
+
}
|
|
77
|
+
export declare function publishGithubDeployment(environment: `pr${number}`, url: string, processEnvironment: NodeJS.ProcessEnv, runner?: GithubApiProcessRunner): Promise<void>;
|
|
37
78
|
export {};
|
|
38
79
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/github-ci/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/github-ci/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM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AC,sBAAsB,CAAC,CAmB/E;CACF;AAED,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,KAAK,MAAM,EAAE,EAC1B,GAAG,EAAE,MAAM,EACX,kBAAkB,EAAE,MAAM,CAAC,UAAU,EACrC,MAAM,GAAE,sBAAyD,GAChE,OAAO,CAAC,IAAI,CAAC,CA+Df"}
|
package/dist/github-ci/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
1
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
3
|
import { appendFile, mkdtemp, realpath, rename, rm } from 'node:fs/promises';
|
|
3
4
|
import { dirname, join } from 'node:path';
|
|
@@ -6,22 +7,35 @@ import typia from 'typia';
|
|
|
6
7
|
import { parseStringArrayText } from '../lib/json.js';
|
|
7
8
|
import { decode, run, runStatus } from '../lib/run.js';
|
|
8
9
|
import { readProjectTargets } from '../nx/index.js';
|
|
10
|
+
import { isPullRequestEnvironment, parseEnvironmentToken, pullRequestEnvironment, } from '../wrangler/environment.js';
|
|
9
11
|
const parseGithubActionsEvent = (() => {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
+
const _ip0 = input => undefined === input["full_name"] || "string" === typeof input["full_name"];
|
|
13
|
+
const _io0 = input => (undefined === input.action || "string" === typeof input.action) && (undefined === input.repository || "object" === typeof input.repository && null !== input.repository && false === Array.isArray(input.repository) && _io1(input.repository)) && (undefined === input.pull_request || "object" === typeof input.pull_request && null !== input.pull_request && false === Array.isArray(input.pull_request) && _io2(input.pull_request));
|
|
14
|
+
const _io1 = input => (undefined === input.default_branch || "string" === typeof input.default_branch) && _ip0(input);
|
|
15
|
+
const _io2 = input => (undefined === input.number || "number" === typeof input.number) && (undefined === input.head || "object" === typeof input.head && null !== input.head && false === Array.isArray(input.head) && _io3(input.head));
|
|
16
|
+
const _io3 = input => undefined === input.repo || "object" === typeof input.repo && null !== input.repo && false === Array.isArray(input.repo) && _io4(input.repo);
|
|
17
|
+
const _io4 = input => _ip0(input);
|
|
12
18
|
const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
13
19
|
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
14
20
|
})();
|
|
15
|
-
const
|
|
21
|
+
const isGithubDeployment = (() => {
|
|
22
|
+
const _io0 = input => "number" === typeof input.id;
|
|
23
|
+
return input => "object" === typeof input && null !== input && _io0(input);
|
|
24
|
+
})();
|
|
25
|
+
const isNxProjectDeployTarget = (() => {
|
|
26
|
+
const _ip0 = input => true;
|
|
16
27
|
const _io0 = input => undefined === input.targets || "object" === typeof input.targets && null !== input.targets && false === Array.isArray(input.targets) && _io1(input.targets);
|
|
17
28
|
const _io1 = input => undefined === input.deploy || "object" === typeof input.deploy && null !== input.deploy && false === Array.isArray(input.deploy) && _io2(input.deploy);
|
|
18
|
-
const _io2 = input => undefined === input.
|
|
19
|
-
const _io3 = input =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
const _io2 = input => _ip0(input) && (undefined === input.options || "object" === typeof input.options && null !== input.options && false === Array.isArray(input.options) && _io3(input.options));
|
|
30
|
+
const _io3 = input => _ip0(input);
|
|
31
|
+
return input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
32
|
+
})();
|
|
33
|
+
const parseNxProjectDeployTarget = (() => {
|
|
34
|
+
const _ip0 = input => true;
|
|
35
|
+
const _io0 = input => undefined === input.targets || "object" === typeof input.targets && null !== input.targets && false === Array.isArray(input.targets) && _io1(input.targets);
|
|
36
|
+
const _io1 = input => undefined === input.deploy || "object" === typeof input.deploy && null !== input.deploy && false === Array.isArray(input.deploy) && _io2(input.deploy);
|
|
37
|
+
const _io2 = input => _ip0(input) && (undefined === input.options || "object" === typeof input.options && null !== input.options && false === Array.isArray(input.options) && _io3(input.options));
|
|
38
|
+
const _io3 = input => _ip0(input);
|
|
25
39
|
const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
26
40
|
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
27
41
|
})();
|
|
@@ -145,10 +159,16 @@ export async function githubCiNxSmart(root, options) {
|
|
|
145
159
|
}
|
|
146
160
|
}
|
|
147
161
|
export function expandNxTargetRuns(projects, options) {
|
|
148
|
-
const
|
|
149
|
-
if (options.projects !== undefined &&
|
|
162
|
+
const namedProjects = selectProjects(projects, options.projects);
|
|
163
|
+
if (options.projects !== undefined && namedProjects.length === 0 && options.allowEmptyProjects !== true) {
|
|
150
164
|
throw new Error(`No Nx projects matched --projects ${options.projects}.`);
|
|
151
165
|
}
|
|
166
|
+
const selectedProjects = selectProjectsWithTargets(namedProjects, options.projectsWithTargets);
|
|
167
|
+
if (options.projectsWithTargets !== undefined &&
|
|
168
|
+
selectedProjects.length === 0 &&
|
|
169
|
+
options.allowEmptyProjects !== true) {
|
|
170
|
+
throw new Error(`No Nx projects own targets matching --projects-with-targets ${options.projectsWithTargets}.`);
|
|
171
|
+
}
|
|
152
172
|
const selectedTargetNames = [...new Set(selectedProjects.flatMap((project) => project.targets))].sort((a, b) => a.localeCompare(b));
|
|
153
173
|
const runs = [];
|
|
154
174
|
const unmatchedGlobs = [];
|
|
@@ -162,6 +182,14 @@ export function expandNxTargetRuns(projects, options) {
|
|
|
162
182
|
unmatchedGlobs.push(targetPattern);
|
|
163
183
|
}
|
|
164
184
|
for (const target of targets) {
|
|
185
|
+
if (!isGlob && options.projectsWithTargets !== undefined) {
|
|
186
|
+
const missingProjects = selectedProjects
|
|
187
|
+
.filter((project) => !project.targets.includes(target))
|
|
188
|
+
.map((project) => project.project);
|
|
189
|
+
if (missingProjects.length > 0) {
|
|
190
|
+
throw new Error(`Nx target ${target} is missing for project(s) selected by --projects-with-targets ${options.projectsWithTargets}: ${missingProjects.join(', ')}.`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
165
193
|
if (addedTargets.has(target)) {
|
|
166
194
|
continue;
|
|
167
195
|
}
|
|
@@ -273,37 +301,87 @@ function selectProjects(projects, selectors) {
|
|
|
273
301
|
.filter((project) => patterns.some((pattern) => new Bun.Glob(pattern).match(project.project)))
|
|
274
302
|
.sort((left, right) => left.project.localeCompare(right.project));
|
|
275
303
|
}
|
|
304
|
+
function selectProjectsWithTargets(projects, selectors) {
|
|
305
|
+
if (selectors === undefined) {
|
|
306
|
+
return projects;
|
|
307
|
+
}
|
|
308
|
+
const patterns = commaSeparatedValues(selectors);
|
|
309
|
+
return projects.filter((project) => project.targets.some((target) => patterns.some((pattern) => new Bun.Glob(pattern).match(target))));
|
|
310
|
+
}
|
|
276
311
|
function commaSeparatedValues(value) {
|
|
277
312
|
return value
|
|
278
313
|
.split(',')
|
|
279
314
|
.map((entry) => entry.trim())
|
|
280
315
|
.filter(Boolean);
|
|
281
316
|
}
|
|
282
|
-
export async function githubCiNxDeploy(root, options) {
|
|
283
|
-
const
|
|
317
|
+
export async function githubCiNxDeploy(root, options, dependencies = {}) {
|
|
318
|
+
const processEnv = dependencies.processEnv ?? process.env;
|
|
319
|
+
const eventPayload = dependencies.eventPayload ?? readGithubActionsEvent(processEnv);
|
|
320
|
+
const environment = resolveDeploymentEnvironment(options.environment, processEnv, eventPayload);
|
|
321
|
+
const name = options.name ?? 'Deploy Environment';
|
|
284
322
|
const step = options.step ?? '';
|
|
285
|
-
|
|
323
|
+
const setStatus = dependencies.setStatus ??
|
|
324
|
+
((state) => state === 'pending' ? createGithubStatus(name, step) : updateGithubStatus(name, state, step));
|
|
325
|
+
await setStatus('pending');
|
|
286
326
|
const mode = resolveNxSmartMode(options.mode ?? 'run-many');
|
|
287
|
-
const
|
|
327
|
+
const listProjects = dependencies.listProjects ?? listNxProjectsWithTarget;
|
|
328
|
+
const runNx = dependencies.runNx ?? ((args, commandRoot) => runStatus('nx', args, commandRoot));
|
|
329
|
+
const projects = await listProjects(root, 'deploy', mode);
|
|
288
330
|
if (projects.length === 0) {
|
|
289
|
-
console.log(`No ${mode} deploy projects
|
|
290
|
-
await
|
|
331
|
+
console.log(`No ${mode} deploy projects; skipping ${environment}.`);
|
|
332
|
+
await setStatus('success');
|
|
291
333
|
return;
|
|
292
334
|
}
|
|
293
335
|
const projectList = projects.join(',');
|
|
294
336
|
const targets = options.verify === true ? ['build', 'lint', 'test', 'deploy'] : ['deploy'];
|
|
295
337
|
for (const target of targets) {
|
|
296
|
-
const nxArgs = [
|
|
338
|
+
const nxArgs = [
|
|
339
|
+
'run-many',
|
|
340
|
+
'-t',
|
|
341
|
+
target,
|
|
342
|
+
`--projects=${projectList}`,
|
|
343
|
+
'--exclude=tag:permanent-deploy-target',
|
|
344
|
+
`--parallel=${NX_PARALLEL}`,
|
|
345
|
+
];
|
|
297
346
|
if (target === 'deploy') {
|
|
298
|
-
nxArgs.push(`--
|
|
347
|
+
nxArgs.push(`--environment=${environment}`);
|
|
299
348
|
}
|
|
300
|
-
const status = await
|
|
349
|
+
const status = await runNx(nxArgs, root);
|
|
301
350
|
if (status !== 0) {
|
|
302
|
-
await
|
|
351
|
+
await setStatus('failure');
|
|
303
352
|
throw new Error(`nx ${nxArgs.join(' ')} failed with exit code ${status}`);
|
|
304
353
|
}
|
|
305
354
|
}
|
|
306
|
-
|
|
355
|
+
if (isPullRequestEnvironment(environment)) {
|
|
356
|
+
const url = `https://app.${environment}.conloca.com`;
|
|
357
|
+
const summaryPath = processEnv.GITHUB_STEP_SUMMARY;
|
|
358
|
+
if (summaryPath) {
|
|
359
|
+
const appendSummary = dependencies.appendSummary ?? appendFile;
|
|
360
|
+
await appendSummary(summaryPath, `## ${environment} deployment\n\n[View deployment](${url})\n`);
|
|
361
|
+
}
|
|
362
|
+
const publishDeployment = dependencies.publishDeployment ??
|
|
363
|
+
((token, deploymentUrl) => publishGithubDeployment(token, deploymentUrl, processEnv));
|
|
364
|
+
await publishDeployment(environment, url);
|
|
365
|
+
}
|
|
366
|
+
if (environment !== 'production') {
|
|
367
|
+
const e2eProjects = await listProjects(root, 'e2e-deployed', 'run-many');
|
|
368
|
+
if (e2eProjects.length > 0) {
|
|
369
|
+
const nxArgs = [
|
|
370
|
+
'run-many',
|
|
371
|
+
'-t',
|
|
372
|
+
'e2e-deployed',
|
|
373
|
+
`--projects=${e2eProjects.join(',')}`,
|
|
374
|
+
`--parallel=${NX_PARALLEL}`,
|
|
375
|
+
`--environment=${environment}`,
|
|
376
|
+
];
|
|
377
|
+
const status = await runNx(nxArgs, root);
|
|
378
|
+
if (status !== 0) {
|
|
379
|
+
await setStatus('failure');
|
|
380
|
+
throw new Error(`nx ${nxArgs.join(' ')} failed with exit code ${status}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
await setStatus('success');
|
|
307
385
|
}
|
|
308
386
|
function resolveNxSmartMode(mode) {
|
|
309
387
|
if (mode === 'affected' || mode === 'run-many') {
|
|
@@ -336,24 +414,152 @@ function eventDefaultBranch() {
|
|
|
336
414
|
return undefined;
|
|
337
415
|
}
|
|
338
416
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
417
|
+
export function resolveDeploymentEnvironment(explicit, environment, event) {
|
|
418
|
+
if (explicit !== undefined)
|
|
419
|
+
return parseEnvironmentToken(explicit);
|
|
420
|
+
if (environment.GITHUB_EVENT_NAME === 'pull_request') {
|
|
421
|
+
if (!event?.action || !['opened', 'reopened', 'synchronize'].includes(event.action)) {
|
|
422
|
+
throw new Error('Pull-request deployment runs only for opened, reopened, or synchronize events.');
|
|
423
|
+
}
|
|
424
|
+
const repository = event.repository?.full_name;
|
|
425
|
+
const headRepository = event.pull_request?.head?.repo?.full_name;
|
|
426
|
+
if (!repository || !headRepository || repository !== headRepository) {
|
|
427
|
+
throw new Error('Pull-request deployment is restricted to same-repository pull requests.');
|
|
428
|
+
}
|
|
429
|
+
const number = event.pull_request?.number;
|
|
430
|
+
if (number === undefined)
|
|
431
|
+
throw new Error('GitHub pull_request event is missing its PR number.');
|
|
432
|
+
return pullRequestEnvironment(number);
|
|
433
|
+
}
|
|
434
|
+
if (environment.GITHUB_EVENT_NAME === 'push' && environment.GITHUB_REF_NAME === 'private') {
|
|
435
|
+
return 'staging';
|
|
436
|
+
}
|
|
437
|
+
if (environment.GITHUB_EVENT_NAME === 'release') {
|
|
438
|
+
return 'production';
|
|
439
|
+
}
|
|
440
|
+
throw new Error('Cannot resolve a deployment environment from this GitHub event; pass --environment explicitly.');
|
|
441
|
+
}
|
|
442
|
+
function readGithubActionsEvent(environment) {
|
|
443
|
+
const eventPath = environment.GITHUB_EVENT_PATH;
|
|
444
|
+
if (!eventPath)
|
|
445
|
+
return undefined;
|
|
446
|
+
try {
|
|
447
|
+
return parseGithubActionsEvent(readFileSync(eventPath, 'utf8')) || undefined;
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
async function listNxProjectsWithTarget(root, target, mode) {
|
|
454
|
+
const listArgs = ['show', 'projects'];
|
|
455
|
+
if (mode === 'affected')
|
|
456
|
+
listArgs.push('--affected');
|
|
457
|
+
listArgs.push('--withTarget', target);
|
|
458
|
+
if (target === 'deploy')
|
|
459
|
+
listArgs.push('--exclude=tag:permanent-deploy-target');
|
|
460
|
+
listArgs.push('--json');
|
|
343
461
|
const result = await $ `nx ${listArgs}`.cwd(root).quiet();
|
|
344
|
-
const candidates = nxProjectList(decode(result.stdout));
|
|
345
|
-
|
|
462
|
+
const candidates = nxProjectList(decode(result.stdout)).sort((left, right) => left.localeCompare(right));
|
|
463
|
+
if (target !== 'deploy')
|
|
464
|
+
return candidates;
|
|
465
|
+
return selectEnvironmentDeployProjects(candidates, async (project) => {
|
|
466
|
+
const projectResult = await $ `nx show project ${project} --json`.cwd(root).quiet();
|
|
467
|
+
const parsed = parseNxProjectDeployTarget(decode(projectResult.stdout));
|
|
468
|
+
if (!parsed)
|
|
469
|
+
throw new Error(`nx show project ${project} returned invalid JSON.`);
|
|
470
|
+
return parsed;
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
export async function selectEnvironmentDeployProjects(candidates, loadProject) {
|
|
474
|
+
const selected = [];
|
|
346
475
|
for (const project of candidates) {
|
|
347
|
-
|
|
348
|
-
|
|
476
|
+
const definition = await loadProject(project);
|
|
477
|
+
if (!isNxProjectDeployTarget(definition))
|
|
478
|
+
continue;
|
|
479
|
+
const deploy = definition.targets?.deploy;
|
|
480
|
+
const commandValue = deploy?.options?.command ?? deploy?.command;
|
|
481
|
+
if (typeof commandValue === 'string' && commandValue.includes('smoo wrangler deploy-environment')) {
|
|
482
|
+
selected.push(project);
|
|
349
483
|
}
|
|
350
484
|
}
|
|
351
|
-
return
|
|
485
|
+
return selected;
|
|
352
486
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
487
|
+
export class NodeGithubApiProcessRunner {
|
|
488
|
+
run(args, input, cwd) {
|
|
489
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
490
|
+
const child = spawn('gh', args, { cwd, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
491
|
+
let stdout = '';
|
|
492
|
+
let stderr = '';
|
|
493
|
+
child.stdout.setEncoding('utf8');
|
|
494
|
+
child.stderr.setEncoding('utf8');
|
|
495
|
+
child.stdout.on('data', (chunk) => {
|
|
496
|
+
stdout += chunk;
|
|
497
|
+
});
|
|
498
|
+
child.stderr.on('data', (chunk) => {
|
|
499
|
+
stderr += chunk;
|
|
500
|
+
});
|
|
501
|
+
child.once('error', reject);
|
|
502
|
+
child.once('close', (code) => {
|
|
503
|
+
resolve({ exitCode: code ?? -1, stdout, stderr });
|
|
504
|
+
});
|
|
505
|
+
child.stdin.end(input);
|
|
506
|
+
return promise;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
export async function publishGithubDeployment(environment, url, processEnvironment, runner = new NodeGithubApiProcessRunner()) {
|
|
510
|
+
const repository = processEnvironment.GITHUB_REPOSITORY;
|
|
511
|
+
const sha = processEnvironment.GITHUB_SHA;
|
|
512
|
+
if (!repository || !sha)
|
|
513
|
+
throw new Error('GITHUB_REPOSITORY and GITHUB_SHA are required to publish a deployment.');
|
|
514
|
+
const createBody = JSON.stringify({
|
|
515
|
+
ref: sha,
|
|
516
|
+
environment,
|
|
517
|
+
auto_merge: false,
|
|
518
|
+
required_contexts: [],
|
|
519
|
+
transient_environment: true,
|
|
520
|
+
production_environment: false,
|
|
521
|
+
});
|
|
522
|
+
const createResult = await runner.run([
|
|
523
|
+
'api',
|
|
524
|
+
'--method',
|
|
525
|
+
'POST',
|
|
526
|
+
'-H',
|
|
527
|
+
'Accept: application/vnd.github+json',
|
|
528
|
+
`/repos/${repository}/deployments`,
|
|
529
|
+
'--input',
|
|
530
|
+
'-',
|
|
531
|
+
], createBody, process.cwd());
|
|
532
|
+
if (createResult.exitCode !== 0) {
|
|
533
|
+
throw new Error(`GitHub deployment creation failed with exit code ${createResult.exitCode}: ${createResult.stderr.trim()}`);
|
|
534
|
+
}
|
|
535
|
+
let deployment;
|
|
536
|
+
try {
|
|
537
|
+
deployment = JSON.parse(createResult.stdout);
|
|
538
|
+
}
|
|
539
|
+
catch {
|
|
540
|
+
throw new Error('GitHub returned invalid JSON while creating a deployment.');
|
|
541
|
+
}
|
|
542
|
+
if (!isGithubDeployment(deployment))
|
|
543
|
+
throw new Error('GitHub returned an invalid deployment response.');
|
|
544
|
+
const statusBody = JSON.stringify({
|
|
545
|
+
state: 'success',
|
|
546
|
+
environment,
|
|
547
|
+
environment_url: url,
|
|
548
|
+
auto_inactive: false,
|
|
549
|
+
});
|
|
550
|
+
const statusResult = await runner.run([
|
|
551
|
+
'api',
|
|
552
|
+
'--method',
|
|
553
|
+
'POST',
|
|
554
|
+
'-H',
|
|
555
|
+
'Accept: application/vnd.github+json',
|
|
556
|
+
`/repos/${repository}/deployments/${deployment.id}/statuses`,
|
|
557
|
+
'--input',
|
|
558
|
+
'-',
|
|
559
|
+
], statusBody, process.cwd());
|
|
560
|
+
if (statusResult.exitCode !== 0) {
|
|
561
|
+
throw new Error(`GitHub deployment status failed with exit code ${statusResult.exitCode}: ${statusResult.stderr.trim()}`);
|
|
562
|
+
}
|
|
357
563
|
}
|
|
358
564
|
function nxProjectList(output) {
|
|
359
565
|
return parseStringArrayText(output) ?? [];
|
package/dist/lib/json.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface NxDependsOnObject {
|
|
|
65
65
|
export type NxDependsOn = string | NxDependsOnObject;
|
|
66
66
|
/** Nx target options are executor-specific open bags. */
|
|
67
67
|
export type NxTargetOptions = Record<string, unknown>;
|
|
68
|
-
export type NxInput = string |
|
|
68
|
+
export type NxInput = string | object;
|
|
69
69
|
export interface NxTargetConfig {
|
|
70
70
|
executor?: string;
|
|
71
71
|
dependsOn?: NxDependsOn[];
|
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;IACxB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,M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MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,EAChE,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,EAChE,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAM5F;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,iBAAiB,EAC7B,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,iBAAiB,EAC7B,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,WAAW,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAMT"}
|
package/dist/lib/json.js
CHANGED
|
@@ -30,12 +30,7 @@ export const parsePackageJsonText = (() => {
|
|
|
30
30
|
return true;
|
|
31
31
|
return "string" === typeof value;
|
|
32
32
|
});
|
|
33
|
-
const _io10 = (input, _vctx = {}) =>
|
|
34
|
-
const value = input[key];
|
|
35
|
-
if (undefined === value)
|
|
36
|
-
return true;
|
|
37
|
-
return true;
|
|
38
|
-
});
|
|
33
|
+
const _io10 = (input, _vctx = {}) => true;
|
|
39
34
|
const _io11 = (input, _vctx = {}) => Object.keys(input).every(key => {
|
|
40
35
|
const value = input[key];
|
|
41
36
|
if (undefined === value)
|
|
@@ -76,12 +71,7 @@ export const parseNxProjectJsonText = (() => {
|
|
|
76
71
|
})) || (_vctx.io1.delete(input), false));
|
|
77
72
|
const _io2 = (input, _vctx = {}) => (_vctx.io2 || (_vctx.io2 = new WeakSet())).has(input) ? true : (_vctx.io2.add(input), ((undefined === input.executor || "string" === typeof input.executor) && (undefined === input.dependsOn || Array.isArray(input.dependsOn) && input.dependsOn.every(elem => null !== elem && undefined !== elem && ("string" === typeof elem || "object" === typeof elem && null !== elem && _io3(elem, _vctx)))) && (undefined === input.outputs || Array.isArray(input.outputs) && input.outputs.every(elem => "string" === typeof elem)) && (undefined === input.inputs || Array.isArray(input.inputs) && input.inputs.every(elem => null !== elem && undefined !== elem && ("string" === typeof elem || "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io4(elem, _vctx)))) && (undefined === input.options || "object" === typeof input.options && null !== input.options && false === Array.isArray(input.options) && _io5(input.options, _vctx)) && (undefined === input.configurations || "object" === typeof input.configurations && null !== input.configurations && false === Array.isArray(input.configurations) && _io1(input.configurations, _vctx)) && (undefined === input.cache || "boolean" === typeof input.cache) && (undefined === input.command || "string" === typeof input.command) && (undefined === input.parallelism || "boolean" === typeof input.parallelism)) || (_vctx.io2.delete(input), false));
|
|
78
73
|
const _io3 = (input, _vctx = {}) => "string" === typeof input.target && (null !== input.projects && (undefined === input.projects || "string" === typeof input.projects || Array.isArray(input.projects) && input.projects.every(elem => "string" === typeof elem)));
|
|
79
|
-
const _io4 = (input, _vctx = {}) =>
|
|
80
|
-
const value = input[key];
|
|
81
|
-
if (undefined === value)
|
|
82
|
-
return true;
|
|
83
|
-
return true;
|
|
84
|
-
});
|
|
74
|
+
const _io4 = (input, _vctx = {}) => true;
|
|
85
75
|
const _io5 = (input, _vctx = {}) => Object.keys(input).every(key => {
|
|
86
76
|
const value = input[key];
|
|
87
77
|
if (undefined === value)
|
|
@@ -143,12 +133,7 @@ const isPackageJsonValue = (() => {
|
|
|
143
133
|
return true;
|
|
144
134
|
return "string" === typeof value;
|
|
145
135
|
});
|
|
146
|
-
const _io10 = (input, _vctx = {}) =>
|
|
147
|
-
const value = input[key];
|
|
148
|
-
if (undefined === value)
|
|
149
|
-
return true;
|
|
150
|
-
return true;
|
|
151
|
-
});
|
|
136
|
+
const _io10 = (input, _vctx = {}) => true;
|
|
152
137
|
const _io11 = (input, _vctx = {}) => Object.keys(input).every(key => {
|
|
153
138
|
const value = input[key];
|
|
154
139
|
if (undefined === value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/lib/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGvB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,yBAAyB,YACpC,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,CACd,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAA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,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAehE;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI,CAa1F;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAEtE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,EAAE,CAMpD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,cAAc,GAAG,IAAI,CAatE;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAErF;AA6BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
package/dist/lib/workspace.js
CHANGED
|
@@ -74,6 +74,7 @@ function listWorkspacePackageJsonPaths(root, workspacePatterns) {
|
|
|
74
74
|
const paths = [];
|
|
75
75
|
for (const pattern of workspacePatterns) {
|
|
76
76
|
if (!pattern.endsWith('/*')) {
|
|
77
|
+
paths.push(join(root, pattern, 'package.json'));
|
|
77
78
|
continue;
|
|
78
79
|
}
|
|
79
80
|
const parent = join(root, pattern.slice(0, -2));
|