@srcroot/ui 0.0.20 → 0.0.21

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -511,12 +511,35 @@ async function init(options) {
511
511
  const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
512
512
  const tailwindVersion = allDeps["tailwindcss"] || "";
513
513
  const isTailwind4 = tailwindVersion.includes("^4") || tailwindVersion.startsWith("4") || allDeps["@tailwindcss/postcss"];
514
- const srcDir = fs.existsSync(path.join(cwd, "src")) ? path.join(cwd, "src") : cwd;
515
- const appDir = path.join(srcDir, "app");
516
- const isAppRouter = fs.existsSync(appDir);
517
- const libDir = path.join(srcDir, "lib");
518
- const componentsDir = path.join(srcDir, "components", "ui");
519
- const globalsPath = isAppRouter ? path.join(appDir, "globals.css") : path.join(srcDir, "styles", "globals.css");
514
+ const hasSrc = fs.existsSync(path.join(cwd, "src"));
515
+ const srcPath = hasSrc ? path.join(cwd, "src") : cwd;
516
+ const appPath = path.join(srcPath, "app");
517
+ const pagesPath = path.join(srcPath, "pages");
518
+ const hasAppDir = fs.existsSync(appPath);
519
+ const hasPagesDir = fs.existsSync(pagesPath);
520
+ const libDir = path.join(srcPath, "lib");
521
+ const componentsDir = path.join(srcPath, "components", "ui");
522
+ let globalsPath = "";
523
+ if (hasAppDir) {
524
+ if (fs.existsSync(path.join(appPath, "globals.css"))) {
525
+ globalsPath = path.join(appPath, "globals.css");
526
+ } else if (fs.existsSync(path.join(appPath, "global.css"))) {
527
+ globalsPath = path.join(appPath, "global.css");
528
+ } else {
529
+ globalsPath = path.join(appPath, "globals.css");
530
+ }
531
+ } else if (hasPagesDir) {
532
+ const stylesPath = path.join(srcPath, "styles");
533
+ if (fs.existsSync(path.join(stylesPath, "globals.css"))) {
534
+ globalsPath = path.join(stylesPath, "globals.css");
535
+ } else if (fs.existsSync(path.join(stylesPath, "global.css"))) {
536
+ globalsPath = path.join(stylesPath, "global.css");
537
+ } else {
538
+ globalsPath = path.join(stylesPath, "globals.css");
539
+ }
540
+ } else {
541
+ globalsPath = path.join(srcPath, "globals.css");
542
+ }
520
543
  let selectedTheme = options.theme || "slate";
521
544
  if (!options.yes && !options.theme) {
522
545
  const themeChoices = Object.entries(THEMES).map(([key, theme]) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srcroot/ui",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
5
5
  "type": "module",
6
6
  "bin": {