@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.
- package/dist/index.js +29 -6
- 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
|
|
515
|
-
const
|
|
516
|
-
const
|
|
517
|
-
const
|
|
518
|
-
const
|
|
519
|
-
const
|
|
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]) => ({
|