shiplane 0.4.0 → 0.4.2
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 +9 -0
- package/dist/{budget-CTjB1v-Z.js → budget-BTnKtGF6.js} +9 -28
- package/dist/budget-BTnKtGF6.js.map +1 -0
- package/dist/cli.js +6 -5
- package/dist/cli.js.map +1 -1
- package/dist/{index-Cb8R0RIA.d.ts → index-CpQPaO28.d.ts} +4 -7
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +1 -1
- package/dist/{package-registry.fake-Ciqc4ujx.js → package-registry.fake-BuiTldHL.js} +7 -7
- package/dist/package-registry.fake-BuiTldHL.js.map +1 -0
- package/dist/{package-registry.fake-CC37ptzf.d.ts → package-registry.fake-CPAwyGn_.d.ts} +8 -9
- package/dist/{perEnv-B7AiYnW_.js → perEnv-n2qFRplP.js} +1 -1
- package/dist/{perEnv-B7AiYnW_.js.map → perEnv-n2qFRplP.js.map} +1 -1
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.js +6 -6
- package/dist/{readStatus-DmT61axf.js → readStatus-BnEVjKc8.js} +490 -111
- package/dist/readStatus-BnEVjKc8.js.map +1 -0
- package/dist/{shell-server-hosting.adapter-DobfDqFm.js → shell-server-hosting.adapter-C7_5MWrl.js} +4 -3
- package/dist/shell-server-hosting.adapter-C7_5MWrl.js.map +1 -0
- package/dist/{src-Dqo5lgrW.js → src-DO7WyrfV.js} +3 -3
- package/dist/src-DO7WyrfV.js.map +1 -0
- package/dist/{static-hosting.port-mknLsxwR.d.ts → static-hosting.port-pfDvRESk.d.ts} +55 -15
- package/dist/testing.d.ts +24 -16
- package/dist/testing.js +16 -17
- package/dist/testing.js.map +1 -1
- package/dist/{web-app.module-6KrXIU7j.js → web-app.module-Cg3SYqSo.js} +47 -2
- package/dist/web-app.module-Cg3SYqSo.js.map +1 -0
- package/package.json +1 -1
- package/dist/budget-CTjB1v-Z.js.map +0 -1
- package/dist/package-registry.fake-Ciqc4ujx.js.map +0 -1
- package/dist/readStatus-DmT61axf.js.map +0 -1
- package/dist/shell-server-hosting.adapter-DobfDqFm.js.map +0 -1
- package/dist/src-Dqo5lgrW.js.map +0 -1
- package/dist/web-app.module-6KrXIU7j.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as releaseFlow, i as backendService, n as publishedPackage, r as mobileApp, t as webApp } from "./web-app.module-
|
|
2
|
-
import { A as
|
|
1
|
+
import { a as releaseFlow, c as findUnset, i as backendService, l as isEnvVarName, n as publishedPackage, o as ENV_VAR_NAME, r as mobileApp, s as EnvToCheck, t as webApp } from "./web-app.module-Cg3SYqSo.js";
|
|
2
|
+
import { A as workspacePatterns, C as changelogSection, D as tagFormatNamed, E as releaseTags, O as tagName, S as cameWithRelease, _ as nextVersion, a as CommandFailed, b as DEFAULT_TAG_FORMAT, c as onlyVersionFiles, d as appBumps, f as changesetApps, i as minutesBudget, k as expandPatterns, l as shipsFrom, m as splitChangesets, o as deployRunTitle, p as packageBumps, r as deployEstimate, u as webShip, v as releaseSource, w as firstRelease, x as TAG_FORMATS } from "./budget-BTnKtGF6.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -135,10 +135,22 @@ const keysAt = (schema, at) => {
|
|
|
135
135
|
const child = def.shape?.[String(first)];
|
|
136
136
|
return child ? keysAt(child, rest) : [];
|
|
137
137
|
};
|
|
138
|
+
const envVarNames$1 = z.array(z.string().regex(ENV_VAR_NAME, "an env var name is UPPER_SNAKE, like SENTRY_DSN")).describe("Env var names, one per line");
|
|
139
|
+
const onlyOn = (environment) => envVarNames$1.optional().describe(`Checked on ${environment} only, on top of all`);
|
|
140
|
+
const environmentLists = {
|
|
141
|
+
preview: onlyOn("preview"),
|
|
142
|
+
production: onlyOn("production")
|
|
143
|
+
};
|
|
144
|
+
/** One list for every environment, or `all` plus a list per environment. */
|
|
145
|
+
const checkEnvBeforeDeploySchema = z.union([envVarNames$1, z.strictObject({
|
|
146
|
+
all: envVarNames$1.optional().describe("Checked on every environment, current and future"),
|
|
147
|
+
...environmentLists
|
|
148
|
+
})]).describe("Before each deploy, shiplane checks these env var names are set on the platform; you set the values");
|
|
138
149
|
/** What a unit file naming this module may hold: `module`, then its adapter's settings. */
|
|
139
150
|
const unitSchema = (module) => z.strictObject({
|
|
140
151
|
module: z.literal(module.name).describe(`The module that ships this app, with ${module.provider}`),
|
|
141
152
|
buildCommand: z.string().optional().describe("How to build this app, when its package.json has no \"build\" script"),
|
|
153
|
+
checkEnvBeforeDeploy: checkEnvBeforeDeploySchema.optional(),
|
|
142
154
|
...mapShape(module.settings.shape, deepStrict)
|
|
143
155
|
});
|
|
144
156
|
/** The JSON Schema editors read for `shiplane.unit.yml`: the module an app names picks its keys. */
|
|
@@ -182,8 +194,17 @@ const locate = (doc, counter) => (at, key) => {
|
|
|
182
194
|
const offset = node?.range?.[0];
|
|
183
195
|
return offset === void 0 ? void 0 : counter.linePos(offset).line;
|
|
184
196
|
};
|
|
197
|
+
/** Of a union's branches, the one written in the right shape: its problems are inside, not the shape. */
|
|
198
|
+
const closestBranch = (branches) => branches.find((issues) => issues.every(({ code, path }) => !(code === "invalid_type" && path.length === 0)));
|
|
185
199
|
const describeIssue = (issue, file, module, lineAt) => {
|
|
186
200
|
const at = issue.path;
|
|
201
|
+
if (issue.code === "invalid_union") {
|
|
202
|
+
const branch = closestBranch(issue.errors);
|
|
203
|
+
if (branch) return branch.flatMap((inner) => describeIssue({
|
|
204
|
+
...inner,
|
|
205
|
+
path: [...at, ...inner.path]
|
|
206
|
+
}, file, module, lineAt));
|
|
207
|
+
}
|
|
187
208
|
if (issue.code === "unrecognized_keys") return issue.keys.map((key) => ({
|
|
188
209
|
file,
|
|
189
210
|
line: lineAt(at, key),
|
|
@@ -202,6 +223,17 @@ const describeIssue = (issue, file, module, lineAt) => {
|
|
|
202
223
|
message: `"${name}": ${issue.message}`
|
|
203
224
|
}];
|
|
204
225
|
};
|
|
226
|
+
const CORE_KEYS = new Set([
|
|
227
|
+
"module",
|
|
228
|
+
"buildCommand",
|
|
229
|
+
"checkEnvBeforeDeploy"
|
|
230
|
+
]);
|
|
231
|
+
const envVarNames = (list = []) => list.filter(isEnvVarName);
|
|
232
|
+
const envToCheck = (written) => new EnvToCheck(Array.isArray(written) ? envVarNames(written) : {
|
|
233
|
+
all: envVarNames(written.all),
|
|
234
|
+
preview: envVarNames(written.preview),
|
|
235
|
+
production: envVarNames(written.production)
|
|
236
|
+
});
|
|
205
237
|
const problem = (file, line, message, hint) => ({ problems: [{
|
|
206
238
|
file,
|
|
207
239
|
line,
|
|
@@ -233,12 +265,14 @@ const readUnitFile = (file, text, modules, features = []) => {
|
|
|
233
265
|
if (!module) return problem(file, lineAt(["module"]), `no module named "${named}" in shiplane.config.ts`, didYouMean(named, names) ?? oneOf);
|
|
234
266
|
const parsed = unitSchema(module).safeParse(data);
|
|
235
267
|
if (!parsed.success) return { problems: parsed.error.issues.flatMap((issue) => describeIssue(issue, file, module, lineAt)) };
|
|
236
|
-
const options = Object.fromEntries(Object.entries(data).filter(([key]) => key
|
|
268
|
+
const options = Object.fromEntries(Object.entries(data).filter(([key]) => !CORE_KEYS.has(key)));
|
|
237
269
|
const buildCommand = typeof data.buildCommand === "string" ? data.buildCommand : void 0;
|
|
270
|
+
const written = parsed.data.checkEnvBeforeDeploy;
|
|
238
271
|
return {
|
|
239
272
|
unit: {
|
|
240
273
|
module: named,
|
|
241
274
|
...buildCommand ? { buildCommand } : {},
|
|
275
|
+
...written ? { checkEnvBeforeDeploy: envToCheck(written) } : {},
|
|
242
276
|
options,
|
|
243
277
|
lineOf: (at) => lineAt(at)
|
|
244
278
|
},
|
|
@@ -419,18 +453,178 @@ const afterShipContext = (context) => ({
|
|
|
419
453
|
return commits.filter(({ files }) => filter(files).length > 0).map(({ subject }) => subject);
|
|
420
454
|
}
|
|
421
455
|
});
|
|
456
|
+
/** A package registry has no staging and nothing deploys a release-only unit: no environment. */
|
|
457
|
+
const hasNoEnvironment = ({ kind, releaseOnly }) => kind === "published-package" || releaseOnly === true;
|
|
422
458
|
/**
|
|
423
|
-
* What the person reads for an environment:
|
|
424
|
-
*
|
|
459
|
+
* What the person reads for an environment: when no unit has one, preview is where users get them,
|
|
460
|
+
* so it reads "live". Naming no unit asks about the whole repository.
|
|
425
461
|
*/
|
|
426
462
|
const environmentLabel = (context, units, environment) => {
|
|
427
463
|
if (environment !== "preview") return environment;
|
|
428
|
-
const
|
|
464
|
+
const named = [...units];
|
|
465
|
+
const names = named.length > 0 ? named : context.release.units.map(({ name }) => name);
|
|
429
466
|
return names.length > 0 && names.every((name) => {
|
|
430
467
|
const unit = context.release.units.find((candidate) => candidate.name === name);
|
|
431
|
-
|
|
468
|
+
const module = unit && moduleOf(context, unit);
|
|
469
|
+
return module !== void 0 && hasNoEnvironment(module);
|
|
432
470
|
}) ? "live" : environment;
|
|
433
471
|
};
|
|
472
|
+
/** Where a sentence sends units: "to preview", or "live" when none of them has an environment. */
|
|
473
|
+
const destination = (context, units, environment) => {
|
|
474
|
+
const label = environmentLabel(context, units, environment);
|
|
475
|
+
return label === "live" ? label : `to ${label}`;
|
|
476
|
+
};
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/application/checkEnvBeforeDeploy.ts
|
|
479
|
+
const STEP = "Check env before deploy";
|
|
480
|
+
const SET_THEM = "Are they set now?";
|
|
481
|
+
const READ_AGAIN = "Read the platform again?";
|
|
482
|
+
/** The units that list env to check, each with its list. */
|
|
483
|
+
const listing = (units) => units.flatMap((unit) => unit.checkEnvBeforeDeploy ? [{
|
|
484
|
+
unit,
|
|
485
|
+
toCheck: unit.checkEnvBeforeDeploy
|
|
486
|
+
}] : []);
|
|
487
|
+
/** The unit's platform env, or the provider that cannot list names. */
|
|
488
|
+
const platformEnvOf = ({ release, shell }, unit) => {
|
|
489
|
+
const module = release.modules.find(({ name }) => name === unit.module);
|
|
490
|
+
if (!module?.env) return { cannotList: module?.provider ?? unit.module };
|
|
491
|
+
const port = module.env({
|
|
492
|
+
root: release.root,
|
|
493
|
+
shell
|
|
494
|
+
});
|
|
495
|
+
const options = (environment) => resolvedOptions(module, unit, environment, release.units);
|
|
496
|
+
return {
|
|
497
|
+
listNames: (input) => port.listNames({
|
|
498
|
+
...input,
|
|
499
|
+
options: options(input.environment)
|
|
500
|
+
}),
|
|
501
|
+
setCommand: (input) => port.setCommand({
|
|
502
|
+
...input,
|
|
503
|
+
options: options(input.environment)
|
|
504
|
+
})
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
const line = ({ output }, mark, text) => output.line(`${mark} ${paint("bold", STEP)} ${text}`);
|
|
508
|
+
/** The names the platform holds, or null when the person stops, or CI cannot read it. */
|
|
509
|
+
const readNames = async (context, port, input) => {
|
|
510
|
+
try {
|
|
511
|
+
return await port.listNames(input);
|
|
512
|
+
} catch (error) {
|
|
513
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
514
|
+
line(context, paint("red", "✗"), `${input.unit.name} on ${input.environment}: ${reason}`);
|
|
515
|
+
return context.prompter.interactive && !context.options.yes && await context.prompter.confirm(READ_AGAIN, true) ? readNames(context, port, input) : null;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
const canWait = ({ prompter, options }) => prompter.interactive && !options.yes;
|
|
519
|
+
/** One unit on one environment: true once every listed name is on its platform. */
|
|
520
|
+
const checkUnit = async (context, port, { unit, toCheck }, environment) => {
|
|
521
|
+
const expected = toCheck.for(environment);
|
|
522
|
+
const where = `${unit.name} on ${environment}`;
|
|
523
|
+
const setOnPlatform = await readNames(context, port, {
|
|
524
|
+
unit,
|
|
525
|
+
environment
|
|
526
|
+
});
|
|
527
|
+
if (!setOnPlatform) return false;
|
|
528
|
+
const unset = findUnset({
|
|
529
|
+
expected,
|
|
530
|
+
setOnPlatform
|
|
531
|
+
});
|
|
532
|
+
if (unset.isEmpty()) {
|
|
533
|
+
line(context, paint("green", "✓"), `${where}: ${expected.size} of ${expected.size} set`);
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
const { output } = context;
|
|
537
|
+
const command = port.setCommand({
|
|
538
|
+
unit,
|
|
539
|
+
environment,
|
|
540
|
+
names: unset.names()
|
|
541
|
+
});
|
|
542
|
+
line(context, paint("yellow", "!"), `${where}: ${unset.names().length} unset env vars, the deploy waits`);
|
|
543
|
+
unset.names().forEach((name) => output.line(` ${name}`));
|
|
544
|
+
if (!canWait(context)) {
|
|
545
|
+
output.line(` ${paint("dim", "Nothing was written. Set them, then run again:")}`);
|
|
546
|
+
output.line(` ${command}`);
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
output.line(` ${paint("dim", "You set these values; shiplane never does. Run, with your values:")}`);
|
|
550
|
+
output.line(` ${command}`);
|
|
551
|
+
if (!await context.prompter.confirm(SET_THEM, true)) return false;
|
|
552
|
+
return checkUnit(context, port, {
|
|
553
|
+
unit,
|
|
554
|
+
toCheck
|
|
555
|
+
}, environment);
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Before a deploy: each unit that lists env to check has every name on its platform. A person sets
|
|
559
|
+
* the values; shiplane only reads names. False when a name is still unset and nothing should ship.
|
|
560
|
+
*/
|
|
561
|
+
const checkEnvBeforeDeploy = async (context, { environment, units }) => {
|
|
562
|
+
for (const entry of listing(units)) {
|
|
563
|
+
const port = platformEnvOf(context, entry.unit);
|
|
564
|
+
if ("cannotList" in port) {
|
|
565
|
+
line(context, paint("yellow", "!"), `${entry.unit.name}: can't check env on ${port.cannotList}, the deploy goes on`);
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
if (!await checkUnit(context, port, entry, environment)) return false;
|
|
569
|
+
}
|
|
570
|
+
return true;
|
|
571
|
+
};
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/application/reportEnvToCheck.ts
|
|
574
|
+
const doctorLine = (output, mark, text) => output.line(`${paint("dim", "│")} ${mark} ${text}`);
|
|
575
|
+
/** One unit on one environment, for doctor: true when every listed name is on its platform. */
|
|
576
|
+
const reportUnit = async (output, port, { unit, toCheck }, environment) => {
|
|
577
|
+
const expected = toCheck.for(environment);
|
|
578
|
+
const where = `${unit.name} on ${environment}`;
|
|
579
|
+
const setOnPlatform = await port.listNames({
|
|
580
|
+
unit,
|
|
581
|
+
environment
|
|
582
|
+
}).catch((error) => {
|
|
583
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
584
|
+
doctorLine(output, paint("red", "✗"), `${where}: ${reason}`);
|
|
585
|
+
return null;
|
|
586
|
+
});
|
|
587
|
+
if (!setOnPlatform) return false;
|
|
588
|
+
const unset = findUnset({
|
|
589
|
+
expected,
|
|
590
|
+
setOnPlatform
|
|
591
|
+
});
|
|
592
|
+
if (unset.isEmpty()) {
|
|
593
|
+
doctorLine(output, paint("green", "✓"), `${where}: ${expected.size} of ${expected.size} set`);
|
|
594
|
+
return true;
|
|
595
|
+
}
|
|
596
|
+
const names = unset.names();
|
|
597
|
+
doctorLine(output, paint("red", "✗"), `${where}: ${names.length} unset env vars: ${names.join(", ")}`);
|
|
598
|
+
output.line(`${paint("dim", "│")} ${paint("dim", `you set them: ${port.setCommand({
|
|
599
|
+
unit,
|
|
600
|
+
environment,
|
|
601
|
+
names
|
|
602
|
+
})}`)}`);
|
|
603
|
+
return false;
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* `doctor`'s env section: each unit that lists env to check, on every environment. Prints nothing
|
|
607
|
+
* when no unit lists any. False when a name is unset or a platform cannot be read.
|
|
608
|
+
*/
|
|
609
|
+
const reportEnvToCheck = async ({ release, shell, output }) => {
|
|
610
|
+
const checked = listing(release.units);
|
|
611
|
+
if (checked.length === 0) return true;
|
|
612
|
+
doctorLine(output, "", paint("bold", STEP));
|
|
613
|
+
let allSet = true;
|
|
614
|
+
for (const entry of checked) {
|
|
615
|
+
entry.toCheck.listedTwice().forEach((name) => doctorLine(output, paint("yellow", "!"), `${entry.unit.name}: ${name} is in all and listed again`));
|
|
616
|
+
const port = platformEnvOf({
|
|
617
|
+
release,
|
|
618
|
+
shell
|
|
619
|
+
}, entry.unit);
|
|
620
|
+
if ("cannotList" in port) {
|
|
621
|
+
doctorLine(output, paint("yellow", "!"), `${entry.unit.name}: can't check env on ${port.cannotList}`);
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
for (const environment of ENVIRONMENTS) allSet = await reportUnit(output, port, entry, environment) && allSet;
|
|
625
|
+
}
|
|
626
|
+
return allSet;
|
|
627
|
+
};
|
|
434
628
|
//#endregion
|
|
435
629
|
//#region src/application/requirements.ts
|
|
436
630
|
/**
|
|
@@ -438,21 +632,26 @@ const environmentLabel = (context, units, environment) => {
|
|
|
438
632
|
* the modules shipping one of those apps count.
|
|
439
633
|
*/
|
|
440
634
|
const requirementsOf = (release, apps) => {
|
|
441
|
-
|
|
442
|
-
const required = [
|
|
635
|
+
return onceEach([
|
|
443
636
|
...[
|
|
444
637
|
release.flow.sourceControl,
|
|
445
638
|
release.flow.codeHost,
|
|
446
639
|
release.flow.ciPipeline,
|
|
447
640
|
release.flow.versioning
|
|
448
641
|
].flatMap((adapter) => adapter.requirements?.() ?? []),
|
|
449
|
-
...release
|
|
450
|
-
const shipped = appsOf(module.name);
|
|
451
|
-
return apps && shipped.length === 0 ? [] : module.requirements?.(shipped) ?? [];
|
|
452
|
-
}),
|
|
642
|
+
...modulesRequire(release, apps),
|
|
453
643
|
...release.features.flatMap((feature) => feature.requirements?.() ?? [])
|
|
454
|
-
];
|
|
455
|
-
|
|
644
|
+
]);
|
|
645
|
+
};
|
|
646
|
+
/** The sign-ins only the modules shipping those apps need, once each. */
|
|
647
|
+
const signInsOf = (release, apps) => onceEach(modulesRequire(release, apps));
|
|
648
|
+
const modulesRequire = (release, apps) => release.modules.flatMap((module) => {
|
|
649
|
+
const shipped = release.units.filter(({ module: name, name: app }) => name === module.name && (!apps || apps.has(app)));
|
|
650
|
+
return apps && shipped.length === 0 ? [] : module.requirements?.(shipped) ?? [];
|
|
651
|
+
});
|
|
652
|
+
const onceEach = (required) => {
|
|
653
|
+
const seen = /* @__PURE__ */ new Set();
|
|
654
|
+
return required.filter(({ label }) => !seen.has(label) && Boolean(seen.add(label)));
|
|
456
655
|
};
|
|
457
656
|
/** A requirement's check run from the root: its exit status, 127 when the tool is missing. */
|
|
458
657
|
const checkStatus = async (shell, root, { check }) => (await shell.capture(check.command, check.args, {
|
|
@@ -463,10 +662,15 @@ const checkStatus = async (shell, root, { check }) => (await shell.capture(check
|
|
|
463
662
|
* Before a release writes anything: each sign-in its picked units need. A failing one offers its
|
|
464
663
|
* fix, then is checked again. False, with the commands to run, when one still fails.
|
|
465
664
|
*/
|
|
466
|
-
const preflight =
|
|
665
|
+
const preflight = (context, apps) => signIn(context, {
|
|
666
|
+
requirements: requirementsOf(context.release, apps),
|
|
667
|
+
again: "run the release again"
|
|
668
|
+
});
|
|
669
|
+
/** Each requirement checked; a failing one offers its fix. False, with the commands, when one still fails. */
|
|
670
|
+
const signIn = async (context, { requirements, again }) => {
|
|
467
671
|
const { shell, prompter, options, release } = context;
|
|
468
672
|
const failing = [];
|
|
469
|
-
for (const requirement of
|
|
673
|
+
for (const requirement of requirements) {
|
|
470
674
|
const status = await checkStatus(shell, release.root, requirement);
|
|
471
675
|
if (status === 0) continue;
|
|
472
676
|
const { fix } = requirement;
|
|
@@ -480,7 +684,7 @@ const preflight = async (context, apps) => {
|
|
|
480
684
|
failing.push(requirement);
|
|
481
685
|
}
|
|
482
686
|
if (failing.length === 0) return true;
|
|
483
|
-
fail(context, `Not signed in: ${failing.map(({ label }) => label).join(", ")}`,
|
|
687
|
+
fail(context, `Not signed in: ${failing.map(({ label }) => label).join(", ")}`, `nothing was written. Sign in, then ${again}.`, [...failing.flatMap(({ fix }) => fix ? [commandLine(fix)] : []), "shiplane"]);
|
|
484
688
|
return false;
|
|
485
689
|
};
|
|
486
690
|
//#endregion
|
|
@@ -554,6 +758,30 @@ const DEFAULT_FLOW = {
|
|
|
554
758
|
from: pluginPackage("changesets")
|
|
555
759
|
}
|
|
556
760
|
};
|
|
761
|
+
/** Versioning from commits: same plugin, and setup offers it when no changesets config exists. */
|
|
762
|
+
const COMMITS_VERSIONING = {
|
|
763
|
+
factory: "commitsVersioning",
|
|
764
|
+
from: pluginPackage("changesets")
|
|
765
|
+
};
|
|
766
|
+
/** Both ways of versioning run on changesets. Private packages, such as plugins, version too. */
|
|
767
|
+
const CHANGESETS_CONFIG = `${JSON.stringify({
|
|
768
|
+
changelog: "@changesets/cli/changelog",
|
|
769
|
+
commit: false,
|
|
770
|
+
fixed: [],
|
|
771
|
+
linked: [],
|
|
772
|
+
access: "restricted",
|
|
773
|
+
baseBranch: "main",
|
|
774
|
+
updateInternalDependencies: "patch",
|
|
775
|
+
ignore: [],
|
|
776
|
+
privatePackages: {
|
|
777
|
+
version: true,
|
|
778
|
+
tag: false
|
|
779
|
+
}
|
|
780
|
+
}, null, 2)}\n`;
|
|
781
|
+
const CHANGESETS_CLI = {
|
|
782
|
+
name: "@changesets/cli",
|
|
783
|
+
version: "^3.0.1"
|
|
784
|
+
};
|
|
557
785
|
/** A root config with this flow (today's by default) and these modules, in the order given. */
|
|
558
786
|
const renderConfig = (entries, pkg = INSTALLED, flow = DEFAULT_FLOW, units) => {
|
|
559
787
|
const byPlugin = /* @__PURE__ */ new Map();
|
|
@@ -762,8 +990,14 @@ const doctor = async (context) => {
|
|
|
762
990
|
env: fix.env
|
|
763
991
|
});
|
|
764
992
|
}
|
|
765
|
-
|
|
766
|
-
|
|
993
|
+
const envSet = await reportEnvToCheck({
|
|
994
|
+
release,
|
|
995
|
+
shell,
|
|
996
|
+
output
|
|
997
|
+
});
|
|
998
|
+
const passed = failing.length === 0 && envSet;
|
|
999
|
+
output.line(`${paint("dim", "└")} Next: ${paint("cyan", passed ? "shiplane status" : "shiplane doctor")}`);
|
|
1000
|
+
return passed;
|
|
767
1001
|
};
|
|
768
1002
|
//#endregion
|
|
769
1003
|
//#region src/application/initRelease.ts
|
|
@@ -1126,11 +1360,6 @@ const tagFormatOf = (tag) => {
|
|
|
1126
1360
|
}
|
|
1127
1361
|
return format;
|
|
1128
1362
|
};
|
|
1129
|
-
const releasesCommitsOf = (choice) => {
|
|
1130
|
-
if (choice === void 0 || choice === "ignore") return false;
|
|
1131
|
-
if (choice === "release") return true;
|
|
1132
|
-
throw new Error("commitsWithoutChangeset is \"release\" or \"ignore\"");
|
|
1133
|
-
};
|
|
1134
1363
|
const readConfig = async (file, aliases) => {
|
|
1135
1364
|
const loaded = await createJiti(import.meta.url, {
|
|
1136
1365
|
alias: aliases,
|
|
@@ -1156,8 +1385,7 @@ const readConfig = async (file, aliases) => {
|
|
|
1156
1385
|
verbose: flag(display.verbose),
|
|
1157
1386
|
mascot: mascotOf(display.mascot)
|
|
1158
1387
|
},
|
|
1159
|
-
tagFormat: tagFormatOf(loaded.tag)
|
|
1160
|
-
releasesCommits: releasesCommitsOf(loaded.commitsWithoutChangeset)
|
|
1388
|
+
tagFormat: tagFormatOf(loaded.tag)
|
|
1161
1389
|
};
|
|
1162
1390
|
};
|
|
1163
1391
|
/** A config's mascot: true, false, frames per mood, or a function; anything else is ignored. */
|
|
@@ -1247,6 +1475,7 @@ const loadRelease = async (root, options = {}) => {
|
|
|
1247
1475
|
version: manifest.version,
|
|
1248
1476
|
module: result.unit.module,
|
|
1249
1477
|
...result.unit.buildCommand ? { buildCommand: result.unit.buildCommand } : {},
|
|
1478
|
+
...result.unit.checkEnvBeforeDeploy ? { checkEnvBeforeDeploy: result.unit.checkEnvBeforeDeploy } : {},
|
|
1250
1479
|
options: result.unit.options,
|
|
1251
1480
|
after: []
|
|
1252
1481
|
},
|
|
@@ -1277,8 +1506,7 @@ const loadRelease = async (root, options = {}) => {
|
|
|
1277
1506
|
problems: sortProblems(problems),
|
|
1278
1507
|
display: config.display,
|
|
1279
1508
|
renames: [path.basename(configFile), ...ordered.map(({ unit }) => unit.file)].flatMap((file) => renameOf(file) ?? []),
|
|
1280
|
-
tagFormat: config.tagFormat
|
|
1281
|
-
releasesCommits: config.releasesCommits
|
|
1509
|
+
tagFormat: config.tagFormat
|
|
1282
1510
|
};
|
|
1283
1511
|
};
|
|
1284
1512
|
//#endregion
|
|
@@ -1392,12 +1620,12 @@ const newAdapter = async (context, name) => {
|
|
|
1392
1620
|
* Where `pnpm shiplane` picks up, from what main and GitHub hold right now. A merged release is
|
|
1393
1621
|
* tagged and shipped before the next one is opened.
|
|
1394
1622
|
*/
|
|
1395
|
-
const nextStep = ({ pending, releasePrs, untagged
|
|
1623
|
+
const nextStep = ({ pending, releasePrs, untagged }) => {
|
|
1396
1624
|
if (releasePrs.length > 0) return {
|
|
1397
1625
|
step: "wait-merge",
|
|
1398
1626
|
prs: releasePrs
|
|
1399
1627
|
};
|
|
1400
|
-
if (
|
|
1628
|
+
if (pending > 0 && untagged === 0) return { step: "release-pr" };
|
|
1401
1629
|
return { step: "ship" };
|
|
1402
1630
|
};
|
|
1403
1631
|
const RELEASE_BRANCH_PREFIX = "shiplane/release-";
|
|
@@ -1482,8 +1710,11 @@ const releaseCommitBody = (bumps) => bumps.map(({ app, to, notes, movedWith }) =
|
|
|
1482
1710
|
const lines = notes.length > 0 ? notes : movedWith.length > 0 ? [`Moves with ${movedWith.join(", ")}.`] : [];
|
|
1483
1711
|
return [`${app} ${to}`, ...lines.map(bullet)].join("\n");
|
|
1484
1712
|
}).join("\n\n");
|
|
1485
|
-
/**
|
|
1486
|
-
|
|
1713
|
+
/**
|
|
1714
|
+
* The release PR's body; `onMerge` says what happens to each unit once it is merged, `where` where
|
|
1715
|
+
* the run ships them, such as "to preview".
|
|
1716
|
+
*/
|
|
1717
|
+
const releasePrBody = (bumps, onMerge, where) => {
|
|
1487
1718
|
const appWidth = Math.max(3, ...bumps.map(({ app }) => app.length));
|
|
1488
1719
|
const versionWidth = Math.max(7, ...bumps.map(({ from, to }) => `${from} → ${to}`.length));
|
|
1489
1720
|
const row = (cells) => `| ${cells.join(" | ")} |`;
|
|
@@ -1513,7 +1744,7 @@ const releasePrBody = (bumps, onMerge) => {
|
|
|
1513
1744
|
return [
|
|
1514
1745
|
"## 🎯 What & why",
|
|
1515
1746
|
"",
|
|
1516
|
-
|
|
1747
|
+
`Versions the changesets merged since the last release. Squash and merge it by hand: \`pnpm shiplane\`, still running or run again, tags and ships ${where} once it is merged.`,
|
|
1517
1748
|
"",
|
|
1518
1749
|
...bumps.length > 0 ? table : ["Internal packages only: changelogs, nothing ships."],
|
|
1519
1750
|
...notes,
|
|
@@ -1556,6 +1787,47 @@ const WAIT_KEYS = {
|
|
|
1556
1787
|
/** What a key does while the release waits for its pull request to merge. */
|
|
1557
1788
|
const waitKey = (name) => name && WAIT_KEYS[name] || null;
|
|
1558
1789
|
//#endregion
|
|
1790
|
+
//#region src/domain/versionChoice.ts
|
|
1791
|
+
/** Biggest first: up the list is a bigger version, down a smaller one. */
|
|
1792
|
+
const LEVELS = [
|
|
1793
|
+
"major",
|
|
1794
|
+
"minor",
|
|
1795
|
+
"patch"
|
|
1796
|
+
];
|
|
1797
|
+
const PLAIN_VERSION = /^\d+\.\d+\.\d+$/;
|
|
1798
|
+
/**
|
|
1799
|
+
* The versions a release can go to, when everything it moves lands on one version: a single unit
|
|
1800
|
+
* or a fixed group. Null when units move apart, or on a version no bump explains, a prerelease.
|
|
1801
|
+
*/
|
|
1802
|
+
const versionChoices = (bumps) => {
|
|
1803
|
+
const [first] = bumps;
|
|
1804
|
+
if (!first || !PLAIN_VERSION.test(first.from)) return null;
|
|
1805
|
+
if (bumps.some(({ from, to }) => from !== first.from || to !== first.to)) return null;
|
|
1806
|
+
const { from, to } = first;
|
|
1807
|
+
const versions = {
|
|
1808
|
+
major: nextVersion(from, "major"),
|
|
1809
|
+
minor: nextVersion(from, "minor"),
|
|
1810
|
+
patch: nextVersion(from, "patch")
|
|
1811
|
+
};
|
|
1812
|
+
const computed = LEVELS.find((level) => versions[level] === to);
|
|
1813
|
+
return computed ? {
|
|
1814
|
+
computed,
|
|
1815
|
+
versions
|
|
1816
|
+
} : null;
|
|
1817
|
+
};
|
|
1818
|
+
/** The person's choice, as what the release adds: `packages` are all those it moves. */
|
|
1819
|
+
const forcedVersion = ({ computed, versions }, level, reason, packages) => ({
|
|
1820
|
+
level,
|
|
1821
|
+
changeset: {
|
|
1822
|
+
id: `forced-${versions[level]}`,
|
|
1823
|
+
releases: packages.map((name) => ({
|
|
1824
|
+
name,
|
|
1825
|
+
type: level
|
|
1826
|
+
})),
|
|
1827
|
+
summary: `Version forced to ${versions[level]} instead of ${versions[computed]}: ${reason}`
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
//#endregion
|
|
1559
1831
|
//#region src/domain/companions.ts
|
|
1560
1832
|
/** The shortest chain of moving packages from `from` to one a changeset names, breadth first. */
|
|
1561
1833
|
const chainTo = (from, dependencies, moving, named) => {
|
|
@@ -1661,19 +1933,6 @@ const unitRefs = (units) => units.map(({ name, packageName }) => ({
|
|
|
1661
1933
|
}));
|
|
1662
1934
|
/** The units the pending changesets name. */
|
|
1663
1935
|
const namedUnits = async ({ release, services }) => new Set((await services.versioning.pending()).flatMap(({ text }) => changesetApps(text, unitRefs(release.units))));
|
|
1664
|
-
/** Units whose folder moved since their current version, that no changeset or bump ships. */
|
|
1665
|
-
const findUnreleased = async ({ release, services: { sourceControl: source } }, named) => {
|
|
1666
|
-
if (!release.releasesCommits) return [];
|
|
1667
|
-
return unreleasedApps((await Promise.all(release.units.map(async ({ name, dir, version }) => {
|
|
1668
|
-
const since = await source.tagCommit(tagName(name, version, release.tagFormat)) ?? (await source.versionCommit(dir, "package.json", version))?.sha;
|
|
1669
|
-
if (!since) return [];
|
|
1670
|
-
return [{
|
|
1671
|
-
app: name,
|
|
1672
|
-
version,
|
|
1673
|
-
commits: await source.subjectsSince(since, dir, UNIT_FILES)
|
|
1674
|
-
}];
|
|
1675
|
-
}))).flat(), named);
|
|
1676
|
-
};
|
|
1677
1936
|
/** A tag's deploy on an environment, from every record the host keeps. */
|
|
1678
1937
|
const deployedOn = (history, tag, environment) => {
|
|
1679
1938
|
const states = history.filter(({ title }) => title === deployRunTitle(tag, environment)).map(({ state }) => state);
|
|
@@ -1689,7 +1948,6 @@ const readScope = async (context, environment) => {
|
|
|
1689
1948
|
const pending = await services.versioning.pending();
|
|
1690
1949
|
const refs = unitRefs(release.units);
|
|
1691
1950
|
const named = pending.map(({ text }) => changesetApps(text, refs));
|
|
1692
|
-
const unreleased = await findUnreleased(context, new Set(named.flat()));
|
|
1693
1951
|
const [deployed, tags] = await Promise.all([services.codeHost.deployments().catch(() => []), services.sourceControl.tags()]);
|
|
1694
1952
|
return Promise.all(release.units.map(async (unit) => {
|
|
1695
1953
|
const tag = tagName(unit.name, unit.version, context.release.tagFormat);
|
|
@@ -1711,7 +1969,6 @@ const readScope = async (context, environment) => {
|
|
|
1711
1969
|
app: unit.name,
|
|
1712
1970
|
version: unit.version,
|
|
1713
1971
|
changesets: named.filter((apps) => apps.includes(unit.name)).length,
|
|
1714
|
-
commits: unreleased.find((entry) => entry.app === unit.name)?.commits.length ?? 0,
|
|
1715
1972
|
tagged,
|
|
1716
1973
|
versioned: commit !== null && cameWithRelease({
|
|
1717
1974
|
app: unit.name,
|
|
@@ -1722,7 +1979,8 @@ const readScope = async (context, environment) => {
|
|
|
1722
1979
|
onChannel: await live(environment),
|
|
1723
1980
|
onPreview: await live("preview"),
|
|
1724
1981
|
...decidedBy ? { decidedBy } : {},
|
|
1725
|
-
...target?.releaseOnly ? { releaseOnly: true } : {}
|
|
1982
|
+
...target?.releaseOnly ? { releaseOnly: true } : {},
|
|
1983
|
+
...target && hasNoEnvironment(target) ? { noEnvironment: true } : {}
|
|
1726
1984
|
};
|
|
1727
1985
|
}));
|
|
1728
1986
|
};
|
|
@@ -1769,7 +2027,7 @@ const contributionsOf = async (context, scope, bumps, known = {}) => {
|
|
|
1769
2027
|
return contributions;
|
|
1770
2028
|
};
|
|
1771
2029
|
/** What a release PR covering `scope` would version, computed without writing anything. */
|
|
1772
|
-
const prepareRelease = async (context, scope, known = {}) => {
|
|
2030
|
+
const prepareRelease = async (context, scope, known = {}, forced) => {
|
|
1773
2031
|
const { release, services } = context;
|
|
1774
2032
|
const refs = unitRefs(release.units);
|
|
1775
2033
|
const [dependencies, named, base, pendingFiles] = await Promise.all([
|
|
@@ -1778,23 +2036,19 @@ const prepareRelease = async (context, scope, known = {}) => {
|
|
|
1778
2036
|
services.versioning.plan([], []),
|
|
1779
2037
|
services.versioning.pending()
|
|
1780
2038
|
]);
|
|
1781
|
-
const baseBumps = appBumps(base, dependencies, refs);
|
|
1782
|
-
const unreleased = await findUnreleased(context, new Set([...named, ...baseBumps.map(({ app }) => app)]));
|
|
1783
2039
|
const held = [...named].filter((app) => !scope.has(app));
|
|
1784
|
-
const adopted = unreleased.filter(({ app }) => scope.has(app)).flatMap(({ app, version, commits }) => {
|
|
1785
|
-
const ref = refs.find(({ name }) => name === app);
|
|
1786
|
-
return ref ? unreleasedChangesets(ref, version, commits) : [];
|
|
1787
|
-
});
|
|
1788
2040
|
const split = held.length > 0 ? splitChangesets(base.changesets, held, refs) : NOTHING_HELD;
|
|
1789
|
-
const
|
|
2041
|
+
const own = forced ? [forced.changeset] : [];
|
|
2042
|
+
const ceiling = forced?.level;
|
|
2043
|
+
const picked = held.length > 0 || forced ? await services.versioning.plan(own, split.waits, ceiling) : base;
|
|
1790
2044
|
const contributions = await contributionsOf(context, scope, appBumps(picked, dependencies, refs), known);
|
|
1791
|
-
const
|
|
1792
|
-
const
|
|
1793
|
-
const plan = contributed.length > 0 ? await services.versioning.plan(added, split.waits) : picked;
|
|
2045
|
+
const added = [...own, ...Object.values(contributions).flatMap((contribution) => contribution.added)];
|
|
2046
|
+
const plan = added.length > own.length ? await services.versioning.plan(added, split.waits, ceiling) : picked;
|
|
1794
2047
|
return {
|
|
2048
|
+
scope,
|
|
2049
|
+
forced,
|
|
1795
2050
|
pending: (held.length > 0 ? split.ships.length : pendingFiles.length) + added.length,
|
|
1796
2051
|
held,
|
|
1797
|
-
unreleased: unreleased.filter(({ app }) => !scope.has(app)),
|
|
1798
2052
|
split,
|
|
1799
2053
|
bumps: appBumps(plan, dependencies, refs),
|
|
1800
2054
|
companions: draggedUnits(plan, dependencies, refs, scope),
|
|
@@ -1805,6 +2059,42 @@ const prepareRelease = async (context, scope, known = {}) => {
|
|
|
1805
2059
|
};
|
|
1806
2060
|
};
|
|
1807
2061
|
//#endregion
|
|
2062
|
+
//#region src/application/chooseVersion.ts
|
|
2063
|
+
/** The release again at `level`, or null with why when versioning cannot land there. */
|
|
2064
|
+
const forceVersion = async (context, prepared, choices, level, reason) => {
|
|
2065
|
+
const packages = prepared.bumps.flatMap(({ app }) => context.release.units.filter(({ name }) => name === app).map((unit) => unit.packageName));
|
|
2066
|
+
const forced = await prepareRelease(context, prepared.scope, {}, forcedVersion(choices, level, reason, packages));
|
|
2067
|
+
const version = choices.versions[level];
|
|
2068
|
+
const elsewhere = forced.bumps.find(({ to }) => to !== version);
|
|
2069
|
+
if (elsewhere) {
|
|
2070
|
+
fail(context, `Can't force ${version}`, `${elsewhere.app} would go to ${elsewhere.to}.`);
|
|
2071
|
+
return null;
|
|
2072
|
+
}
|
|
2073
|
+
context.output.line(` ${paint(["bold", "yellow"], "!")} ${version} instead of ${choices.versions[choices.computed]}: ${reason}`);
|
|
2074
|
+
return forced;
|
|
2075
|
+
};
|
|
2076
|
+
/**
|
|
2077
|
+
* The release to open: as computed, or at the version the person chose instead with why. Null when
|
|
2078
|
+
* they cancel. A plain yes when no one version covers the release, under --yes or with no terminal.
|
|
2079
|
+
*/
|
|
2080
|
+
const chooseVersion = async (context, prepared, where) => {
|
|
2081
|
+
const { prompter, options } = context;
|
|
2082
|
+
const choices = versionChoices(prepared.bumps);
|
|
2083
|
+
if (!choices || options.yes || !prompter.interactive) return await confirm(context, `Release these ${where}?`, true) ? prepared : null;
|
|
2084
|
+
const { computed, versions } = choices;
|
|
2085
|
+
const picks = LEVELS.map((level) => ({
|
|
2086
|
+
value: level,
|
|
2087
|
+
label: `${versions[level]} ${level}${level === computed ? ", computed" : ""}`
|
|
2088
|
+
}));
|
|
2089
|
+
for (;;) {
|
|
2090
|
+
const level = await prompter.select(`Release these ${where} as (Esc cancels)`, picks, computed);
|
|
2091
|
+
if (!level) return null;
|
|
2092
|
+
if (level === computed) return prepared;
|
|
2093
|
+
const reason = await prompter.text(`Why ${versions[level]}? Tell users what changed, in one line.`);
|
|
2094
|
+
if (reason?.trim()) return forceVersion(context, prepared, choices, level, reason.trim());
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
//#endregion
|
|
1808
2098
|
//#region src/application/steps.ts
|
|
1809
2099
|
const MAX_OUTPUT_LINES = 40;
|
|
1810
2100
|
const reasonOf$1 = (error) => error instanceof Error ? error.message : String(error);
|
|
@@ -1909,15 +2199,17 @@ const openPrStep = ({ services: { codeHost: host } }, label, open) => {
|
|
|
1909
2199
|
//#endregion
|
|
1910
2200
|
//#region src/application/openReleasePr.ts
|
|
1911
2201
|
const plural$2 = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
1912
|
-
/** What happens to a unit once the release PR merges: its module ships the version
|
|
2202
|
+
/** What happens to a unit once the release PR merges: its module ships the version. */
|
|
1913
2203
|
const shipsOnMerge = (context, { contributions, companions }) => (bump) => {
|
|
1914
2204
|
const contributed = contributions[bump.app]?.onMerge;
|
|
1915
2205
|
if (contributed) return contributed;
|
|
1916
2206
|
const unit = context.release.units.find(({ name }) => name === bump.app);
|
|
1917
2207
|
const along = companions.find(({ app }) => app === bump.app);
|
|
1918
2208
|
const reason = along ? ` (not picked: ${along.why})` : bump.movedWith.length > 0 ? ` (moved with ${bump.movedWith.join(", ")})` : "";
|
|
1919
|
-
return
|
|
2209
|
+
return `Ship ${destination(context, [bump.app], "preview")} with ${(unit && moduleOf(context, unit)?.provider) ?? "its target"}${reason}`;
|
|
1920
2210
|
};
|
|
2211
|
+
/** Where a release sends what it moves. */
|
|
2212
|
+
const whereTo = (context, { bumps }) => destination(context, bumps.map(({ app }) => app), "preview");
|
|
1921
2213
|
/** Units going out unpicked, each with the package that takes it along. */
|
|
1922
2214
|
const printCompanions = ({ output, release }, { companions, split }) => {
|
|
1923
2215
|
if (companions.length === 0) return;
|
|
@@ -1935,23 +2227,21 @@ const printCompanions = ({ output, release }, { companions, split }) => {
|
|
|
1935
2227
|
/** The table a person reads before anything is written: each unit, its move, what ships. */
|
|
1936
2228
|
const printSummary = (context, prepared) => {
|
|
1937
2229
|
const { output, release } = context;
|
|
1938
|
-
const { bumps, packages, pending, held,
|
|
2230
|
+
const { bumps, packages, pending, held, contributions, companions } = prepared;
|
|
1939
2231
|
const dot = paint("dim", "·");
|
|
1940
2232
|
const stays = held.filter((app) => !bumps.some((bump) => bump.app === app));
|
|
1941
2233
|
const heldLabel = stays.length > 0 ? ` ${dot} ${stays.join(", ")} held` : "";
|
|
1942
|
-
const
|
|
2234
|
+
const moving = bumps.map(({ app }) => app);
|
|
1943
2235
|
output.line();
|
|
1944
|
-
output.line(` ${paint("bold", "Release")} ${dot} ${
|
|
2236
|
+
output.line(` ${paint("bold", "Release")} ${dot} ${environmentLabel(context, moving, "preview")} ${dot} ${plural$2(pending, "changeset")}${heldLabel}`);
|
|
1945
2237
|
output.line();
|
|
1946
2238
|
const width = Math.max(13, ...release.units.map(({ name }) => name.length)) + 2;
|
|
1947
|
-
output.line(paint("dim", ` ${"Unit".padEnd(width)}${"Version".padEnd(20)}${
|
|
2239
|
+
output.line(paint("dim", ` ${"Unit".padEnd(width)}${"Version".padEnd(20)}Ships ${destination(context, moving, "preview")}`));
|
|
1948
2240
|
release.units.forEach((unit) => {
|
|
1949
2241
|
const bump = bumps.find(({ app }) => app === unit.name);
|
|
1950
2242
|
const version = bump ? `${bump.from} → ${bump.to}` : unit.version;
|
|
1951
|
-
const left = unreleased.find(({ app }) => app === unit.name);
|
|
1952
2243
|
const ships = (() => {
|
|
1953
2244
|
if (held.includes(unit.name) && !bump) return paint("yellow", "⏸ held, its changesets stay pending");
|
|
1954
|
-
if (left && !bump) return paint("yellow", `! ${plural$2(left.commits.length, "commit")} since ${left.version}, no changeset: not in this release`);
|
|
1955
2245
|
const contributed = contributions[unit.name]?.summary;
|
|
1956
2246
|
if (contributed && contributed.length > 0) return contributed.join(`\n ${" ".repeat(width + 20)}`);
|
|
1957
2247
|
if (!bump) return paint("dim", "– nothing changed");
|
|
@@ -1964,6 +2254,12 @@ const printSummary = (context, prepared) => {
|
|
|
1964
2254
|
output.line();
|
|
1965
2255
|
printCompanions(context, prepared);
|
|
1966
2256
|
};
|
|
2257
|
+
/** Says what a plugin refuses in `prepared`; true when something does. */
|
|
2258
|
+
const refused = (context, { contributions }) => {
|
|
2259
|
+
const blocked = Object.values(contributions).find((entry) => entry.blocked)?.blocked;
|
|
2260
|
+
if (blocked) fail(context, blocked.title, blocked.detail, blocked.commands);
|
|
2261
|
+
return Boolean(blocked);
|
|
2262
|
+
};
|
|
1967
2263
|
/**
|
|
1968
2264
|
* Versions what `prepared` covers on one branch from main, opens its PR, and goes back to main.
|
|
1969
2265
|
* Null, with what to do, when it must not run.
|
|
@@ -1971,11 +2267,7 @@ const printSummary = (context, prepared) => {
|
|
|
1971
2267
|
const openReleasePr = async (context, prepared, replaces = []) => {
|
|
1972
2268
|
const { output, services, clock } = context;
|
|
1973
2269
|
printSummary(context, prepared);
|
|
1974
|
-
|
|
1975
|
-
if (blocked) {
|
|
1976
|
-
fail(context, blocked.title, blocked.detail, blocked.commands);
|
|
1977
|
-
return null;
|
|
1978
|
-
}
|
|
2270
|
+
if (refused(context, prepared)) return null;
|
|
1979
2271
|
const source = releaseSource("build", "preview", await services.sourceControl.position());
|
|
1980
2272
|
if (!source.allowed) {
|
|
1981
2273
|
fail(context, source.why === "not-main" ? "Not from main" : "main is behind origin", "a release versions what is merged.", [
|
|
@@ -2003,17 +2295,20 @@ const openReleasePr = async (context, prepared, replaces = []) => {
|
|
|
2003
2295
|
output.line(paint("dim", " Steps"));
|
|
2004
2296
|
planned.forEach((step, index) => output.line(` ${index + 1}. ${step}`));
|
|
2005
2297
|
output.line();
|
|
2006
|
-
|
|
2298
|
+
const chosen = await chooseVersion(context, prepared, whereTo(context, prepared));
|
|
2299
|
+
if (!chosen) {
|
|
2007
2300
|
output.line(paint("dim", "Nothing ran."));
|
|
2008
2301
|
return null;
|
|
2009
2302
|
}
|
|
2303
|
+
if (refused(context, chosen)) return null;
|
|
2304
|
+
const opening = prGroupsOf(context, chosen);
|
|
2010
2305
|
const now = clock.now();
|
|
2011
2306
|
const prs = [];
|
|
2012
|
-
for (const group of
|
|
2307
|
+
for (const group of opening) {
|
|
2013
2308
|
const apps = new Set(group.map(({ app }) => app));
|
|
2014
|
-
const scoped =
|
|
2309
|
+
const scoped = opening.length > 1 ? await prepareRelease(context, apps, chosen.contributions) : chosen;
|
|
2015
2310
|
const [first] = group;
|
|
2016
|
-
const pr = await openOne(context, scoped, kindOf, `${releaseBranchName(now)}${
|
|
2311
|
+
const pr = await openOne(context, scoped, kindOf, `${releaseBranchName(now)}${opening.length > 1 && first ? `-${first.app}` : ""}`, replaces);
|
|
2017
2312
|
if (!pr) {
|
|
2018
2313
|
if (prs.length > 0) output.line(paint("dim", ` ${listed(prs.map(({ number }) => `#${number}`))} stay open: merge them, then run shiplane for the rest.`));
|
|
2019
2314
|
return null;
|
|
@@ -2045,7 +2340,7 @@ const openOne = async (context, prepared, kindOf, branch, replaces) => {
|
|
|
2045
2340
|
branchStep(context, branch),
|
|
2046
2341
|
{
|
|
2047
2342
|
label: "versions and changelogs",
|
|
2048
|
-
run: () => services.versioning.apply(prepared.added, prepared.split.waits)
|
|
2343
|
+
run: () => services.versioning.apply(prepared.added, prepared.split.waits, prepared.forced?.level)
|
|
2049
2344
|
},
|
|
2050
2345
|
...Object.values(prepared.contributions).flatMap(({ writes }) => writes),
|
|
2051
2346
|
{
|
|
@@ -2058,7 +2353,7 @@ const openOne = async (context, prepared, kindOf, branch, replaces) => {
|
|
|
2058
2353
|
base: "main",
|
|
2059
2354
|
head: branch,
|
|
2060
2355
|
title,
|
|
2061
|
-
body: replacedLine(replaces) + releasePrBody(prepared.bumps, shipsOnMerge(context, prepared)),
|
|
2356
|
+
body: replacedLine(replaces) + releasePrBody(prepared.bumps, shipsOnMerge(context, prepared), whereTo(context, prepared)),
|
|
2062
2357
|
label: "type: chore"
|
|
2063
2358
|
});
|
|
2064
2359
|
return created.pr;
|
|
@@ -2072,16 +2367,12 @@ const openOne = async (context, prepared, kindOf, branch, replaces) => {
|
|
|
2072
2367
|
//#endregion
|
|
2073
2368
|
//#region src/domain/scope.ts
|
|
2074
2369
|
const plural$1 = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
2075
|
-
const previewChoice = ({ version, changesets,
|
|
2370
|
+
const previewChoice = ({ version, changesets, tagged, versioned, firstRelease, onChannel, decidedBy, releaseOnly, noEnvironment }) => {
|
|
2076
2371
|
const later = decidedBy ? ` · ${decidedBy.platform} decides ${decidedBy.choice} once picked` : "";
|
|
2077
2372
|
if (changesets > 0) return {
|
|
2078
2373
|
pending: true,
|
|
2079
2374
|
hint: `${plural$1(changesets, "changeset")}${later}`
|
|
2080
2375
|
};
|
|
2081
|
-
if (commits > 0) return {
|
|
2082
|
-
pending: true,
|
|
2083
|
-
hint: `${plural$1(commits, "commit")} since ${version}, changelog from its commits${later}`
|
|
2084
|
-
};
|
|
2085
2376
|
if (!tagged) {
|
|
2086
2377
|
if (versioned) return {
|
|
2087
2378
|
pending: true,
|
|
@@ -2103,12 +2394,13 @@ const previewChoice = ({ version, changesets, commits, tagged, versioned, firstR
|
|
|
2103
2394
|
pending: false,
|
|
2104
2395
|
hint: `${version} released, nothing new (${decidedBy.check} shows its builds)`
|
|
2105
2396
|
};
|
|
2397
|
+
const where = noEnvironment ? "live" : "on preview";
|
|
2106
2398
|
return onChannel ? {
|
|
2107
2399
|
pending: false,
|
|
2108
|
-
hint: `${version} is
|
|
2400
|
+
hint: `${version} is ${where}, nothing new`
|
|
2109
2401
|
} : {
|
|
2110
2402
|
pending: true,
|
|
2111
|
-
hint: `${version} released, not
|
|
2403
|
+
hint: `${version} released, not ${where} yet`
|
|
2112
2404
|
};
|
|
2113
2405
|
};
|
|
2114
2406
|
const productionChoice = ({ version, tagged, onChannel, onPreview, decidedBy, releaseOnly }) => {
|
|
@@ -2151,14 +2443,16 @@ const defaultScope = (info, environment) => new Set(scopeChoices(info, environme
|
|
|
2151
2443
|
*/
|
|
2152
2444
|
const pickScope = async (context, environment) => {
|
|
2153
2445
|
const { output, prompter, options, progress } = context;
|
|
2154
|
-
const info = await progress.during("Reading what changed: changesets,
|
|
2446
|
+
const info = await progress.during("Reading what changed: changesets, tags and GitHub deployments", "thinking", () => readScope(context, environment));
|
|
2155
2447
|
const choices = scopeChoices(info, environment);
|
|
2448
|
+
const where = destination(context, info.map(({ app }) => app), environment);
|
|
2156
2449
|
if (!choices.some(({ pending }) => pending)) {
|
|
2157
2450
|
output.line();
|
|
2158
2451
|
choices.forEach(({ app, hint }) => output.line(` ${paint("dim", `${app.padEnd(15)}${hint}`)}`));
|
|
2159
2452
|
output.line();
|
|
2160
|
-
|
|
2161
|
-
|
|
2453
|
+
const queue = environment === "preview" || info.every(({ releaseOnly }) => releaseOnly);
|
|
2454
|
+
progress.say("resting", `${paint("bold", `Nothing to release ${where}.`)} ${paint("dim", queue ? "Queue a change first:" : "Release to preview first:")}`);
|
|
2455
|
+
output.line(` ${paint("cyan", queue ? context.services.versioning.nextChange : "shiplane")}`);
|
|
2162
2456
|
output.line();
|
|
2163
2457
|
return null;
|
|
2164
2458
|
}
|
|
@@ -2166,7 +2460,7 @@ const pickScope = async (context, environment) => {
|
|
|
2166
2460
|
scope: defaultScope(info, environment),
|
|
2167
2461
|
info
|
|
2168
2462
|
};
|
|
2169
|
-
const picked = await prompter.multiselect(`What do you want to release
|
|
2463
|
+
const picked = await prompter.multiselect(`What do you want to release ${where}? Greyed units have nothing to release.`, choices.map(({ app, pending, hint }) => ({
|
|
2170
2464
|
value: app,
|
|
2171
2465
|
label: app,
|
|
2172
2466
|
hint,
|
|
@@ -2220,7 +2514,7 @@ const planShips = async (context, environment) => {
|
|
|
2220
2514
|
const { release, services, output } = context;
|
|
2221
2515
|
const { head } = await services.sourceControl.position();
|
|
2222
2516
|
output.line();
|
|
2223
|
-
output.line(` ${paint("bold", "Plan")} ${paint("dim", "·")} ${environment} ${paint("dim", "· nothing runs")}`);
|
|
2517
|
+
output.line(` ${paint("bold", "Plan")} ${paint("dim", "·")} ${environmentLabel(context, [], environment)} ${paint("dim", "· nothing runs")}`);
|
|
2224
2518
|
output.line(` ${paint("bold", "Order")} ${releaseOrder(release.units)}`);
|
|
2225
2519
|
const shipped = [];
|
|
2226
2520
|
for (const unit of release.units) {
|
|
@@ -2510,7 +2804,8 @@ const decideAll = async (context, environment, scope) => {
|
|
|
2510
2804
|
decision: module.decide ? await module.decide(decideContext(context), input) : webDecision(context, module, input, recorded)
|
|
2511
2805
|
};
|
|
2512
2806
|
};
|
|
2513
|
-
|
|
2807
|
+
const checked = module.kind === "published-package" ? module.provider : environment;
|
|
2808
|
+
let { input, decision } = await context.progress.during(module.releaseOnly ? `Checking what ${tag} needs` : `Checking what ${tag} needs on ${checked}`, "thinking", decide);
|
|
2514
2809
|
while (decision.action === "pull-request") {
|
|
2515
2810
|
const merged = await pullRequestFirst(context, decision);
|
|
2516
2811
|
if (merged === "failed") return null;
|
|
@@ -2640,7 +2935,7 @@ const shipQuestion = (going, paths, environment, context) => {
|
|
|
2640
2935
|
* triggered: EAS builds and workflows go on on their own, a Fly deploy from here once rolled out.
|
|
2641
2936
|
* Production asks for its name first. False on a failure.
|
|
2642
2937
|
*/
|
|
2643
|
-
const shipTo = async (context, environment, { scope, via }) => {
|
|
2938
|
+
const shipTo = async (context, environment, { scope, via, envChecked = /* @__PURE__ */ new Set() }) => {
|
|
2644
2939
|
const { output, prompter, options, services } = context;
|
|
2645
2940
|
if (environment === "production" && !options.ci) {
|
|
2646
2941
|
if (options.yes) {
|
|
@@ -2655,9 +2950,19 @@ const shipTo = async (context, environment, { scope, via }) => {
|
|
|
2655
2950
|
const ready = await decideAll(context, environment, scope);
|
|
2656
2951
|
if (!ready) return false;
|
|
2657
2952
|
if (ready.length === 0) {
|
|
2658
|
-
context.progress.say("resting", paint("dim", `Nothing to ship
|
|
2953
|
+
context.progress.say("resting", paint("dim", `Nothing to ship ${destination(context, scope ?? [], environment)}.`));
|
|
2659
2954
|
return true;
|
|
2660
2955
|
}
|
|
2956
|
+
const toCheck = ready.map(({ unit }) => unit).filter(({ name }) => !envChecked.has(name));
|
|
2957
|
+
const listing = new Set(toCheck.filter((unit) => unit.checkEnvBeforeDeploy).map(({ name }) => name));
|
|
2958
|
+
if (!(listing.size === 0 || await signIn(context, {
|
|
2959
|
+
requirements: signInsOf(context.release, listing),
|
|
2960
|
+
again: "ship again"
|
|
2961
|
+
}))) return false;
|
|
2962
|
+
if (!await checkEnvBeforeDeploy(context, {
|
|
2963
|
+
environment,
|
|
2964
|
+
units: toCheck
|
|
2965
|
+
})) return false;
|
|
2661
2966
|
const forced = options.ci ? "local" : via;
|
|
2662
2967
|
const paths = /* @__PURE__ */ new Map();
|
|
2663
2968
|
const unanswered = [];
|
|
@@ -2724,8 +3029,9 @@ const shipTo = async (context, environment, { scope, via }) => {
|
|
|
2724
3029
|
}
|
|
2725
3030
|
}
|
|
2726
3031
|
const names = going.map(({ input }) => input.tag).join(", ");
|
|
3032
|
+
const where = destination(context, going.map(({ unit }) => unit.name), environment);
|
|
2727
3033
|
output.line();
|
|
2728
|
-
context.progress.say("happy", `${paint(["bold", "green"], "✓ Triggered.")} ${paint("dim", `${names}, shipping
|
|
3034
|
+
context.progress.say("happy", `${paint(["bold", "green"], "✓ Triggered.")} ${paint("dim", `${names}, shipping ${where} on their own.`)}`);
|
|
2729
3035
|
await runFollowUps(context, going.map(({ unit, input }) => ({
|
|
2730
3036
|
unit,
|
|
2731
3037
|
tag: input.tag,
|
|
@@ -2930,13 +3236,16 @@ const releaseToPreview = async (context) => {
|
|
|
2930
3236
|
return true;
|
|
2931
3237
|
}
|
|
2932
3238
|
if (!await preflight(context, picked.scope)) return false;
|
|
3239
|
+
if (!await checkEnvBeforeDeploy(context, {
|
|
3240
|
+
environment: "preview",
|
|
3241
|
+
units: context.release.units.filter(({ name }) => picked.scope.has(name))
|
|
3242
|
+
})) return false;
|
|
2933
3243
|
const covered = picked.info.filter(({ app }) => picked.scope.has(app));
|
|
2934
3244
|
const [releasePrs, missing] = await progress.during("Looking for an open release PR and versions not tagged yet", "thinking", () => Promise.all([services.codeHost.openPrsFrom(RELEASE_BRANCH_PREFIX), missingTags(context)]));
|
|
2935
3245
|
const step = nextStep({
|
|
2936
3246
|
pending: covered.reduce((sum, { changesets }) => sum + changesets, 0),
|
|
2937
3247
|
releasePrs,
|
|
2938
|
-
untagged: missing.length
|
|
2939
|
-
unreleased: covered.filter(({ changesets, commits }) => changesets === 0 && commits > 0).length
|
|
3248
|
+
untagged: missing.length
|
|
2940
3249
|
});
|
|
2941
3250
|
let prs = [];
|
|
2942
3251
|
let current = context;
|
|
@@ -2963,7 +3272,7 @@ const releaseToPreview = async (context) => {
|
|
|
2963
3272
|
prs = fresh;
|
|
2964
3273
|
} else if (missing.length > 0) {
|
|
2965
3274
|
progress.say("thinking", `↻ Picking up a merged release`);
|
|
2966
|
-
output.line(paint("dim", ` Left to do: tag ${plural(missing.length, "version")} → ship
|
|
3275
|
+
output.line(paint("dim", ` Left to do: tag ${plural(missing.length, "version")} → ship ${destination(context, missing.map(({ app }) => app), "preview")}`));
|
|
2967
3276
|
}
|
|
2968
3277
|
if (prs.length > 0) stage("Merge");
|
|
2969
3278
|
for (const pr of prs) {
|
|
@@ -2997,7 +3306,10 @@ const releaseToPreview = async (context) => {
|
|
|
2997
3306
|
if (tags.length > 0) stage("Tags");
|
|
2998
3307
|
if (!await tagRelease(current, tags)) return false;
|
|
2999
3308
|
stage("Ship");
|
|
3000
|
-
return shipTo(current, "preview", {
|
|
3309
|
+
return shipTo(current, "preview", {
|
|
3310
|
+
scope: new Set([...picked.scope, ...tags.map(({ app }) => app)]),
|
|
3311
|
+
envChecked: picked.scope
|
|
3312
|
+
});
|
|
3001
3313
|
};
|
|
3002
3314
|
//#endregion
|
|
3003
3315
|
//#region src/application/customAdapter.ts
|
|
@@ -3260,6 +3572,7 @@ const rehearse = async (context) => {
|
|
|
3260
3572
|
//#region src/application/setup.ts
|
|
3261
3573
|
const ok = paint("green", "✓");
|
|
3262
3574
|
const unsure = paint("yellow", "?");
|
|
3575
|
+
const CHANGESETS_CONFIG_FILE = ".changeset/config.json";
|
|
3263
3576
|
/** What a flow port is called, and what proves the ready-made adapter fits. */
|
|
3264
3577
|
const FLOW_LABEL = {
|
|
3265
3578
|
sourceControl: {
|
|
@@ -3337,7 +3650,7 @@ const flowEvidence = async (context) => {
|
|
|
3337
3650
|
sourceControl: files.exists(".git") ? ".git" : null,
|
|
3338
3651
|
codeHost: github ? `remote github.com/${github}` : null,
|
|
3339
3652
|
ciPipeline: workflows[0] ? `.github/workflows/${workflows[0]}` : null,
|
|
3340
|
-
versioning: files.exists(
|
|
3653
|
+
versioning: files.exists(CHANGESETS_CONFIG_FILE) ? CHANGESETS_CONFIG_FILE : null
|
|
3341
3654
|
};
|
|
3342
3655
|
};
|
|
3343
3656
|
/** A name for a custom adapter: asked, checked, unused. Null when cancelled. */
|
|
@@ -3367,6 +3680,63 @@ const customWrites = (port, name, pkg) => [{
|
|
|
3367
3680
|
text: renderCustomTest(port, name, pkg),
|
|
3368
3681
|
created: true
|
|
3369
3682
|
}];
|
|
3683
|
+
/** What both ways of versioning need: the changesets config, and its CLI when it is missing. */
|
|
3684
|
+
const changesetsWrites = ({ files }) => {
|
|
3685
|
+
const manifest = files.read("package.json");
|
|
3686
|
+
const parsed = JSON.parse(manifest ?? "{}");
|
|
3687
|
+
const present = {
|
|
3688
|
+
...parsed.dependencies,
|
|
3689
|
+
...parsed.devDependencies
|
|
3690
|
+
}[CHANGESETS_CLI.name];
|
|
3691
|
+
return [{
|
|
3692
|
+
file: CHANGESETS_CONFIG_FILE,
|
|
3693
|
+
text: CHANGESETS_CONFIG,
|
|
3694
|
+
created: true
|
|
3695
|
+
}, ...manifest === null || present ? [] : [{
|
|
3696
|
+
file: "package.json",
|
|
3697
|
+
text: `${JSON.stringify({
|
|
3698
|
+
...parsed,
|
|
3699
|
+
devDependencies: {
|
|
3700
|
+
...parsed.devDependencies,
|
|
3701
|
+
[CHANGESETS_CLI.name]: CHANGESETS_CLI.version
|
|
3702
|
+
}
|
|
3703
|
+
}, null, 2)}\n`,
|
|
3704
|
+
created: false
|
|
3705
|
+
}]];
|
|
3706
|
+
};
|
|
3707
|
+
/** How a repository with no changesets config releases: asked once, commits unless told. */
|
|
3708
|
+
const chooseVersioning = async (context, yes, writes, pkg) => {
|
|
3709
|
+
const { prompter } = context;
|
|
3710
|
+
const picked = yes || !prompter.interactive ? "commits" : await prompter.select("How do you want to release?", [
|
|
3711
|
+
{
|
|
3712
|
+
value: "commits",
|
|
3713
|
+
label: "From commits",
|
|
3714
|
+
hint: "feat, fix and ! set the version, nothing to write"
|
|
3715
|
+
},
|
|
3716
|
+
{
|
|
3717
|
+
value: "changesets",
|
|
3718
|
+
label: "From changesets",
|
|
3719
|
+
hint: "you write what ships, and when"
|
|
3720
|
+
},
|
|
3721
|
+
{
|
|
3722
|
+
value: "custom",
|
|
3723
|
+
label: "Custom",
|
|
3724
|
+
hint: "a no-op in memory you implement"
|
|
3725
|
+
}
|
|
3726
|
+
], "commits");
|
|
3727
|
+
if (picked === null) return null;
|
|
3728
|
+
if (picked === "custom") {
|
|
3729
|
+
const name = await askName(context, "versioning", suggestedName("versioning"));
|
|
3730
|
+
if (name === null) return null;
|
|
3731
|
+
writes.push(...customWrites("versioning", name, pkg));
|
|
3732
|
+
return {
|
|
3733
|
+
factory: name,
|
|
3734
|
+
from: customFiles(name).from
|
|
3735
|
+
};
|
|
3736
|
+
}
|
|
3737
|
+
writes.push(...changesetsWrites(context));
|
|
3738
|
+
return picked === "commits" ? COMMITS_VERSIONING : DEFAULT_FLOW.versioning;
|
|
3739
|
+
};
|
|
3370
3740
|
/** The flow, from what the repository proves; asked part by part when unsure or when asked to. */
|
|
3371
3741
|
const chooseFlow = async (context, yes, needsPerson, writes, pkg) => {
|
|
3372
3742
|
const { output, prompter } = context;
|
|
@@ -3378,12 +3748,19 @@ const chooseFlow = async (context, yes, needsPerson, writes, pkg) => {
|
|
|
3378
3748
|
output.line(proof ? ` ${ok} ${ready.padEnd(16)}${paint("dim", proof)}` : ` ${unsure} ${label.padEnd(16)}${paint("dim", "not sure: nothing here proves one")}`);
|
|
3379
3749
|
});
|
|
3380
3750
|
if (FLOW_PORTS.every((port) => evidence[port] !== null)) return DEFAULT_FLOW;
|
|
3381
|
-
|
|
3382
|
-
|
|
3751
|
+
const missing = FLOW_PORTS.filter((port) => !evidence[port] && port !== "versioning");
|
|
3752
|
+
if (yes && missing.length > 0) {
|
|
3753
|
+
needsPerson.push(...missing.map((port) => `the ${FLOW_LABEL[port].label.toLowerCase()} (nothing proves one)`));
|
|
3383
3754
|
return null;
|
|
3384
3755
|
}
|
|
3385
3756
|
const flow = { ...DEFAULT_FLOW };
|
|
3386
|
-
for (const port of FLOW_PORTS) {
|
|
3757
|
+
for (const port of missing.length > 0 ? FLOW_PORTS : ["versioning"]) {
|
|
3758
|
+
if (port === "versioning" && !evidence.versioning) {
|
|
3759
|
+
const choice = await chooseVersioning(context, yes, writes, pkg);
|
|
3760
|
+
if (choice === null) return null;
|
|
3761
|
+
flow.versioning = choice;
|
|
3762
|
+
continue;
|
|
3763
|
+
}
|
|
3387
3764
|
const { label, ready } = FLOW_LABEL[port];
|
|
3388
3765
|
const picked = await prompter.select(`${label}?`, [{
|
|
3389
3766
|
value: "ready",
|
|
@@ -3633,8 +4010,12 @@ const setup = async (context, { yes }) => {
|
|
|
3633
4010
|
output.line(` ${paint("dim", "Custom adapters start in memory: fill them in until their contract test passes.")}`);
|
|
3634
4011
|
output.line(` ${paint("dim", "Works? Share it as shiplane-<name>, or open a pull request at github.com/arnaud-zg/packages.")}`);
|
|
3635
4012
|
}
|
|
4013
|
+
const fromCommits = flow ? flow.versioning.factory === COMMITS_VERSIONING.factory : existing?.flow.versioning.name === "commits";
|
|
4014
|
+
const next = fromCommits ? "erge a commit" : "dd a changeset, merge";
|
|
4015
|
+
const install = writes.some(({ file }) => file === "package.json");
|
|
4016
|
+
const start = fromCommits ? "m" : "a";
|
|
3636
4017
|
output.line();
|
|
3637
|
-
output.line(` ${ok} ${paint("bold", "Ready.")}
|
|
4018
|
+
output.line(` ${ok} ${paint("bold", "Ready.")} ${install ? `Run ${runner(context)} install, then ${start}` : start.toUpperCase()}${next}, and run ${paint("cyan", "shiplane")}`);
|
|
3638
4019
|
return true;
|
|
3639
4020
|
};
|
|
3640
4021
|
const cancelled = (context) => {
|
|
@@ -3776,7 +4157,6 @@ const readStatus = async (context, environment) => {
|
|
|
3776
4157
|
tag: tagName(entry.app, entry.version, context.release.tagFormat),
|
|
3777
4158
|
tagged: entry.tagged,
|
|
3778
4159
|
changesets: entry.changesets,
|
|
3779
|
-
commits: entry.commits,
|
|
3780
4160
|
pending: choice?.pending ?? false,
|
|
3781
4161
|
hint: choice?.hint ?? "",
|
|
3782
4162
|
...await live(entry.app)
|
|
@@ -3787,12 +4167,11 @@ const readStatus = async (context, environment) => {
|
|
|
3787
4167
|
next: nextStep({
|
|
3788
4168
|
pending: info.reduce((sum, { changesets }) => sum + changesets, 0),
|
|
3789
4169
|
releasePrs,
|
|
3790
|
-
untagged: untagged.length
|
|
3791
|
-
unreleased: info.filter(({ changesets, commits }) => changesets === 0 && commits > 0).length
|
|
4170
|
+
untagged: untagged.length
|
|
3792
4171
|
})
|
|
3793
4172
|
};
|
|
3794
4173
|
};
|
|
3795
4174
|
//#endregion
|
|
3796
|
-
export { refreshEditorSchema as C,
|
|
4175
|
+
export { refreshEditorSchema as C, keysAt as D, ENVIRONMENTS as E, nodeFiles as O, CONFIG_FILE as S, optionsFor as T, loadRelease as _, releaseToPreview as a, initRelease as b, promote as c, pickScope as d, openReleasePr as f, findConfig as g, docsFor as h, setup as i, shipTo as l, newAdapter as m, systemShell as n, missingTags as o, prepareRelease as p, liveLine as r, tagRelease as s, readStatus as t, planShips as u, addUnit as v, environmentLabel as w, doctor as x, removeUnit as y };
|
|
3797
4176
|
|
|
3798
|
-
//# sourceMappingURL=readStatus-
|
|
4177
|
+
//# sourceMappingURL=readStatus-BnEVjKc8.js.map
|