-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtagit.mjs
More file actions
executable file
·40 lines (35 loc) · 1.15 KB
/
tagit.mjs
File metadata and controls
executable file
·40 lines (35 loc) · 1.15 KB
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
#!/usr/bin/env node
import 'dotenv/config';
import { log, registerHandlers, registerSignals } from '@eliware/common';
import fs from 'fs';
import { execSync } from 'child_process';
import { updateVersionFiles } from './src/updateVersionFiles.mjs';
import { gitOperations } from './src/gitOperations.mjs';
(async () => {
if (process.env.NODE_ENV === 'test') {
return;
}
// Register handlers/signals so logging and cleanup are available
registerHandlers({ log });
registerSignals({ log });
// Early abort: if a .notag file exists in the repo root, stop the process.
// This allows temporarily preventing tagging/commits without changing scripts.
try {
if (fs.existsSync('.notag')) {
log.warn('.notag file detected — aborting tag/release process.');
process.exit(0);
}
} catch (err) {
log.error('Error checking for .notag file:', err);
process.exit(1);
}
log.info('tagit Started');
try {
const newVersion = await updateVersionFiles(fs, log);
log.info(`Updated version to ${newVersion}`);
gitOperations(execSync, fs, log, newVersion);
} catch (error) {
log.error(error);
process.exit(1);
}
})();