@tallyrelease/cli 0.2.0-beta.7 → 0.2.0-beta.9
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 +1 -1
- package/dist/ci/summary.d.ts +2 -0
- package/dist/ci/summary.js +10 -0
- package/dist/commands/plan.d.ts +1 -0
- package/dist/commands/plan.js +29 -2
- package/dist/commands/shadow.js +4 -6
- package/dist/main.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Global flags: `--cwd <dir>` (repository root), `--config <file>` (default `tally
|
|
|
42
42
|
- `tallyrelease check` validates config, plugins, units, graph and release config; with released units it also checks the repository's tags.
|
|
43
43
|
- `tallyrelease graph [--format text|json|mermaid] [--json]` prints units and edges.
|
|
44
44
|
- `tallyrelease affected [--base <ref>] [--format text|json|tsv] [--json] [--out <file>] [--github-output] [--tag <tag>]` computes the build set. `--out` writes the affected document as JSON, `--github-output` appends outputs to `$GITHUB_OUTPUT`. `--tag` (repeatable) keeps units with any of the given tags.
|
|
45
|
-
- `tallyrelease plan [--branch <name>] [--base <ref>] [--head <ref>] [--all] [--format text|json] [--json] [--out <file>] [--github-output]` computes the release plan without changing anything: kind, base version, bump, next version and prerelease version per unit. `--head` plans another commit with the current config, `--all` also lists released units with a pending release outside the build set. `--github-output` writes `plan`, the path of the written plan (`--out`, else `$RUNNER_TEMP/tallyrelease-plan.json`). The JSON schema is exported as `@tallyrelease/cli/plan.schema.json`.
|
|
45
|
+
- `tallyrelease plan [--branch <name>] [--base <ref>] [--head <ref>] [--all] [--format text|json] [--json] [--out <file>] [--github-output] [--summary]` computes the release plan without changing anything: kind, base version, bump, next version and prerelease version per unit. `--head` plans another commit with the current config, `--all` also lists released units with a pending release outside the build set. `--github-output` writes `plan`, the path of the written plan (`--out`, else `$RUNNER_TEMP/tallyrelease-plan.json`). `--summary` appends a markdown summary to `$GITHUB_STEP_SUMMARY`, or prints it instead of the table when unset (exit 2 with `--json` then). The JSON schema is exported as `@tallyrelease/cli/plan.schema.json`.
|
|
46
46
|
- `tallyrelease explain <unit> [--branch <name>] [--base <ref>]` explains a unit: why it is affected, which commits and files bump it (including changes absorbed from unreleased dependencies), propagation and Release-As footers.
|
|
47
47
|
|
|
48
48
|
- `tallyrelease shadow [--manifest <path>] [--rp-config <path>] [--head <ref>] [--branch <name>] [--pin <spec>] [--out <file>] [--summary] [--strict]` compares tallyrelease with a release-please release: on a push that changes the release-please manifest, it plans the parent commit and compares each unit's next version with the new manifest value. See [Shadow mode](#shadow-mode).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { appendFileSync } from "node:fs";
|
|
2
|
+
/** Appends markdown to `$GITHUB_STEP_SUMMARY`; false when it is not set. */
|
|
3
|
+
export const appendStepSummary = (env, markdown) => {
|
|
4
|
+
const path = env["GITHUB_STEP_SUMMARY"];
|
|
5
|
+
if (!path) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
appendFileSync(path, markdown);
|
|
9
|
+
return true;
|
|
10
|
+
};
|
package/dist/commands/plan.d.ts
CHANGED
package/dist/commands/plan.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TallyError } from "@tallyrelease/core";
|
|
2
2
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
|
-
import { baseLine, resolveBuildBase } from "../ci/base.js";
|
|
4
|
+
import { baseLabel, baseLine, resolveBuildBase } from "../ci/base.js";
|
|
5
5
|
import { planGithubOutput } from "../ci/outputs.js";
|
|
6
|
+
import { appendStepSummary } from "../ci/summary.js";
|
|
6
7
|
import { alignColumns } from "../output/columns.js";
|
|
7
8
|
import { count } from "../output/count.js";
|
|
8
9
|
import { painter } from "../output/paint.js";
|
|
@@ -53,6 +54,27 @@ const text = (session, doc, base) => {
|
|
|
53
54
|
lines.push(paint("bold", header), ...rows, "", `${count(doc.units.length, "unit")} planned: ${kinds.join(", ")}`);
|
|
54
55
|
return `${lines.join("\n")}\n`;
|
|
55
56
|
};
|
|
57
|
+
const markdown = (doc, base) => {
|
|
58
|
+
const lines = [
|
|
59
|
+
"### tallyrelease plan",
|
|
60
|
+
"",
|
|
61
|
+
`Branch ${lineLabel(doc.line, doc.branch)}.`,
|
|
62
|
+
"",
|
|
63
|
+
`Base ${base.base?.slice(0, 7) ?? "none"} (${baseLabel(base)}).`,
|
|
64
|
+
"",
|
|
65
|
+
];
|
|
66
|
+
if (doc.units.length === 0) {
|
|
67
|
+
lines.push("No units planned.");
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const grouped = doc.units.some((u) => u.group !== null);
|
|
71
|
+
lines.push(`| Unit |${grouped ? " Group |" : ""} Kind | From | Bump | Next | Version |`, `| :-- |${grouped ? " :-- |" : ""} :-- | :-- | :-- | :-- | :-- |`, ...doc.units.map((u) => `| ${u.id} |${grouped ? ` ${u.group ?? "-"} |` : ""} ${u.kind} | ${u.from ?? "-"} | ${u.bump ?? "-"} | ${u.next ?? "-"} | ${u.version ?? "-"} |`));
|
|
72
|
+
}
|
|
73
|
+
if (doc.warnings.length > 0) {
|
|
74
|
+
lines.push("", "Warnings:", "", ...doc.warnings.map((w) => `- ${w.code}: ${w.message}`));
|
|
75
|
+
}
|
|
76
|
+
return `${lines.join("\n")}\n`;
|
|
77
|
+
};
|
|
56
78
|
/**
|
|
57
79
|
* Plan options for `--branch`, `--base` and `--head`. With `--head` only
|
|
58
80
|
* `--base` and the local merge base apply, and files come from the commit.
|
|
@@ -129,6 +151,11 @@ export const plan = async (session, flags) => {
|
|
|
129
151
|
}
|
|
130
152
|
appendFileSync(outputPath, planGithubOutput(path));
|
|
131
153
|
}
|
|
154
|
+
const appended = flags.summary && appendStepSummary(session.env, markdown(doc, base));
|
|
132
155
|
const format = flags.format ?? (flags.json ? "json" : "text");
|
|
133
|
-
session.stdout.write(format === "json"
|
|
156
|
+
session.stdout.write(format === "json"
|
|
157
|
+
? json
|
|
158
|
+
: flags.summary && !appended
|
|
159
|
+
? markdown(doc, base)
|
|
160
|
+
: text(session, doc, base));
|
|
134
161
|
};
|
package/dist/commands/shadow.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computePlan, TallyError } from "@tallyrelease/core";
|
|
2
|
-
import {
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
+
import { appendStepSummary } from "../ci/summary.js";
|
|
4
5
|
import { alignColumns } from "../output/columns.js";
|
|
5
6
|
import { count } from "../output/count.js";
|
|
6
7
|
import { branchName } from "../session.js";
|
|
@@ -139,11 +140,8 @@ const writeReport = (session, flags, report) => {
|
|
|
139
140
|
if (flags.out !== undefined) {
|
|
140
141
|
writeFileSync(resolve(session.cwd, flags.out), `${JSON.stringify(report, null, 2)}\n`);
|
|
141
142
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
appendFileSync(stepSummary, markdown(report));
|
|
145
|
-
}
|
|
146
|
-
session.stdout.write(flags.summary && !stepSummary ? markdown(report) : text(report));
|
|
143
|
+
const appended = flags.summary && appendStepSummary(env, markdown(report));
|
|
144
|
+
session.stdout.write(flags.summary && !appended ? markdown(report) : text(report));
|
|
147
145
|
if (env["GITHUB_ACTIONS"] === "true") {
|
|
148
146
|
for (const r of unlabelled(report.rows)) {
|
|
149
147
|
session.stdout.write(`::warning title=tallyrelease shadow::${escapeData(`${r.path}: ${r.status} (release-please ${r.after ?? "-"}, tallyrelease ${r.next ?? "-"})`)}\n`);
|
package/dist/main.js
CHANGED
|
@@ -79,10 +79,16 @@ export const main = async (argv, deps) => {
|
|
|
79
79
|
]))
|
|
80
80
|
.option("--out <file>", "write the plan to a file")
|
|
81
81
|
.option("--github-output", "append outputs to $GITHUB_OUTPUT")
|
|
82
|
+
.option("--summary", "write markdown to $GITHUB_STEP_SUMMARY, else print it instead of the table")
|
|
82
83
|
.action(async (flags, cmd) => {
|
|
83
84
|
if (flags.json && flags.format !== undefined) {
|
|
84
85
|
cmd.error("--json and --format cannot be combined", { exitCode: 2 });
|
|
85
86
|
}
|
|
87
|
+
if (flags.summary &&
|
|
88
|
+
(flags.json || flags.format === "json") &&
|
|
89
|
+
!deps.env["GITHUB_STEP_SUMMARY"]) {
|
|
90
|
+
cmd.error("--summary needs GITHUB_STEP_SUMMARY when printing JSON; both use stdout", { exitCode: 2 });
|
|
91
|
+
}
|
|
86
92
|
await plan(session(), flags);
|
|
87
93
|
});
|
|
88
94
|
program
|