@smoothbricks/cli 0.11.15 → 0.11.17
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 +43 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +44 -0
- package/dist/github-ci/index.d.ts +1 -1
- package/dist/github-ci/index.d.ts.map +1 -1
- package/dist/github-ci/index.js +7 -10
- package/dist/lib/json.d.ts +9 -0
- package/dist/lib/json.d.ts.map +1 -1
- package/dist/lib/json.js +65 -53
- package/dist/lib/secret-names.d.ts +35 -0
- package/dist/lib/secret-names.d.ts.map +1 -0
- package/dist/lib/secret-names.js +61 -0
- package/dist/monorepo/ci-workflow.d.ts.map +1 -1
- package/dist/monorepo/ci-workflow.js +15 -6
- package/dist/monorepo/managed-files.d.ts +9 -0
- package/dist/monorepo/managed-files.d.ts.map +1 -1
- package/dist/monorepo/managed-files.js +28 -2
- package/dist/monorepo/publish-workflow.d.ts +10 -1
- package/dist/monorepo/publish-workflow.d.ts.map +1 -1
- package/dist/monorepo/publish-workflow.js +110 -22
- package/dist/release/index.d.ts +1 -1
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +26 -4
- package/dist/release/private-npm.d.ts +5 -0
- package/dist/release/private-npm.d.ts.map +1 -1
- package/dist/release/private-npm.js +26 -5
- package/dist/secrets/commands.d.ts +45 -0
- package/dist/secrets/commands.d.ts.map +1 -0
- package/dist/secrets/commands.js +189 -0
- package/dist/secrets/index.d.ts +83 -0
- package/dist/secrets/index.d.ts.map +1 -0
- package/dist/secrets/index.js +149 -0
- package/dist/wrangler/deploy-stage.d.ts +13 -2
- package/dist/wrangler/deploy-stage.d.ts.map +1 -1
- package/dist/wrangler/deploy-stage.js +39 -54
- package/dist/wrangler/deployed-version.d.ts +44 -0
- package/dist/wrangler/deployed-version.d.ts.map +1 -0
- package/dist/wrangler/deployed-version.js +87 -0
- package/dist/wrangler/live-version.d.ts +146 -0
- package/dist/wrangler/live-version.d.ts.map +1 -0
- package/dist/wrangler/live-version.js +326 -0
- package/managed/raw/tooling/direnv/devenv.smoo.nix +4 -2
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +4 -1
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +88 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +1 -1
- package/package.json +2 -2
- package/src/cli.ts +46 -1
- package/src/github-ci/index.test.ts +92 -8
- package/src/github-ci/index.ts +7 -10
- package/src/lib/json.ts +9 -0
- package/src/lib/secret-names.ts +70 -0
- package/src/monorepo/__tests__/ci-workflow.test.ts +27 -2
- package/src/monorepo/__tests__/publish-workflow.test.ts +85 -13
- package/src/monorepo/ci-workflow.ts +17 -6
- package/src/monorepo/managed-files.test.ts +26 -0
- package/src/monorepo/managed-files.ts +36 -2
- package/src/monorepo/publish-workflow.ts +135 -21
- package/src/monorepo/secret-references.test.ts +1 -1
- package/src/release/__tests__/private-npm-status.test.ts +37 -0
- package/src/release/__tests__/private-npm-workflow.test.ts +20 -0
- package/src/release/index.ts +27 -2
- package/src/release/private-npm.ts +30 -5
- package/src/secrets/commands.ts +210 -0
- package/src/secrets/index.test.ts +92 -0
- package/src/secrets/index.ts +183 -0
- package/src/wrangler/deploy-stage.test.ts +190 -12
- package/src/wrangler/deploy-stage.ts +72 -45
- package/src/wrangler/deployed-version.test.ts +150 -0
- package/src/wrangler/deployed-version.ts +130 -0
- package/src/wrangler/live-version.ts +363 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One rule for naming the repository secret behind an environment variable, so
|
|
3
|
+
* the workflow renderer, the reconciler and an operator all derive the same
|
|
4
|
+
* name instead of maintaining a map.
|
|
5
|
+
*
|
|
6
|
+
* GitHub refuses to create a secret whose name starts with `GITHUB_` (hence
|
|
7
|
+
* `RepositorySecretName`'s pattern), which is why a Worker's
|
|
8
|
+
* `GITHUB_CLIENT_SECRET` cannot be stored under its own name. Prefixing with
|
|
9
|
+
* the repository owner is the workaround operators already reach for by hand
|
|
10
|
+
* (`ACME_GITHUB_CLIENT_SECRET` for `acme/app`); making it the convention means
|
|
11
|
+
* nothing has to declare it.
|
|
12
|
+
*/
|
|
13
|
+
/** Names GitHub reserves: it rejects `gh secret set GITHUB_*` outright. */
|
|
14
|
+
export declare function isReservedRepositorySecretName(envName: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The repository secret an env name lives in. Identity for every name GitHub
|
|
17
|
+
* accepts; owner-prefixed for the reserved ones. `owner` comes from the
|
|
18
|
+
* repository URL, so a fork or a rename derives its own names rather than
|
|
19
|
+
* inheriting a hardcoded prefix.
|
|
20
|
+
*/
|
|
21
|
+
export declare function conventionalRepositorySecretName(envName: string, owner: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the whole env -> secret mapping for a set of declared env names.
|
|
24
|
+
* Explicit entries win: an exception stays expressible, but a repository that
|
|
25
|
+
* follows the convention declares nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function repositorySecretMapping(envNames: readonly string[], owner: string, declared?: Readonly<Record<string, string>>): Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Repository owner from a repository URL — `acme` from
|
|
30
|
+
* `https://github.com/acme/app.git`, and the same for an ssh or forge
|
|
31
|
+
* URL. The owner is derived rather than configured so a fork or a rename
|
|
32
|
+
* carries its own prefix instead of inheriting one.
|
|
33
|
+
*/
|
|
34
|
+
export declare function repositoryOwnerFromUrl(url: string): string | null;
|
|
35
|
+
//# sourceMappingURL=secret-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-names.d.ts","sourceRoot":"","sources":["../../src/lib/secret-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,2EAA2E;AAC3E,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAC9C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKjE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One rule for naming the repository secret behind an environment variable, so
|
|
3
|
+
* the workflow renderer, the reconciler and an operator all derive the same
|
|
4
|
+
* name instead of maintaining a map.
|
|
5
|
+
*
|
|
6
|
+
* GitHub refuses to create a secret whose name starts with `GITHUB_` (hence
|
|
7
|
+
* `RepositorySecretName`'s pattern), which is why a Worker's
|
|
8
|
+
* `GITHUB_CLIENT_SECRET` cannot be stored under its own name. Prefixing with
|
|
9
|
+
* the repository owner is the workaround operators already reach for by hand
|
|
10
|
+
* (`ACME_GITHUB_CLIENT_SECRET` for `acme/app`); making it the convention means
|
|
11
|
+
* nothing has to declare it.
|
|
12
|
+
*/
|
|
13
|
+
/** Names GitHub reserves: it rejects `gh secret set GITHUB_*` outright. */
|
|
14
|
+
export function isReservedRepositorySecretName(envName) {
|
|
15
|
+
return /^GITHUB_/i.test(envName);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The repository secret an env name lives in. Identity for every name GitHub
|
|
19
|
+
* accepts; owner-prefixed for the reserved ones. `owner` comes from the
|
|
20
|
+
* repository URL, so a fork or a rename derives its own names rather than
|
|
21
|
+
* inheriting a hardcoded prefix.
|
|
22
|
+
*/
|
|
23
|
+
export function conventionalRepositorySecretName(envName, owner) {
|
|
24
|
+
if (!isReservedRepositorySecretName(envName))
|
|
25
|
+
return envName;
|
|
26
|
+
const prefix = owner
|
|
27
|
+
.replace(/[^A-Za-z0-9]+/g, '_')
|
|
28
|
+
.replace(/^_+|_+$/g, '')
|
|
29
|
+
.toUpperCase();
|
|
30
|
+
if (prefix.length === 0) {
|
|
31
|
+
throw new Error(`Cannot derive a repository secret name for ${envName}: GitHub reserves the GITHUB_ prefix and the repository owner is empty.`);
|
|
32
|
+
}
|
|
33
|
+
return `${prefix}_${envName}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the whole env -> secret mapping for a set of declared env names.
|
|
37
|
+
* Explicit entries win: an exception stays expressible, but a repository that
|
|
38
|
+
* follows the convention declares nothing.
|
|
39
|
+
*/
|
|
40
|
+
export function repositorySecretMapping(envNames, owner, declared = {}) {
|
|
41
|
+
const mapping = {};
|
|
42
|
+
for (const envName of [...envNames].sort((left, right) => left.localeCompare(right))) {
|
|
43
|
+
mapping[envName] = declared[envName] ?? conventionalRepositorySecretName(envName, owner);
|
|
44
|
+
}
|
|
45
|
+
for (const [envName, secretName] of Object.entries(declared)) {
|
|
46
|
+
mapping[envName] = secretName;
|
|
47
|
+
}
|
|
48
|
+
return mapping;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Repository owner from a repository URL — `acme` from
|
|
52
|
+
* `https://github.com/acme/app.git`, and the same for an ssh or forge
|
|
53
|
+
* URL. The owner is derived rather than configured so a fork or a rename
|
|
54
|
+
* carries its own prefix instead of inheriting one.
|
|
55
|
+
*/
|
|
56
|
+
export function repositoryOwnerFromUrl(url) {
|
|
57
|
+
const withoutProtocol = url.replace(/^[a-z+]+:\/\//i, '').replace(/^git@/i, '');
|
|
58
|
+
const path = withoutProtocol.replace(/^[^/:]+[/:]/, '');
|
|
59
|
+
const owner = path.split('/')[0];
|
|
60
|
+
return owner && owner.length > 0 ? owner.replace(/\.git$/i, '') : null;
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../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,MAAM,EAAE,CA+BV;AAED,6EAA6E;AAC7E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,2BAA2B,GAAG,2BAA2B,CA8BxG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,GAAG,MAAM,CAS3F;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,wBAAwB,GAAG,wBAAwB,CAgB/F;AA+BD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,6BAA6B,GAAG,SAAS,GAAG,MAAM,CASpG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,6BAA6B,GAAG,MAAM,EAAE,CAyG9G;AAqCD,6EAA6E;AAC7E,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,6BAA6B,GAAG,6BAA6B,CAkC9G;AAqGD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAIjC,CAAC;AAiCF;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,CAMjF;AAgID,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,UAAU,EAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,SAAc,GACtB,MAAM,EAAE,CAmBV"}
|
|
@@ -64,12 +64,19 @@ permissions:
|
|
|
64
64
|
${options.deploy ? ' deployments: write\n' : ''} statuses: write
|
|
65
65
|
|
|
66
66
|
concurrency:
|
|
67
|
-
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
67
|
+
${options.deploy
|
|
68
|
+
? ` # One in-flight run per ref. Pushes to the staging push branch queue behind a
|
|
69
|
+
# running workflow instead of canceling it, so a newer push never cancels the
|
|
70
|
+
# deploy job mid-flight. Pull requests and other branches keep canceling
|
|
71
|
+
# superseded runs.
|
|
71
72
|
group: \${{ github.workflow }}-\${{ github.ref }}
|
|
72
|
-
cancel-in-progress: \${{ github.ref != ${stagingRefLiteral(options)} }}
|
|
73
|
+
cancel-in-progress: \${{ github.ref != ${stagingRefLiteral(options)} }}`
|
|
74
|
+
: ` # This workflow validates and never deploys, so there is no in-flight
|
|
75
|
+
# deployment for a newer push to protect: every ref cancels its superseded
|
|
76
|
+
# runs. Queuing them instead serializes the staging branch, and a burst of
|
|
77
|
+
# pushes then reports the newest commit one full run per queued push late.
|
|
78
|
+
group: \${{ github.workflow }}-\${{ github.ref }}
|
|
79
|
+
cancel-in-progress: true`}
|
|
73
80
|
|
|
74
81
|
defaults:
|
|
75
82
|
run:
|
|
@@ -828,6 +835,7 @@ function renderProductionDeployJob(options) {
|
|
|
828
835
|
needs: ${needs}
|
|
829
836
|
${renderRunsOnLine(options.runsOn)}
|
|
830
837
|
timeout-minutes: 30
|
|
838
|
+
# prettier-ignore
|
|
831
839
|
if: \${{ !cancelled() && github.event_name == 'push' && github.ref == ${stagingRefLiteral(options)} && needs.main.result == 'success'${e2eGate} }}
|
|
832
840
|
${environmentLine(options.environments?.production)} env:
|
|
833
841
|
GH_TOKEN: \${{ github.token }}
|
|
@@ -835,7 +843,8 @@ ${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(optio
|
|
|
835
843
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
836
844
|
# Step ${numbers.middle}
|
|
837
845
|
- name: 🚀 Deploy Production
|
|
838
|
-
${renderOptionalLines(deployStepSecretEnvLines(options))}
|
|
846
|
+
${renderOptionalLines(deployStepSecretEnvLines(options))} # prettier-ignore
|
|
847
|
+
run: smoo github-ci nx-deploy --stage production --mode run-many --select-tag ${PRODUCTION_PUSH_DEPLOY_TAG} --name "Deploy Production" --step ${numbers.middle}
|
|
839
848
|
|
|
840
849
|
${renderCiWorkflowSteps(followUpCleanupStep(numbers), options)}`;
|
|
841
850
|
}
|
|
@@ -70,6 +70,8 @@ export interface ManagedFileContext {
|
|
|
70
70
|
nodeModulesCacheKey: string;
|
|
71
71
|
repoName: string;
|
|
72
72
|
platformTargetGlobs: string[];
|
|
73
|
+
/** Platform families the release workflow produces; excluded families are absent. */
|
|
74
|
+
releasePlatformTargetGlobs: string[];
|
|
73
75
|
macosPlatformArchitectures: string[];
|
|
74
76
|
/** Declared private-npm opt-in from the root smoo config; absent means fully public. */
|
|
75
77
|
privateNpm?: PackagePrivateNpmConfig;
|
|
@@ -92,6 +94,13 @@ export declare function applyManagedFiles(root: string, mode: 'update' | 'check'
|
|
|
92
94
|
/** Renders a generated workflow through its real managed-file descriptor, so the context wiring is covered. */
|
|
93
95
|
export declare function renderManagedWorkflowForTest(source: 'ci-workflow' | 'publish-workflow', context: ManagedFileContext): string;
|
|
94
96
|
export declare function hasExactTargetForTest(targetNames: Iterable<string>, target: string): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The platform families the release workflow produces: the graph's families
|
|
99
|
+
* minus the ones the repository excludes. Excluding a family the graph does not
|
|
100
|
+
* have is not an error — a repository states what it does not release, and the
|
|
101
|
+
* statement stays true when the target is added later.
|
|
102
|
+
*/
|
|
103
|
+
export declare function releasePlatformTargetGlobsFor(platformTargetGlobs: readonly string[], excluded: readonly string[] | undefined): string[];
|
|
95
104
|
export declare function platformTargetGlobsForTest(targetNames: Iterable<string>): string[];
|
|
96
105
|
/**
|
|
97
106
|
* Test seam: the architectures the macOS platform job must fan out over,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managed-files.d.ts","sourceRoot":"","sources":["../../src/monorepo/managed-files.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,6BAA6B,EAElC,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACt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0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY/D;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBxE"}
|
|
@@ -135,6 +135,12 @@ const managedFiles = [
|
|
|
135
135
|
source: 'tooling/direnv/secret-references.ts',
|
|
136
136
|
target: 'tooling/direnv/secret-references.ts',
|
|
137
137
|
},
|
|
138
|
+
{
|
|
139
|
+
kind: 'raw',
|
|
140
|
+
source: 'tooling/direnv/toolchain-stamp.ts',
|
|
141
|
+
target: 'tooling/direnv/toolchain-stamp.ts',
|
|
142
|
+
executable: true,
|
|
143
|
+
},
|
|
138
144
|
{
|
|
139
145
|
kind: 'raw',
|
|
140
146
|
source: 'tooling/direnv/devenv.smoo.nix',
|
|
@@ -309,7 +315,7 @@ function getManagedContent(file, context) {
|
|
|
309
315
|
release: context.hasReleasePackages,
|
|
310
316
|
deployProvider: context.productionDeployProvider,
|
|
311
317
|
repoName: context.repoName,
|
|
312
|
-
platformTargetGlobs: context.
|
|
318
|
+
platformTargetGlobs: context.releasePlatformTargetGlobs,
|
|
313
319
|
macosPlatformArchitectures: context.macosPlatformArchitectures,
|
|
314
320
|
runsOn: context.ciRunsOn,
|
|
315
321
|
macosRunsOn: context.macosRunsOn,
|
|
@@ -350,6 +356,11 @@ async function getManagedFileContext(root) {
|
|
|
350
356
|
const productionDeploy = deployTargetInfoFromProjects(nxProjects, 'production');
|
|
351
357
|
const targetNames = targetNamesFromProjects(nxProjects);
|
|
352
358
|
const platformTargetGlobs = platformTargetGlobsForTest(targetNames);
|
|
359
|
+
// The release workflow produces every platform family the graph carries
|
|
360
|
+
// EXCEPT the ones the repository excludes. An excluded family renders no job
|
|
361
|
+
// at all rather than a job whose failure blocks every release; the workflow
|
|
362
|
+
// that does own it says so itself.
|
|
363
|
+
const releasePlatformTargetGlobs = releasePlatformTargetGlobsFor(platformTargetGlobs, github?.releasePlatformFamiliesExcluded);
|
|
353
364
|
const privateNpm = resolvePrivateNpmWorkflowConfig(root);
|
|
354
365
|
// Cache registry identity plus the lockfile, never token values: a scope
|
|
355
366
|
// URL change in the committed .npmrc must invalidate the dependency cache,
|
|
@@ -378,16 +389,31 @@ async function getManagedFileContext(root) {
|
|
|
378
389
|
nodeModulesCacheKey,
|
|
379
390
|
repoName,
|
|
380
391
|
platformTargetGlobs,
|
|
392
|
+
releasePlatformTargetGlobs,
|
|
381
393
|
sourceCheckouts,
|
|
382
394
|
cargoCredentials,
|
|
383
395
|
remoteCache: manifest?.smoo?.remoteCache,
|
|
384
|
-
macosPlatformArchitectures:
|
|
396
|
+
macosPlatformArchitectures: MACOS_PLATFORM_TARGET_GLOBS.some((glob) => releasePlatformTargetGlobs.includes(glob))
|
|
397
|
+
? macosPlatformArchitecturesForTest(targetNames)
|
|
398
|
+
: [],
|
|
385
399
|
privateNpm,
|
|
386
400
|
};
|
|
387
401
|
}
|
|
388
402
|
export function hasExactTargetForTest(targetNames, target) {
|
|
389
403
|
return [...targetNames].includes(target);
|
|
390
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* The platform families the release workflow produces: the graph's families
|
|
407
|
+
* minus the ones the repository excludes. Excluding a family the graph does not
|
|
408
|
+
* have is not an error — a repository states what it does not release, and the
|
|
409
|
+
* statement stays true when the target is added later.
|
|
410
|
+
*/
|
|
411
|
+
export function releasePlatformTargetGlobsFor(platformTargetGlobs, excluded) {
|
|
412
|
+
if (!excluded || excluded.length === 0)
|
|
413
|
+
return [...platformTargetGlobs];
|
|
414
|
+
const drop = new Set(excluded);
|
|
415
|
+
return platformTargetGlobs.filter((glob) => !drop.has(glob));
|
|
416
|
+
}
|
|
391
417
|
export function platformTargetGlobsForTest(targetNames) {
|
|
392
418
|
const names = [...targetNames];
|
|
393
419
|
return PLATFORM_TARGET_GLOBS.filter((glob) => {
|
|
@@ -2,7 +2,7 @@ import type { PackageCargoCredentialsConfig, PackagePrivateNpmConfig, PackageRem
|
|
|
2
2
|
import { type DeployStepSecretConfig } from './ci-workflow.js';
|
|
3
3
|
import { type WorkflowRunsOn } from './github-runs-on.js';
|
|
4
4
|
export type PublishWorkflowBump = 'auto' | 'patch' | 'minor' | 'major' | 'prerelease';
|
|
5
|
-
export type PublishWorkflowCondition = 'version-mode-not-none' | 'deploy-production' | 'deploy-production-standalone' | 'failure' | 'always';
|
|
5
|
+
export type PublishWorkflowCondition = 'plan-mode-not-none' | 'version-mode-not-none' | 'deploy-production' | 'deploy-production-standalone' | 'failure' | 'always';
|
|
6
6
|
export type PublishWorkflowNxTarget = 'build' | 'lint' | 'test';
|
|
7
7
|
export type PublishWorkflowDeployStage = 'none' | 'production';
|
|
8
8
|
export declare enum PublishWorkflowStepKind {
|
|
@@ -13,6 +13,7 @@ export declare enum PublishWorkflowStepKind {
|
|
|
13
13
|
ConfigureReleaseAuthor = "configure-release-author",
|
|
14
14
|
BuildNxVersionActions = "build-nx-version-actions",
|
|
15
15
|
RepairPendingReleases = "repair-pending-releases",
|
|
16
|
+
PlanRelease = "plan-release",
|
|
16
17
|
VersionRelease = "version-release",
|
|
17
18
|
CheckManagedMonorepoFiles = "check-managed-monorepo-files",
|
|
18
19
|
Build = "build",
|
|
@@ -105,6 +106,14 @@ export interface PublishWorkflowCallbacks {
|
|
|
105
106
|
bump: PublishWorkflowBump;
|
|
106
107
|
dryRun: boolean;
|
|
107
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>;
|
|
108
117
|
checkManagedMonorepoFiles(): Promise<void>;
|
|
109
118
|
nxRunMany(input: {
|
|
110
119
|
target: PublishWorkflowNxTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-workflow.d.ts","sourceRoot":"","sources":["../../src/monorepo/publish-workflow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,KAAK,sBAAsB,EAI5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAsBxG,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;AACtF,MAAM,MAAM,wBAAwB,GAChC,uBAAuB,GACvB,mBAAmB,GACnB,8BAA8B,GAC9B,SAAS,GACT,QAAQ,CAAC;AACb,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAChE,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,YAAY,CAAC;AAE/D,oBAAY,uBAAuB;IACjC,QAAQ,aAAa;IACrB,eAAe,qBAAqB;IACpC,gBAAgB,sBAAsB;IACtC,WAAW,iBAAiB;IAC5B,sBAAsB,6BAA6B;IACnD,qBAAqB,6BAA6B;IAClD,qBAAqB,4BAA4B;IACjD,cAAc,oBAAoB;IAClC,yBAAyB,iCAAiC;IAC1D,KAAK,UAAU;IACf,IAAI,SAAS;IACb,SAAS,eAAe;IACxB,cAAc,qBAAqB;IACnC,sBAAsB,6BAA6B;IACnD,UAAU,gBAAgB;IAC1B,cAAc,oBAAoB;IAClC,gBAAgB,sBAAsB;IACtC,aAAa,oBAAoB;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM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CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrF,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,aAAa,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,wBAAwB,CAAC;CACrC;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,6BAA6B,CAAC;IACvC,MAAM,EAAE,OAAO,CAAC;CACjB;AAID,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,gCAAqC,GAAG,yBAAyB,CA2F/G;AAkCD,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,yBAAyB,EACnC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAwFnC;AA2BD,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,gCAAqC,GAAG,MAAM,CA0BhG"}
|
|
@@ -31,6 +31,7 @@ export var PublishWorkflowStepKind;
|
|
|
31
31
|
PublishWorkflowStepKind["ConfigureReleaseAuthor"] = "configure-release-author";
|
|
32
32
|
PublishWorkflowStepKind["BuildNxVersionActions"] = "build-nx-version-actions";
|
|
33
33
|
PublishWorkflowStepKind["RepairPendingReleases"] = "repair-pending-releases";
|
|
34
|
+
PublishWorkflowStepKind["PlanRelease"] = "plan-release";
|
|
34
35
|
PublishWorkflowStepKind["VersionRelease"] = "version-release";
|
|
35
36
|
PublishWorkflowStepKind["CheckManagedMonorepoFiles"] = "check-managed-monorepo-files";
|
|
36
37
|
PublishWorkflowStepKind["Build"] = "build";
|
|
@@ -45,6 +46,9 @@ export var PublishWorkflowStepKind;
|
|
|
45
46
|
})(PublishWorkflowStepKind || (PublishWorkflowStepKind = {}));
|
|
46
47
|
export function definePublishWorkflow(options = {}) {
|
|
47
48
|
const versionMode = githubExpression('steps.version.outputs.mode');
|
|
49
|
+
// Steps that run before the bump must label themselves from the plan: the
|
|
50
|
+
// version step's outputs do not exist yet, so the interpolation renders empty.
|
|
51
|
+
const planMode = githubExpression('steps.plan.outputs.mode');
|
|
48
52
|
if (options.release === false) {
|
|
49
53
|
return { steps: defineDeployOnlyWorkflowSteps(options) };
|
|
50
54
|
}
|
|
@@ -86,30 +90,37 @@ export function definePublishWorkflow(options = {}) {
|
|
|
86
90
|
kind: PublishWorkflowStepKind.RepairPendingReleases,
|
|
87
91
|
name: '🧯 Repair pending releases',
|
|
88
92
|
},
|
|
89
|
-
|
|
93
|
+
// Plan first, gate second, bump third. Lint and test hash the source, so
|
|
94
|
+
// running them BEFORE the version commit means their task hashes match
|
|
95
|
+
// the ones ci already computed for the same source — the publish reuses
|
|
96
|
+
// that cache instead of re-running 189 tasks. Build stays after the bump
|
|
97
|
+
// on purpose: an artifact built from pre-bump sources would ship the
|
|
98
|
+
// previous version string.
|
|
99
|
+
{ kind: PublishWorkflowStepKind.PlanRelease, name: '🧭 Plan release', id: 'plan' },
|
|
90
100
|
{
|
|
91
101
|
kind: PublishWorkflowStepKind.CheckManagedMonorepoFiles,
|
|
92
|
-
name: `✅ Check managed monorepo files (${
|
|
93
|
-
condition: '
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
kind: PublishWorkflowStepKind.Build,
|
|
97
|
-
name: `🔨 Build (${versionMode})`,
|
|
98
|
-
condition: 'version-mode-not-none',
|
|
99
|
-
nxTarget: 'build',
|
|
102
|
+
name: `✅ Check managed monorepo files (${planMode})`,
|
|
103
|
+
condition: 'plan-mode-not-none',
|
|
100
104
|
},
|
|
101
105
|
{
|
|
102
106
|
kind: PublishWorkflowStepKind.Lint,
|
|
103
|
-
name: `🔍 Lint (${
|
|
104
|
-
condition: '
|
|
107
|
+
name: `🔍 Lint (${planMode})`,
|
|
108
|
+
condition: 'plan-mode-not-none',
|
|
105
109
|
nxTarget: 'lint',
|
|
106
110
|
},
|
|
107
111
|
{
|
|
108
112
|
kind: PublishWorkflowStepKind.UnitTests,
|
|
109
|
-
name: `🧪 Unit Tests (${
|
|
110
|
-
condition: '
|
|
113
|
+
name: `🧪 Unit Tests (${planMode})`,
|
|
114
|
+
condition: 'plan-mode-not-none',
|
|
111
115
|
nxTarget: 'test',
|
|
112
116
|
},
|
|
117
|
+
{ kind: PublishWorkflowStepKind.VersionRelease, name: '🔢 Version release', id: 'version' },
|
|
118
|
+
{
|
|
119
|
+
kind: PublishWorkflowStepKind.Build,
|
|
120
|
+
name: `🔨 Build (${versionMode})`,
|
|
121
|
+
condition: 'version-mode-not-none',
|
|
122
|
+
nxTarget: 'build',
|
|
123
|
+
},
|
|
113
124
|
{ kind: PublishWorkflowStepKind.UploadTraceDbs, name: '📎 Upload trace DBs', condition: 'failure' },
|
|
114
125
|
{
|
|
115
126
|
kind: PublishWorkflowStepKind.ValidateMonorepoConfig,
|
|
@@ -158,10 +169,11 @@ function numberWorkflowSteps(steps) {
|
|
|
158
169
|
export async function runPublishWorkflow(workflow, context) {
|
|
159
170
|
let setupOutputs = { nixCacheHit: '', devenvCacheHit: '' };
|
|
160
171
|
let version = { mode: 'none', projects: [] };
|
|
172
|
+
let plan = { mode: 'none', projects: [] };
|
|
161
173
|
let failed = false;
|
|
162
174
|
let failure;
|
|
163
175
|
for (const step of workflow.steps) {
|
|
164
|
-
if (!shouldRunStep(step, version, failed, context.inputs)) {
|
|
176
|
+
if (!shouldRunStep(step, version, failed, context.inputs, plan)) {
|
|
165
177
|
continue;
|
|
166
178
|
}
|
|
167
179
|
try {
|
|
@@ -187,6 +199,11 @@ export async function runPublishWorkflow(workflow, context) {
|
|
|
187
199
|
dryRun: context.inputs.dryRun,
|
|
188
200
|
});
|
|
189
201
|
break;
|
|
202
|
+
case PublishWorkflowStepKind.PlanRelease:
|
|
203
|
+
plan = context.callbacks.planRelease
|
|
204
|
+
? await context.callbacks.planRelease({ bump: context.inputs.bump })
|
|
205
|
+
: await context.callbacks.versionRelease({ bump: context.inputs.bump, dryRun: true });
|
|
206
|
+
break;
|
|
190
207
|
case PublishWorkflowStepKind.VersionRelease:
|
|
191
208
|
version = await context.callbacks.versionRelease(context.inputs);
|
|
192
209
|
break;
|
|
@@ -199,7 +216,12 @@ export async function runPublishWorkflow(workflow, context) {
|
|
|
199
216
|
if (!step.nxTarget) {
|
|
200
217
|
throw new Error(`Workflow step ${step.kind} is missing an Nx target.`);
|
|
201
218
|
}
|
|
202
|
-
|
|
219
|
+
// Lint and test run before the bump exists, so they select from the
|
|
220
|
+
// plan; build runs after it and selects from the written version.
|
|
221
|
+
await context.callbacks.nxRunMany({
|
|
222
|
+
target: step.nxTarget,
|
|
223
|
+
projects: step.kind === PublishWorkflowStepKind.Build ? version.projects : plan.projects,
|
|
224
|
+
});
|
|
203
225
|
break;
|
|
204
226
|
case PublishWorkflowStepKind.UploadTraceDbs:
|
|
205
227
|
await context.callbacks.uploadTraceDbs();
|
|
@@ -234,7 +256,10 @@ export async function runPublishWorkflow(workflow, context) {
|
|
|
234
256
|
}
|
|
235
257
|
return { version, failed };
|
|
236
258
|
}
|
|
237
|
-
function shouldRunStep(step, version, failed, inputs) {
|
|
259
|
+
function shouldRunStep(step, version, failed, inputs, plan = version) {
|
|
260
|
+
if (step.condition === 'plan-mode-not-none') {
|
|
261
|
+
return plan.mode !== 'none';
|
|
262
|
+
}
|
|
238
263
|
if (step.condition === 'version-mode-not-none') {
|
|
239
264
|
return version.mode !== 'none';
|
|
240
265
|
}
|
|
@@ -255,9 +280,16 @@ export function renderPublishWorkflowYaml(options = {}) {
|
|
|
255
280
|
const steps = definePublishWorkflow(options).steps;
|
|
256
281
|
workflow = `${renderPublishWorkflowHeader(options)}${renderPublishWorkflowSteps(steps, options)}`;
|
|
257
282
|
}
|
|
258
|
-
else if (hasMacosPlatformTargets(options)) {
|
|
283
|
+
else if (hasMacosPlatformTargets(options) && !skipsPublishHandoff(options)) {
|
|
259
284
|
workflow = renderPlatformPublishWorkflowYaml(options);
|
|
260
285
|
}
|
|
286
|
+
else if (hasMacosPlatformTargets(options)) {
|
|
287
|
+
// A linux-cross producer runs the Apple targets on the publisher's own
|
|
288
|
+
// runner. Splitting jobs then buys nothing and costs a real transfer: the
|
|
289
|
+
// outputs get tarred, uploaded, downloaded into a second checkout, and two
|
|
290
|
+
// more devenv setups pay for themselves twice. One job, no artifacts.
|
|
291
|
+
workflow = `${renderPublishWorkflowHeader(options)}${renderSingleJobPublishWorkflowSteps(definePublishWorkflow(options).steps, options)}`;
|
|
292
|
+
}
|
|
261
293
|
else if (hasLinuxPlatformTargets(options)) {
|
|
262
294
|
workflow = `${renderPublishWorkflowHeader(options)}${renderSingleJobPublishWorkflowSteps(definePublishWorkflow(options).steps, options)}`;
|
|
263
295
|
}
|
|
@@ -321,7 +353,7 @@ jobs:
|
|
|
321
353
|
publish:
|
|
322
354
|
${options.release === false ? renderRunsOnLine(options.runsOn) : publishJobRunsOnLine(options)}
|
|
323
355
|
env:
|
|
324
|
-
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options)}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}
|
|
356
|
+
GH_TOKEN: ${githubExpression('github.token')}${remoteCacheJobEnv(options)}${cargoCredentialsJobEnv(options)}${privateNpmInstallJobEnv(options)}${platformProducerJobEnv(options)}
|
|
325
357
|
steps:
|
|
326
358
|
`;
|
|
327
359
|
}
|
|
@@ -414,6 +446,16 @@ function yamlLinesForStep(step, options) {
|
|
|
414
446
|
...privateNpmPublisherStepEnv(options),
|
|
415
447
|
` run: smoo release repair-pending --dry-run "${githubExpression('inputs.dry_run')}"`,
|
|
416
448
|
];
|
|
449
|
+
case PublishWorkflowStepKind.PlanRelease:
|
|
450
|
+
// The same selection the bump will make, computed without writing: the
|
|
451
|
+
// gates need `mode` and `projects` before any version commit exists.
|
|
452
|
+
return [
|
|
453
|
+
` - name: ${step.name}`,
|
|
454
|
+
' id: plan',
|
|
455
|
+
' run:',
|
|
456
|
+
` smoo release version --bump "${githubExpression('inputs.bump')}" --projects "${githubExpression('inputs.projects')}" --dry-run "true" --github-output`,
|
|
457
|
+
' "$GITHUB_OUTPUT"',
|
|
458
|
+
];
|
|
417
459
|
case PublishWorkflowStepKind.VersionRelease:
|
|
418
460
|
return [
|
|
419
461
|
` - name: ${step.name}`,
|
|
@@ -429,9 +471,9 @@ function yamlLinesForStep(step, options) {
|
|
|
429
471
|
case PublishWorkflowStepKind.Build:
|
|
430
472
|
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}"`);
|
|
431
473
|
case PublishWorkflowStepKind.Lint:
|
|
432
|
-
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets lint --projects "${githubExpression('steps.
|
|
474
|
+
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets lint --projects "${githubExpression('steps.plan.outputs.projects')}"`);
|
|
433
475
|
case PublishWorkflowStepKind.UnitTests:
|
|
434
|
-
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets test --projects "${githubExpression('steps.
|
|
476
|
+
return conditionalRunStep(step, `smoo github-ci nx-run-many --targets test --projects "${githubExpression('steps.plan.outputs.projects')}"`);
|
|
435
477
|
case PublishWorkflowStepKind.UploadTraceDbs:
|
|
436
478
|
return artifactStepLines(options.actionsProvider, step.name, 'upload', [
|
|
437
479
|
`name: trace-results-${githubExpression('github.run_id')}`,
|
|
@@ -506,8 +548,11 @@ function deployProductionStep(step, options) {
|
|
|
506
548
|
];
|
|
507
549
|
}
|
|
508
550
|
function conditionalRunStep(step, run) {
|
|
509
|
-
|
|
510
|
-
|
|
551
|
+
// A step gated on the plan must read the PLAN's mode: it runs before the
|
|
552
|
+
// version step exists, and `steps.version.outputs.mode` is empty there, which
|
|
553
|
+
// silently skips the gate rather than running it.
|
|
554
|
+
const source = step.condition === 'plan-mode-not-none' ? 'plan' : 'version';
|
|
555
|
+
return [` - name: ${step.name}`, ` if: steps.${source}.outputs.mode != 'none'`, ` run: ${run}`];
|
|
511
556
|
}
|
|
512
557
|
function siblingSourceCheckoutStepLines(options) {
|
|
513
558
|
const checkouts = options.sourceCheckouts;
|
|
@@ -554,13 +599,23 @@ function remoteCacheJobEnv(options) {
|
|
|
554
599
|
}
|
|
555
600
|
function renderSingleJobPublishWorkflowSteps(steps, options) {
|
|
556
601
|
const lines = [];
|
|
602
|
+
const producer = options.platformProducer;
|
|
603
|
+
const crossOnThisRunner = skipsPublishHandoff(options) && hasMacosPlatformTargets(options);
|
|
557
604
|
for (const step of steps) {
|
|
558
605
|
lines.push(...sectionLinesBefore(step));
|
|
559
606
|
lines.push(...commentLinesForStep(step));
|
|
560
607
|
lines.push(...yamlLinesForStep(step, options));
|
|
561
608
|
lines.push('');
|
|
609
|
+
if (crossOnThisRunner && producer && step.kind === PublishWorkflowStepKind.Checkout) {
|
|
610
|
+
// Before any toolchain setup or build, exactly as the dedicated producer
|
|
611
|
+
// job ordered it: the SDK has to be on disk before devenv resolves it.
|
|
612
|
+
lines.push(' - name: Check cross-platform toolchain prerequisites', ' working-directory: .', ' run: |', ' set -euo pipefail', ...producer.preflight.split('\n').map((line) => ` ${line}`), '');
|
|
613
|
+
}
|
|
562
614
|
if (step.kind === PublishWorkflowStepKind.Build) {
|
|
563
615
|
lines.push(' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}"`, '');
|
|
616
|
+
if (crossOnThisRunner) {
|
|
617
|
+
lines.push(' - name: 🍎 Build selected macOS and iOS release outputs', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${macosPlatformFamilies(options).join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}"`, '');
|
|
618
|
+
}
|
|
564
619
|
}
|
|
565
620
|
}
|
|
566
621
|
return `${lines.join('\n').trimEnd()}\n`;
|
|
@@ -910,6 +965,39 @@ function publishJobRunsOnLine(options) {
|
|
|
910
965
|
function githubExpression(expression) {
|
|
911
966
|
return ['$', '{{ ', expression, ' }}'].join('');
|
|
912
967
|
}
|
|
968
|
+
/**
|
|
969
|
+
* Whether the separate publishing job can be dropped, so the release runs as
|
|
970
|
+
* one job that builds every artifact and publishes them.
|
|
971
|
+
*
|
|
972
|
+
* The hand-off exists for ONE reason: npmjs mints provenance from the
|
|
973
|
+
* publishing job's OIDC token and refuses a self-hosted runner for it, so a
|
|
974
|
+
* release with public packages must publish from the GitHub-hosted runner and
|
|
975
|
+
* therefore has to receive its self-hosted artifacts through an artifact.
|
|
976
|
+
* A release that publishes only to the declared private registry has no such
|
|
977
|
+
* constraint; when its Apple targets are cross-built on the same runner (or it
|
|
978
|
+
* has none), one job holds everything.
|
|
979
|
+
*/
|
|
980
|
+
function skipsPublishHandoff(options) {
|
|
981
|
+
if (options.actionsProvider !== 'forgejo' || options.privateNpm === undefined) {
|
|
982
|
+
return false;
|
|
983
|
+
}
|
|
984
|
+
return !hasMacosPlatformTargets(options) || options.platformProducer?.kind === 'linux-cross';
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Toolchain environment for a foreign-platform producer, rendered onto whichever
|
|
988
|
+
* job runs its builds. In the flattened single-job shape that is the publish job
|
|
989
|
+
* itself, so the SDK path and cross flags have to reach it the same way the
|
|
990
|
+
* dedicated producer job received them.
|
|
991
|
+
*/
|
|
992
|
+
function platformProducerJobEnv(options) {
|
|
993
|
+
const producer = options.platformProducer;
|
|
994
|
+
if (!producer || !skipsPublishHandoff(options)) {
|
|
995
|
+
return '';
|
|
996
|
+
}
|
|
997
|
+
return Object.entries(producer.env ?? {})
|
|
998
|
+
.map(([name, value]) => `\n ${name}: ${JSON.stringify(value)}`)
|
|
999
|
+
.join('');
|
|
1000
|
+
}
|
|
913
1001
|
function privateNpmInstallJobEnv(options) {
|
|
914
1002
|
const tokenEnv = options.privateNpm?.readTokenEnv;
|
|
915
1003
|
if (!tokenEnv) {
|
package/dist/release/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { assertPackedArtifact, type ReleasePackManifest, type ReleasePackOptions, type ReleasePackPackageEntry, releasePack, resolvePackClosure, } from './pack.js';
|
|
2
|
-
export { assertPrivatePackage, checkPrivatePackage, isPrivatePackage, type NpmStatusOptions, npmPackageExists as npmPackageExistsOnRegistry, npmPublishedVersionExists as npmPublishedVersionExistsOnRegistry, type PrivateNpmRegistry, type PrivateNpmRegistryConfigError, type PrivateNpmRegistryConfigErrorKind, type PublishDestination, privateNpmPublishArgs, privateNpmUserconfigContent, publishPrivateWithDiagnostics, type Result as PrivateNpmResult, requirePrivateNpmRegistry, resolvePrivateNpmRegistry, selectPublishDestination, selectRegistryForPackage, withPrivateNpmUserconfig, } from './private-npm.js';
|
|
2
|
+
export { assertPrivatePackage, checkPrivatePackage, isPrivatePackage, type NpmStatusOptions, npmPackageExists as npmPackageExistsOnRegistry, npmPublishedVersionExists as npmPublishedVersionExistsOnRegistry, type PrivateNpmRegistry, type PrivateNpmRegistryConfigError, type PrivateNpmRegistryConfigErrorKind, type PublishDestination, privateNpmPublishArgs, privateNpmTokenEnvForMode, privateNpmUserconfigContent, publishPrivateWithDiagnostics, type Result as PrivateNpmResult, requirePrivateNpmRegistry, resolvePrivateNpmRegistry, selectPublishDestination, selectRegistryForPackage, withPrivateNpmUserconfig, } from './private-npm.js';
|
|
3
3
|
import { type BootstrapNpmPackagesOptions } from './bootstrap-npm-packages.js';
|
|
4
4
|
import { type ReleasePackageInfo } from './core.js';
|
|
5
5
|
export interface ReleaseVersionOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/release/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,WAAW,EACX,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,gBAAgB,IAAI,0BAA0B,EAC9C,yBAAyB,IAAI,mCAAmC,EAChE,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,6BAA6B,EAC7B,KAAK,MAAM,IAAI,gBAAgB,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/release/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,WAAW,EACX,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,gBAAgB,IAAI,0BAA0B,EAC9C,yBAAyB,IAAI,mCAAmC,EAChE,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,KAAK,MAAM,IAAI,gBAAgB,EAC/B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,KAAK,2BAA2B,EAIjC,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAQL,KAAK,kBAAkB,EAGxB,MAAM,WAAW,CAAC;AAiDnB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,yGAAyG;IACzG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,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