@srcroot/ui 0.0.8 → 0.0.11
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/dist/index.js +16 -39
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -363,8 +363,8 @@ async function init(options) {
|
|
|
363
363
|
console.log(chalk.red("Error: No package.json found. Please run this in a project directory."));
|
|
364
364
|
process.exit(1);
|
|
365
365
|
}
|
|
366
|
-
const srcDir = path.join(cwd, "src");
|
|
367
|
-
const appDir = path.join(
|
|
366
|
+
const srcDir = fs.existsSync(path.join(cwd, "src")) ? path.join(cwd, "src") : cwd;
|
|
367
|
+
const appDir = path.join(srcDir, "app");
|
|
368
368
|
const isAppRouter = fs.existsSync(appDir);
|
|
369
369
|
const libDir = path.join(srcDir, "lib");
|
|
370
370
|
const componentsDir = path.join(srcDir, "components", "ui");
|
|
@@ -387,59 +387,36 @@ async function init(options) {
|
|
|
387
387
|
selectedTheme = themeResponse.theme;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
if (!options.yes) {
|
|
391
|
-
const response = await prompts([
|
|
392
|
-
{
|
|
393
|
-
type: "confirm",
|
|
394
|
-
name: "proceed",
|
|
395
|
-
message: `This will create files in ${chalk.cyan(cwd)} with ${chalk.cyan(THEMES[selectedTheme].name)} theme. Continue?`,
|
|
396
|
-
initial: true
|
|
397
|
-
}
|
|
398
|
-
]);
|
|
399
|
-
if (!response.proceed) {
|
|
400
|
-
console.log(chalk.yellow("Cancelled."));
|
|
401
|
-
process.exit(0);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
390
|
const spinner = ora("Creating project structure...").start();
|
|
405
391
|
try {
|
|
406
392
|
await fs.ensureDir(libDir);
|
|
407
393
|
await fs.ensureDir(componentsDir);
|
|
408
394
|
const utilsPath = path.join(libDir, "utils.ts");
|
|
409
395
|
await fs.writeFile(utilsPath, UTILS_CONTENT);
|
|
410
|
-
spinner.succeed(`Created ${chalk.cyan(
|
|
396
|
+
spinner.succeed(`Created ${chalk.cyan(path.relative(cwd, utilsPath))}`);
|
|
411
397
|
spinner.start(`Setting up ${chalk.cyan(THEMES[selectedTheme].name)} theme...`);
|
|
412
398
|
const stylesDir = path.dirname(globalsPath);
|
|
413
399
|
await fs.ensureDir(stylesDir);
|
|
414
400
|
const cssContent = generateCssVariables(selectedTheme);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if (!existingCss.includes("--background:")) {
|
|
418
|
-
await fs.writeFile(globalsPath, cssContent + "\n" + existingCss);
|
|
419
|
-
spinner.succeed(`Updated ${chalk.cyan(path.relative(cwd, globalsPath))} with ${chalk.cyan(THEMES[selectedTheme].name)} theme`);
|
|
420
|
-
} else {
|
|
421
|
-
spinner.info(`CSS variables already exist in ${chalk.cyan(path.relative(cwd, globalsPath))}`);
|
|
422
|
-
}
|
|
423
|
-
} else {
|
|
424
|
-
await fs.writeFile(globalsPath, cssContent);
|
|
425
|
-
spinner.succeed(`Created ${chalk.cyan(path.relative(cwd, globalsPath))} with ${chalk.cyan(THEMES[selectedTheme].name)} theme`);
|
|
426
|
-
}
|
|
401
|
+
await fs.writeFile(globalsPath, cssContent);
|
|
402
|
+
spinner.succeed(`Updated ${chalk.cyan(path.relative(cwd, globalsPath))} with ${chalk.cyan(THEMES[selectedTheme].name)} theme`);
|
|
427
403
|
spinner.start("Setting up Tailwind config...");
|
|
428
404
|
const tailwindConfigPath = path.join(cwd, "tailwind.config.ts");
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
spinner.succeed(`Created ${chalk.cyan("tailwind.config.ts")}`);
|
|
432
|
-
} else {
|
|
433
|
-
spinner.info(`${chalk.cyan("tailwind.config.ts")} already exists, skipping`);
|
|
434
|
-
}
|
|
405
|
+
await fs.writeFile(tailwindConfigPath, TAILWIND_CONFIG);
|
|
406
|
+
spinner.succeed(`Created ${chalk.cyan("tailwind.config.ts")}`);
|
|
435
407
|
spinner.start("Checking dependencies...");
|
|
436
408
|
const pkg = await fs.readJson(packageJsonPath);
|
|
437
409
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
438
410
|
const missing = [];
|
|
439
|
-
const requiredDeps =
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
411
|
+
const requiredDeps = {
|
|
412
|
+
"clsx": "clsx@2.1.1",
|
|
413
|
+
"tailwind-merge": "tailwind-merge@3.4.0",
|
|
414
|
+
"class-variance-authority": "class-variance-authority@0.7.1",
|
|
415
|
+
"lucide-react": "lucide-react@0.561.0"
|
|
416
|
+
};
|
|
417
|
+
for (const [depName, installCmd] of Object.entries(requiredDeps)) {
|
|
418
|
+
if (!deps[depName]) {
|
|
419
|
+
missing.push(installCmd);
|
|
443
420
|
}
|
|
444
421
|
}
|
|
445
422
|
if (missing.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srcroot/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
41
41
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
42
|
-
"lucide-react": "^0.
|
|
42
|
+
"lucide-react": "^0.561.0",
|
|
43
43
|
"cmdk": "^1.0.0",
|
|
44
|
-
"class-variance-authority": "^0.7.
|
|
45
|
-
"clsx": "^2.
|
|
46
|
-
"tailwind-merge": "^
|
|
44
|
+
"class-variance-authority": "^0.7.1",
|
|
45
|
+
"clsx": "^2.1.1",
|
|
46
|
+
"tailwind-merge": "^3.4.0",
|
|
47
47
|
"tailwindcss": "^3.0.0 || ^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|