-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.js
40 lines (30 loc) · 1.06 KB
/
release.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { join } from "node:path";
import { createRequire } from "node:module";
import console from "console-ansi";
import standardVersion from "standard-version";
import build from "./build.js";
import { checkUncommitedChanges, exec } from "./utils.js";
const require = createRequire(import.meta.url);
const release = async (options) => {
try {
await checkUncommitedChanges(options);
await build(options);
if (options.standardVersion) {
const { stdout, stderr } = await exec(`git add -A`, { cwd: options.cwd });
if (stderr) throw new Error(stderr);
console.log(stdout);
await standardVersion({
path: options.cwd,
preset: require.resolve("conventional-changelog-angular"),
infile: join(options.cwd, "CHANGELOG.md"),
commitAll: true,
...(options.standardVersion || {}),
...(options.argv || {}),
});
}
} catch (error) {
console.error(error);
}
};
release.description = `Bump the version, generate changelog release, create a new commit with git tag.`;
export default release;