aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-02-23 23:07:27 +0100
committerGitHub <noreply@github.com>2024-02-23 22:07:27 +0000
commit08c1926e1c3e2487f207b5f225d8b0f2831d0708 (patch)
tree823254a7ecdd776794c15c33a97b956c13f87516
parent53c7d8908e5ef35818b72b8c3d873b509269bc1a (diff)
downloadgitea-08c1926e1c3e2487f207b5f225d8b0f2831d0708.tar.gz
gitea-08c1926e1c3e2487f207b5f225d8b0f2831d0708.zip
Refactor generate-svg.js (#29348)
Small refactor to avoid `process` global and to sync it with `generate-images`.
-rwxr-xr-xbuild/generate-svg.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/build/generate-svg.js b/build/generate-svg.js
index 2c0a5e37ba..f26b60d960 100755
--- a/build/generate-svg.js
+++ b/build/generate-svg.js
@@ -4,15 +4,16 @@ import {optimize} from 'svgo';
import {parse} from 'node:path';
import {readFile, writeFile, mkdir} from 'node:fs/promises';
import {fileURLToPath} from 'node:url';
+import {exit} from 'node:process';
const glob = (pattern) => fastGlob.sync(pattern, {
cwd: fileURLToPath(new URL('..', import.meta.url)),
absolute: true,
});
-function exit(err) {
+function doExit(err) {
if (err) console.error(err);
- process.exit(err ? 1 : 0);
+ exit(err ? 1 : 0);
}
async function processFile(file, {prefix, fullName} = {}) {
@@ -64,7 +65,7 @@ async function main() {
}
try {
- exit(await main());
+ doExit(await main());
} catch (err) {
- exit(err);
+ doExit(err);
}