@fmdzc/cli-ai 3.0.3 → 3.0.4
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/LICENSE +15 -15
- package/README.md +171 -169
- package/dist/cli.js +13 -13
- package/dist/index.js +2 -2
- package/package.json +7 -3
- package/scripts/tag.js +120 -0
- package/scripts/uninstall.js +332 -332
- package/scripts/version.js +52 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const ROOT_DIR = join(__dirname, '..');
|
|
9
|
+
|
|
10
|
+
const SEMVER_REGEX = /^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/;
|
|
11
|
+
|
|
12
|
+
const FILES = [
|
|
13
|
+
{
|
|
14
|
+
path: join(ROOT_DIR, 'package.json'),
|
|
15
|
+
update: (content, version) => {
|
|
16
|
+
const pkg = JSON.parse(content);
|
|
17
|
+
pkg.version = version;
|
|
18
|
+
return JSON.stringify(pkg, null, 2) + '\n';
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
path: join(ROOT_DIR, 'src', 'constants.ts'),
|
|
23
|
+
update: (content, version) =>
|
|
24
|
+
content.replace(/export const VERSION = '[^']+';/, `export const VERSION = '${version}';`),
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
function main() {
|
|
29
|
+
const version = process.argv[2];
|
|
30
|
+
|
|
31
|
+
if (!version) {
|
|
32
|
+
console.error('Usage: node scripts/version.js <version>');
|
|
33
|
+
console.error('Example: node scripts/version.js 1.0.0');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!SEMVER_REGEX.test(version)) {
|
|
38
|
+
console.error(`Invalid semver version: ${version}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
for (const file of FILES) {
|
|
43
|
+
const content = readFileSync(file.path, 'utf8');
|
|
44
|
+
const updated = file.update(content, version);
|
|
45
|
+
writeFileSync(file.path, updated);
|
|
46
|
+
console.log(`Updated ${file.path}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(`Version updated to ${version}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main();
|