@aklinker1/zero-changelog 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/release.mjs +15 -13
- package/package.json +1 -1
package/dist/release.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { serializeChangelog } from "./serialize-changelog.mjs";
|
|
|
13
13
|
import { updateVersionFiles } from "./update-version-files.mjs";
|
|
14
14
|
import { exec } from "node:child_process";
|
|
15
15
|
import { readFile, writeFile } from "node:fs/promises";
|
|
16
|
-
import { basename, resolve } from "node:path";
|
|
16
|
+
import { basename, join, resolve } from "node:path";
|
|
17
17
|
//#region src/internal/run.ts
|
|
18
18
|
/** Run a command, inheriting stdio. */
|
|
19
19
|
async function run(options) {
|
|
@@ -72,7 +72,8 @@ async function release(options) {
|
|
|
72
72
|
console.log("---");
|
|
73
73
|
console.log(releaseNotes);
|
|
74
74
|
console.log("---");
|
|
75
|
-
const
|
|
75
|
+
const changelogPath = join(path, "CHANGELOG.md");
|
|
76
|
+
const changelog = parseChangelog(await readFile(changelogPath, "utf8").catch((err) => {
|
|
76
77
|
if (err.code === "ENOENT") return "";
|
|
77
78
|
throw err;
|
|
78
79
|
}));
|
|
@@ -80,18 +81,8 @@ async function release(options) {
|
|
|
80
81
|
header: `v${version}`,
|
|
81
82
|
body: releaseNotes
|
|
82
83
|
});
|
|
83
|
-
await writeFile(
|
|
84
|
+
await writeFile(changelogPath, serializeChangelog(changelog), "utf8");
|
|
84
85
|
console.log("CHANGELOG.md updated");
|
|
85
|
-
if (dryRun && dryRunPublishCommands?.length) for (const cmd of dryRunPublishCommands) await run({
|
|
86
|
-
dryRun: false,
|
|
87
|
-
cwd: path,
|
|
88
|
-
cmd
|
|
89
|
-
});
|
|
90
|
-
else if (publishCommands?.length) for (const cmd of publishCommands) await run({
|
|
91
|
-
dryRun,
|
|
92
|
-
cwd: path,
|
|
93
|
-
cmd
|
|
94
|
-
});
|
|
95
86
|
const commit = template(commitTemplate, {
|
|
96
87
|
version,
|
|
97
88
|
path,
|
|
@@ -112,6 +103,17 @@ async function release(options) {
|
|
|
112
103
|
cwd: path,
|
|
113
104
|
cmd: `git tag ${tag}`
|
|
114
105
|
});
|
|
106
|
+
console.log("Changes committed");
|
|
107
|
+
if (dryRun && dryRunPublishCommands?.length) for (const cmd of dryRunPublishCommands) await run({
|
|
108
|
+
dryRun: false,
|
|
109
|
+
cwd: path,
|
|
110
|
+
cmd
|
|
111
|
+
});
|
|
112
|
+
else if (publishCommands?.length) for (const cmd of publishCommands) await run({
|
|
113
|
+
dryRun,
|
|
114
|
+
cwd: path,
|
|
115
|
+
cmd
|
|
116
|
+
});
|
|
115
117
|
await run({
|
|
116
118
|
dryRun,
|
|
117
119
|
cwd: path,
|