basuicn 0.3.0 → 0.3.2
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 +220 -220
- package/README_CLI.md +46 -46
- package/dist/assets/index-1YAQdTE0.css +2 -0
- package/dist/assets/index-BsQ6nn74.js +237 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.html +13 -0
- package/dist/ui-cli.cjs +3 -2
- package/dist/ui-cli.js +124 -0
- package/package.json +1 -1
- package/registry.json +27 -31
- package/scripts/build-registry.ts +261 -261
- package/scripts/bump-version.mjs +22 -22
- package/scripts/generate-theme-css.ts +74 -74
- package/scripts/set-version.mjs +31 -31
- package/scripts/ui-cli.ts +3 -2
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Syncs the default theme CSS variables from themes.ts → src/styles/index.css.
|
|
3
|
-
* Run via: npm run theme:sync
|
|
4
|
-
*
|
|
5
|
-
* Replaces the content between:
|
|
6
|
-
* /* GENERATED:theme-start *\/
|
|
7
|
-
* /* GENERATED:theme-end *\/
|
|
8
|
-
* in index.css with fresh values from themes[0].
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import fs from 'fs';
|
|
12
|
-
import path from 'path';
|
|
13
|
-
import { themes } from '../src/lib/theme/themes';
|
|
14
|
-
|
|
15
|
-
const CSS_PATH = path.resolve('src/styles/index.css');
|
|
16
|
-
const START_MARKER = '/* GENERATED:theme-start */';
|
|
17
|
-
const END_MARKER = '/* GENERATED:theme-end */';
|
|
18
|
-
|
|
19
|
-
const INDENT = ' '; // 8 spaces — matches :root { } indentation in index.css
|
|
20
|
-
|
|
21
|
-
const { colors: c } = themes[0];
|
|
22
|
-
const vars: [string, string][] = [
|
|
23
|
-
['--background', c.background],
|
|
24
|
-
['--foreground', c.foreground],
|
|
25
|
-
['--primary', c.primary],
|
|
26
|
-
['--primary-foreground', c.primaryForeground],
|
|
27
|
-
['--secondary', c.secondary],
|
|
28
|
-
['--secondary-foreground', c.secondaryForeground],
|
|
29
|
-
['--muted', c.muted],
|
|
30
|
-
['--muted-foreground', c.mutedForeground],
|
|
31
|
-
['--accent', c.accent],
|
|
32
|
-
['--accent-foreground', c.accentForeground],
|
|
33
|
-
['--success', c.success],
|
|
34
|
-
['--success-foreground', c.successForeground],
|
|
35
|
-
['--warning', c.warning],
|
|
36
|
-
['--warning-foreground', c.warningForeground],
|
|
37
|
-
['--danger', c.danger],
|
|
38
|
-
['--danger-foreground', c.dangerForeground],
|
|
39
|
-
['--destructive', c.danger],
|
|
40
|
-
['--destructive-foreground', c.dangerForeground],
|
|
41
|
-
['--border', c.border],
|
|
42
|
-
['--input', c.input],
|
|
43
|
-
['--ring', c.ring],
|
|
44
|
-
['--popover', c.popover],
|
|
45
|
-
['--popover-foreground', c.popoverForeground],
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
const generated = [
|
|
49
|
-
START_MARKER,
|
|
50
|
-
`${INDENT}/* Auto-generated from themes.ts — run \`npm run theme:sync\` to update */`,
|
|
51
|
-
...vars.map(([k, v]) => `${INDENT}${k}: ${v};`),
|
|
52
|
-
`${INDENT}${END_MARKER}`,
|
|
53
|
-
].join('\n');
|
|
54
|
-
|
|
55
|
-
const css = fs.readFileSync(CSS_PATH, 'utf-8');
|
|
56
|
-
|
|
57
|
-
const startIdx = css.indexOf(START_MARKER);
|
|
58
|
-
const endIdx = css.indexOf(END_MARKER);
|
|
59
|
-
|
|
60
|
-
if (startIdx === -1 || endIdx === -1) {
|
|
61
|
-
console.error(
|
|
62
|
-
`[theme:sync] Markers not found in ${CSS_PATH}.\n` +
|
|
63
|
-
`Add these two comments inside @layer base :root { }:\n\n` +
|
|
64
|
-
` ${START_MARKER}\n ${END_MARKER}\n`
|
|
65
|
-
);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const before = css.slice(0, startIdx);
|
|
70
|
-
const after = css.slice(endIdx + END_MARKER.length);
|
|
71
|
-
const result = before + generated + after;
|
|
72
|
-
|
|
73
|
-
fs.writeFileSync(CSS_PATH, result, 'utf-8');
|
|
74
|
-
console.log(`[theme:sync] Synced default theme "${themes[0].name}" → ${CSS_PATH}`);
|
|
1
|
+
/**
|
|
2
|
+
* Syncs the default theme CSS variables from themes.ts → src/styles/index.css.
|
|
3
|
+
* Run via: npm run theme:sync
|
|
4
|
+
*
|
|
5
|
+
* Replaces the content between:
|
|
6
|
+
* /* GENERATED:theme-start *\/
|
|
7
|
+
* /* GENERATED:theme-end *\/
|
|
8
|
+
* in index.css with fresh values from themes[0].
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { themes } from '../src/lib/theme/themes';
|
|
14
|
+
|
|
15
|
+
const CSS_PATH = path.resolve('src/styles/index.css');
|
|
16
|
+
const START_MARKER = '/* GENERATED:theme-start */';
|
|
17
|
+
const END_MARKER = '/* GENERATED:theme-end */';
|
|
18
|
+
|
|
19
|
+
const INDENT = ' '; // 8 spaces — matches :root { } indentation in index.css
|
|
20
|
+
|
|
21
|
+
const { colors: c } = themes[0];
|
|
22
|
+
const vars: [string, string][] = [
|
|
23
|
+
['--background', c.background],
|
|
24
|
+
['--foreground', c.foreground],
|
|
25
|
+
['--primary', c.primary],
|
|
26
|
+
['--primary-foreground', c.primaryForeground],
|
|
27
|
+
['--secondary', c.secondary],
|
|
28
|
+
['--secondary-foreground', c.secondaryForeground],
|
|
29
|
+
['--muted', c.muted],
|
|
30
|
+
['--muted-foreground', c.mutedForeground],
|
|
31
|
+
['--accent', c.accent],
|
|
32
|
+
['--accent-foreground', c.accentForeground],
|
|
33
|
+
['--success', c.success],
|
|
34
|
+
['--success-foreground', c.successForeground],
|
|
35
|
+
['--warning', c.warning],
|
|
36
|
+
['--warning-foreground', c.warningForeground],
|
|
37
|
+
['--danger', c.danger],
|
|
38
|
+
['--danger-foreground', c.dangerForeground],
|
|
39
|
+
['--destructive', c.danger],
|
|
40
|
+
['--destructive-foreground', c.dangerForeground],
|
|
41
|
+
['--border', c.border],
|
|
42
|
+
['--input', c.input],
|
|
43
|
+
['--ring', c.ring],
|
|
44
|
+
['--popover', c.popover],
|
|
45
|
+
['--popover-foreground', c.popoverForeground],
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const generated = [
|
|
49
|
+
START_MARKER,
|
|
50
|
+
`${INDENT}/* Auto-generated from themes.ts — run \`npm run theme:sync\` to update */`,
|
|
51
|
+
...vars.map(([k, v]) => `${INDENT}${k}: ${v};`),
|
|
52
|
+
`${INDENT}${END_MARKER}`,
|
|
53
|
+
].join('\n');
|
|
54
|
+
|
|
55
|
+
const css = fs.readFileSync(CSS_PATH, 'utf-8');
|
|
56
|
+
|
|
57
|
+
const startIdx = css.indexOf(START_MARKER);
|
|
58
|
+
const endIdx = css.indexOf(END_MARKER);
|
|
59
|
+
|
|
60
|
+
if (startIdx === -1 || endIdx === -1) {
|
|
61
|
+
console.error(
|
|
62
|
+
`[theme:sync] Markers not found in ${CSS_PATH}.\n` +
|
|
63
|
+
`Add these two comments inside @layer base :root { }:\n\n` +
|
|
64
|
+
` ${START_MARKER}\n ${END_MARKER}\n`
|
|
65
|
+
);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const before = css.slice(0, startIdx);
|
|
70
|
+
const after = css.slice(endIdx + END_MARKER.length);
|
|
71
|
+
const result = before + generated + after;
|
|
72
|
+
|
|
73
|
+
fs.writeFileSync(CSS_PATH, result, 'utf-8');
|
|
74
|
+
console.log(`[theme:sync] Synced default theme "${themes[0].name}" → ${CSS_PATH}`);
|
package/scripts/set-version.mjs
CHANGED
|
@@ -1,31 +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}`);
|
|
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.3.
|
|
9
|
+
const VERSION = '0.3.2';
|
|
10
10
|
const REGISTRY_LOCAL = './registry.json';
|
|
11
11
|
const REGISTRY_REMOTE = 'https://raw.githubusercontent.com/Basuicn/basuicn-core/main/registry.json';
|
|
12
12
|
|
|
@@ -1093,9 +1093,10 @@ const main = async () => {
|
|
|
1093
1093
|
console.log(` Run ${c.cyan}npx basuicn update --help${c.reset} for details.`);
|
|
1094
1094
|
return;
|
|
1095
1095
|
}
|
|
1096
|
+
const updateFramework = detectFramework(cwd);
|
|
1096
1097
|
for (const name of componentNames) {
|
|
1097
1098
|
log(`Updating: ${c.bold}${name}${c.reset}...`);
|
|
1098
|
-
addComponent(name, registry, cwd, { force: true });
|
|
1099
|
+
addComponent(name, registry, cwd, { force: true, framework: updateFramework });
|
|
1099
1100
|
}
|
|
1100
1101
|
console.log('');
|
|
1101
1102
|
ok(`${c.bold}Update complete.${c.reset}`);
|