Skip to content

Commit e9a613c

Browse files
committed
rename func
1 parent 48a4421 commit e9a613c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import nanoSpawn, {SubprocessError} from "nano-spawn";
33
import {parseArgs} from "node:util";
44
import {basename, dirname, join, relative} from "node:path";
5-
import {cwd, exit as doExit, stdout} from "node:process";
5+
import {cwd, exit, stdout} from "node:process";
66
import {EOL, platform} from "node:os";
77
import {readFileSync, writeFileSync, accessSync, truncateSync, statSync} from "node:fs";
88
import pkg from "./package.json" with {type: "json"};
@@ -153,15 +153,15 @@ function joinStrings(strings: Array<string | undefined>, separator: string): str
153153
return arr.join(separator).trim();
154154
}
155155

156-
function exit(err?: Error | string | void): void {
156+
function end(err?: Error | string | void): void {
157157
if (err instanceof SubprocessError) {
158158
console.info(`${err.message}\n${err.output}`);
159159
} else if (err instanceof Error) {
160160
console.info(String(err.stack || err.message || err).trim());
161161
} else if (err) {
162162
console.info(err);
163163
}
164-
doExit(err ? 1 : 0);
164+
exit(err ? 1 : 0);
165165
}
166166

167167
function ensureEol(str: string): string {
@@ -199,7 +199,7 @@ async function main(): Promise<void> {
199199

200200
if (args.version) {
201201
console.info(pkg.version || "0.0.0");
202-
exit();
202+
end();
203203
}
204204

205205
if (!commands.has(level) || args.help) {
@@ -223,7 +223,7 @@ async function main(): Promise<void> {
223223
Examples:
224224
$ versions patch
225225
$ versions -c 'npm run build' -m 'Release _VER_' minor file.css`);
226-
exit();
226+
end();
227227
}
228228

229229
let date = "";
@@ -239,7 +239,7 @@ async function main(): Promise<void> {
239239
// obtain old version
240240
let baseVersion: string = "";
241241
if (!args.base) {
242-
if (args.gitless) return exit(new Error(`--gitless requires --base to be set`));
242+
if (args.gitless) return end(new Error(`--gitless requires --base to be set`));
243243
let stdout: string = "";
244244
try {
245245
({stdout} = await nanoSpawn("git", ["tag", "--list", "--sort=-creatordate"]));
@@ -278,7 +278,7 @@ async function main(): Promise<void> {
278278
let [_, re, replacement, flags] = (/^s#(.+?)#(.+?)#(.*)$/.exec(replaceStr) || []);
279279

280280
if (!re || !replacement) {
281-
exit(new Error(`Invalid replace string: ${replaceStr}`));
281+
end(new Error(`Invalid replace string: ${replaceStr}`));
282282
}
283283

284284
replacement = replaceTokens(replacement, newVersion);
@@ -365,4 +365,4 @@ async function main(): Promise<void> {
365365
writeResult(await nanoSpawn("git", ["tag", "-f", "-F", "-", tagName], {stdin: {string: tagMsg}}));
366366
}
367367

368-
main().then(exit).catch(exit);
368+
main().then(end).catch(end);

0 commit comments

Comments
 (0)