cus-base-ui 0.2.4 → 0.2.6

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 CHANGED
@@ -26,6 +26,7 @@ Lệnh này tự động thực hiện:
26
26
  | Bước | Nội dung |
27
27
  |------|----------|
28
28
  | Cài dev packages | `tailwindcss`, `@tailwindcss/vite`, `@vitejs/plugin-react`, `vite-plugin-babel`, `babel-plugin-react-compiler`, `@types/node` |
29
+ | Cài runtime packages | `@base-ui/react`, `tailwind-variants`, `clsx`, `tailwind-merge`, `tailwindcss-animate` |
29
30
  | Tạo / cập nhật `vite.config.ts` | Thêm plugin Tailwind, React, React Compiler + alias `@`, `@lib`, `@components`, `@assets`, `@pages`, `@styles` |
30
31
  | Cập nhật `tsconfig.json` | Thêm `baseUrl` + `paths` tương ứng với alias trên |
31
32
  | Setup Tailwind CSS | Thêm `@import "tailwindcss";` vào `src/index.css` (tạo mới nếu chưa có) |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cus-base-ui",
3
3
  "private": false,
4
- "version": "0.2.4",
4
+ "version": "0.2.6",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "cus-base-ui": "./dist/ui-cli.cjs"
package/scripts/ui-cli.ts CHANGED
@@ -81,6 +81,9 @@ const installNpmPackages = (packages: string[], cwd: string, dev = false) => {
81
81
 
82
82
  const VITE_DEV_PACKAGES = ['tailwindcss', '@tailwindcss/vite', '@vitejs/plugin-react', 'vite-plugin-babel', 'babel-plugin-react-compiler', '@types/node'];
83
83
 
84
+ // Runtime packages always required — installed regardless of registry content
85
+ const RUNTIME_PACKAGES = ['@base-ui/react', 'tailwind-variants', 'clsx', 'tailwind-merge', 'tailwindcss-animate'];
86
+
84
87
  const VITE_CONFIG_TEMPLATE = `import { defineConfig } from 'vite';
85
88
  import tailwindcss from '@tailwindcss/vite';
86
89
  import react from '@vitejs/plugin-react';
@@ -356,6 +359,17 @@ const main = async () => {
356
359
  error('Usage: npx cus-base-ui add <component-name> [--force]');
357
360
  return;
358
361
  }
362
+
363
+ // Auto-init if not yet initialized
364
+ const cnPath = path.join(cwd, 'src/lib/utils/cn.ts');
365
+ if (!fs.existsSync(cnPath)) {
366
+ log('Project not initialized — running init first...');
367
+ setupViteConfig(cwd);
368
+ setupTsConfig(cwd);
369
+ ensureTailwindCss(cwd);
370
+ installNpmPackages(RUNTIME_PACKAGES, cwd);
371
+ }
372
+
359
373
  for (const name of componentNames) {
360
374
  addComponent(name, registry, cwd, { force: isForce });
361
375
  }
@@ -390,6 +404,7 @@ const main = async () => {
390
404
  setupViteConfig(cwd);
391
405
  setupTsConfig(cwd);
392
406
  ensureTailwindCss(cwd);
407
+ installNpmPackages(RUNTIME_PACKAGES, cwd);
393
408
  ensureCore(registry, cwd);
394
409
  log('Initialization complete.');
395
410
  break;