basuicn 0.2.7 → 0.2.9
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/README.md +171 -47
- package/README_CLI.md +29 -27
- package/dist/ui-cli.cjs +1 -1
- package/package.json +106 -104
- package/registry.json +118 -59
- package/scripts/bump-version.mjs +22 -0
- package/scripts/set-version.mjs +31 -0
- package/scripts/ui-cli.ts +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
|
|
4
|
+
// Skip if triggered by a version bump commit (avoid infinite loop)
|
|
5
|
+
const lastMsg = execSync('git log -1 --pretty=%s').toString().trim();
|
|
6
|
+
if (lastMsg.startsWith('chore: bump version')) process.exit(0);
|
|
7
|
+
|
|
8
|
+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
9
|
+
const [major, minor, patch] = pkg.version.split('.').map(Number);
|
|
10
|
+
const newVersion = `${major}.${minor}.${patch + 1}`;
|
|
11
|
+
|
|
12
|
+
pkg.version = newVersion;
|
|
13
|
+
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
14
|
+
|
|
15
|
+
let cli = fs.readFileSync('./scripts/ui-cli.ts', 'utf-8');
|
|
16
|
+
cli = cli.replace(/const VERSION = '[^']+';/, `const VERSION = '${newVersion}';`);
|
|
17
|
+
fs.writeFileSync('./scripts/ui-cli.ts', cli);
|
|
18
|
+
|
|
19
|
+
execSync('git add package.json scripts/ui-cli.ts');
|
|
20
|
+
execSync(`git commit --no-verify -m "chore: bump version to ${newVersion}"`);
|
|
21
|
+
|
|
22
|
+
console.log(`\x1b[32m✔\x1b[0m Bumped version → ${newVersion}`);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
const arg = process.argv[2];
|
|
4
|
+
if (!arg) {
|
|
5
|
+
console.error('Usage: node scripts/set-version.mjs <version|major|minor|patch>');
|
|
6
|
+
console.error(' Examples: node scripts/set-version.mjs 1.0.0');
|
|
7
|
+
console.error(' node scripts/set-version.mjs major');
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
12
|
+
const [major, minor, patch] = pkg.version.split('.').map(Number);
|
|
13
|
+
|
|
14
|
+
let newVersion;
|
|
15
|
+
if (arg === 'major') newVersion = `${major + 1}.0.0`;
|
|
16
|
+
else if (arg === 'minor') newVersion = `${major}.${minor + 1}.0`;
|
|
17
|
+
else if (arg === 'patch') newVersion = `${major}.${minor}.${patch + 1}`;
|
|
18
|
+
else if (/^\d+\.\d+\.\d+$/.test(arg)) newVersion = arg;
|
|
19
|
+
else {
|
|
20
|
+
console.error(`Invalid version: "${arg}"`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pkg.version = newVersion;
|
|
25
|
+
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
26
|
+
|
|
27
|
+
let cli = fs.readFileSync('./scripts/ui-cli.ts', 'utf-8');
|
|
28
|
+
cli = cli.replace(/const VERSION = '[^']+';/, `const VERSION = '${newVersion}';`);
|
|
29
|
+
fs.writeFileSync('./scripts/ui-cli.ts', cli);
|
|
30
|
+
|
|
31
|
+
console.log(`\x1b[32m✔\x1b[0m Version set → ${newVersion}`);
|
package/scripts/ui-cli.ts
CHANGED
|
@@ -6,7 +6,7 @@ import readline from 'readline';
|
|
|
6
6
|
|
|
7
7
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
8
8
|
|
|
9
|
-
const VERSION = '0.2.
|
|
9
|
+
const VERSION = '0.2.9';
|
|
10
10
|
const REGISTRY_LOCAL = './registry.json';
|
|
11
11
|
const REGISTRY_REMOTE = 'https://raw.githubusercontent.com/Basuicn/basuicn-core/main/registry.json';
|
|
12
12
|
|