@git.zone/cli 3.0.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/helpers.tsdocker.d.ts +3 -0
- package/dist_ts/helpers.tsdocker.js +16 -0
- package/dist_ts/helpers.workflow.d.ts +12 -0
- package/dist_ts/helpers.workflow.js +65 -1
- package/dist_ts/mod_config/index.js +92 -7
- package/dist_ts/mod_release/index.d.ts +4 -0
- package/dist_ts/mod_release/index.js +58 -4
- package/package.json +1 -1
- package/readme.md +23 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.tsdocker.ts +30 -0
- package/ts/helpers.workflow.ts +88 -0
- package/ts/mod_config/index.ts +124 -7
- package/ts/mod_release/index.ts +81 -2
package/ts/mod_release/index.ts
CHANGED
|
@@ -9,10 +9,15 @@ import {
|
|
|
9
9
|
readPendingChangelog,
|
|
10
10
|
} from "../helpers.changelog.js";
|
|
11
11
|
import {
|
|
12
|
+
formatTsdockerMinimumVersion,
|
|
13
|
+
getDeclaredTsdockerRange,
|
|
14
|
+
getTsdockerMinimumVersion,
|
|
12
15
|
resolveReleaseWorkflow,
|
|
16
|
+
supportsTsdockerMinimumVersion,
|
|
13
17
|
type IResolvedReleaseWorkflow,
|
|
14
18
|
} from "../helpers.workflow.js";
|
|
15
19
|
import * as commitHelpers from "../mod_commit/mod.helpers.js";
|
|
20
|
+
import { hasInstalledProjectTsdockerBinary } from "../helpers.tsdocker.js";
|
|
16
21
|
|
|
17
22
|
type TTargetStatus = "success" | "already-published" | "skipped" | "failed";
|
|
18
23
|
|
|
@@ -267,6 +272,51 @@ async function runDockerTarget(
|
|
|
267
272
|
return [{ target: "docker", status: "skipped", message: "disabled" }];
|
|
268
273
|
}
|
|
269
274
|
|
|
275
|
+
let packageJson: unknown;
|
|
276
|
+
try {
|
|
277
|
+
packageJson = JSON.parse(
|
|
278
|
+
await plugins.fs.readFile(plugins.path.join(paths.cwd, "package.json"), "utf8"),
|
|
279
|
+
);
|
|
280
|
+
} catch {
|
|
281
|
+
packageJson = undefined;
|
|
282
|
+
}
|
|
283
|
+
if (!getDeclaredTsdockerRange(packageJson)) {
|
|
284
|
+
return [{
|
|
285
|
+
target: "tsdocker",
|
|
286
|
+
status: "failed",
|
|
287
|
+
message: "Docker releases require @git.zone/tsdocker as a project dependency",
|
|
288
|
+
}];
|
|
289
|
+
}
|
|
290
|
+
if (!(await hasInstalledProjectTsdockerBinary(paths.cwd))) {
|
|
291
|
+
return [{
|
|
292
|
+
target: "tsdocker",
|
|
293
|
+
status: "failed",
|
|
294
|
+
message: "Docker releases require the installed project-local tSDocker binary",
|
|
295
|
+
}];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const minimumTsdockerVersion = getTsdockerMinimumVersion(
|
|
299
|
+
workflow.dockerBuildRegistries.length > 0,
|
|
300
|
+
workflow.dockerTest,
|
|
301
|
+
);
|
|
302
|
+
if (minimumTsdockerVersion) {
|
|
303
|
+
const versionResult = await smartshellInstance.exec("pnpm exec tsdocker --version");
|
|
304
|
+
if (
|
|
305
|
+
versionResult.exitCode !== 0
|
|
306
|
+
|| !supportsTsdockerMinimumVersion(
|
|
307
|
+
versionResult.combinedOutput,
|
|
308
|
+
minimumTsdockerVersion,
|
|
309
|
+
)
|
|
310
|
+
) {
|
|
311
|
+
const minimumVersion = formatTsdockerMinimumVersion(minimumTsdockerVersion);
|
|
312
|
+
return [{
|
|
313
|
+
target: "tsdocker",
|
|
314
|
+
status: "failed",
|
|
315
|
+
message: `Docker release options require project-local @git.zone/tsdocker >= ${minimumVersion}`,
|
|
316
|
+
}];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
270
320
|
const command = buildTsdockerPushCommand(workflow);
|
|
271
321
|
const result = await smartshellInstance.exec(command);
|
|
272
322
|
const output = result.combinedOutput;
|
|
@@ -279,8 +329,29 @@ async function runDockerTarget(
|
|
|
279
329
|
}];
|
|
280
330
|
}
|
|
281
331
|
|
|
282
|
-
|
|
283
|
-
|
|
332
|
+
type TDockerCommandWorkflow = Pick<
|
|
333
|
+
IResolvedReleaseWorkflow,
|
|
334
|
+
| "dockerRegistry"
|
|
335
|
+
| "dockerBuildRegistries"
|
|
336
|
+
| "dockerTest"
|
|
337
|
+
| "dockerNoBuild"
|
|
338
|
+
| "dockerCached"
|
|
339
|
+
| "dockerParallel"
|
|
340
|
+
| "dockerContext"
|
|
341
|
+
| "dockerPatterns"
|
|
342
|
+
>;
|
|
343
|
+
|
|
344
|
+
export function buildTsdockerPushCommand(workflow: TDockerCommandWorkflow): string {
|
|
345
|
+
const commandParts = ["pnpm", "exec", "tsdocker", "push"];
|
|
346
|
+
if (workflow.dockerRegistry) {
|
|
347
|
+
commandParts.push(`--registry=${shellQuote(workflow.dockerRegistry)}`);
|
|
348
|
+
}
|
|
349
|
+
if (workflow.dockerBuildRegistries.length > 0) {
|
|
350
|
+
commandParts.push(`--build-registries=${shellQuote(workflow.dockerBuildRegistries.join(","))}`);
|
|
351
|
+
}
|
|
352
|
+
if (workflow.dockerTest) {
|
|
353
|
+
commandParts.push("--test");
|
|
354
|
+
}
|
|
284
355
|
if (workflow.dockerNoBuild) {
|
|
285
356
|
commandParts.push("--no-build");
|
|
286
357
|
}
|
|
@@ -328,6 +399,9 @@ function printReleasePlan(workflow: IResolvedReleaseWorkflow): void {
|
|
|
328
399
|
}
|
|
329
400
|
if (workflow.targets.includes("docker")) {
|
|
330
401
|
console.log(`docker engine: ${workflow.dockerEngine}`);
|
|
402
|
+
console.log(`docker registry: ${workflow.dockerRegistry || "all configured registries"}`);
|
|
403
|
+
console.log(`docker build authentication: ${workflow.dockerBuildRegistries.length > 0 ? workflow.dockerBuildRegistries.join(", ") : "all configured registries"}`);
|
|
404
|
+
console.log(`docker image tests: ${workflow.dockerTest ? "required before destination publication" : "not requested"}`);
|
|
331
405
|
console.log(`docker patterns: ${workflow.dockerPatterns.length > 0 ? workflow.dockerPatterns.join(", ") : "all Dockerfiles"}`);
|
|
332
406
|
console.log(`docker options: ${formatDockerOptions(workflow)}`);
|
|
333
407
|
}
|
|
@@ -336,6 +410,11 @@ function printReleasePlan(workflow: IResolvedReleaseWorkflow): void {
|
|
|
336
410
|
|
|
337
411
|
function formatDockerOptions(workflow: IResolvedReleaseWorkflow): string {
|
|
338
412
|
const options: string[] = [];
|
|
413
|
+
if (workflow.dockerRegistry) options.push(`registry=${workflow.dockerRegistry}`);
|
|
414
|
+
if (workflow.dockerBuildRegistries.length > 0) {
|
|
415
|
+
options.push(`buildRegistries=${workflow.dockerBuildRegistries.join(",")}`);
|
|
416
|
+
}
|
|
417
|
+
if (workflow.dockerTest) options.push("test");
|
|
339
418
|
if (workflow.dockerCached) options.push("cached");
|
|
340
419
|
if (workflow.dockerParallel) options.push(`parallel=${workflow.dockerParallel === true ? "true" : workflow.dockerParallel}`);
|
|
341
420
|
if (workflow.dockerNoBuild) options.push("no-build");
|