starwind 1.7.3 → 1.8.0
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/{chunk-NN3HLNWX.js → chunk-HDAZQTOL.js} +8 -7
- package/dist/{chunk-NN3HLNWX.js.map → chunk-HDAZQTOL.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/init-NBNT5V74.js +7 -0
- package/package.json +2 -2
- package/dist/init-VWGSAZG5.js +0 -7
- /package/dist/{init-VWGSAZG5.js.map → init-NBNT5V74.js.map} +0 -0
|
@@ -294,12 +294,13 @@ var ASTRO_PACKAGES = {
|
|
|
294
294
|
core: "astro@latest"
|
|
295
295
|
};
|
|
296
296
|
var OTHER_PACKAGES = {
|
|
297
|
-
tailwindCore: "tailwindcss
|
|
298
|
-
tailwindVite: "@tailwindcss/vite
|
|
299
|
-
tailwindForms: "@tailwindcss/forms
|
|
300
|
-
tailwindAnimate: "tw-animate-css
|
|
301
|
-
tailwindVariants: "tailwind-variants
|
|
302
|
-
|
|
297
|
+
tailwindCore: "tailwindcss@^4",
|
|
298
|
+
tailwindVite: "@tailwindcss/vite@^4",
|
|
299
|
+
tailwindForms: "@tailwindcss/forms@^0.5",
|
|
300
|
+
tailwindAnimate: "tw-animate-css@^1",
|
|
301
|
+
tailwindVariants: "tailwind-variants@^2",
|
|
302
|
+
tailwindMerge: "tailwind-merge@^3",
|
|
303
|
+
tablerIcons: "@tabler/icons@^3"
|
|
303
304
|
};
|
|
304
305
|
function getOtherPackages() {
|
|
305
306
|
return Object.values(OTHER_PACKAGES);
|
|
@@ -664,4 +665,4 @@ export {
|
|
|
664
665
|
sleep,
|
|
665
666
|
init
|
|
666
667
|
};
|
|
667
|
-
//# sourceMappingURL=chunk-
|
|
668
|
+
//# sourceMappingURL=chunk-HDAZQTOL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/init.ts","../src/templates/starwind.css.ts","../src/utils/astro-config.ts","../src/utils/fs.ts","../src/utils/highlighter.ts","../src/utils/constants.ts","../src/utils/config.ts","../src/utils/package-manager.ts","../src/utils/sleep.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport * as p from \"@clack/prompts\";\nimport semver from \"semver\";\n\nimport { tailwindConfig } from \"@/templates/starwind.css.js\";\nimport { setupAstroConfig } from \"@/utils/astro-config.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport { ASTRO_PACKAGES, getOtherPackages, MIN_ASTRO_VERSION, PATHS } from \"@/utils/constants.js\";\nimport { ensureDirectory, fileExists, readJsonFile, writeCssFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport {\n getDefaultPackageManager,\n installDependencies,\n requestPackageManager,\n} from \"@/utils/package-manager.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\nexport async function init(withinAdd: boolean = false, options?: { defaults?: boolean }) {\n if (!withinAdd) {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n }\n\n try {\n // Validate project structure\n if (!(await fileExists(\"package.json\"))) {\n throw new Error(\n \"No package.json found. Please run this command in the root of your project.\",\n );\n }\n\n const pkg = await readJsonFile(\"package.json\");\n\n // Check Astro version compatibility\n const installTasks = [];\n const configTasks = [];\n\n // ================================================================\n // Prepare project structure and configuration tasks\n // ================================================================\n let configChoices;\n\n // Use defaults if specified, otherwise prompt user for choices\n if (options?.defaults) {\n configChoices = {\n installLocation: PATHS.LOCAL_COMPONENTS_DIR,\n cssFile: PATHS.LOCAL_CSS_FILE,\n twBaseColor: \"neutral\",\n };\n\n if (!withinAdd) {\n p.log.info(\"Using default configuration values\");\n }\n } else {\n configChoices = await p.group(\n {\n // ask where to install components\n installLocation: () =>\n p.text({\n message: \"What is your components directory?\",\n placeholder: PATHS.LOCAL_COMPONENTS_DIR,\n initialValue: PATHS.LOCAL_COMPONENTS_DIR,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot install in system directories`;\n }\n },\n }),\n // ask where to add the css file\n cssFile: () =>\n p.text({\n message: `Where would you like to add the Tailwind ${highlighter.info(\".css\")} file?`,\n placeholder: PATHS.LOCAL_CSS_FILE,\n initialValue: PATHS.LOCAL_CSS_FILE,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Must end with .css\n if (!value.endsWith(\".css\")) return `File must end with .css extension`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot use system directories`;\n }\n\n // Ensure the path has a valid filename\n const basename = path.basename(value, \".css\");\n if (!basename || basename.trim().length === 0) {\n return `Invalid filename`;\n }\n },\n }),\n\n twBaseColor: () =>\n p.select({\n message: \"What Tailwind base color would you like to use?\",\n initialValue: \"neutral\",\n options: [\n { label: \"Neutral (default)\", value: \"neutral\" },\n { label: \"Stone\", value: \"stone\" },\n { label: \"Zinc\", value: \"zinc\" },\n { label: \"Gray\", value: \"gray\" },\n { label: \"Slate\", value: \"slate\" },\n ],\n }),\n },\n {\n // On Cancel callback that wraps the group\n // So if the user cancels one of the prompts in the group this function will be called\n onCancel: () => {\n p.cancel(\"Operation cancelled.\");\n process.exit(0);\n },\n },\n );\n }\n\n // ================================================================\n // Make sure appropriate directories exist\n // ================================================================\n const cssFileDir = path.dirname(configChoices.cssFile);\n const componentInstallDir = path.join(configChoices.installLocation, \"starwind\");\n configTasks.push({\n title: \"Creating project structure\",\n task: async () => {\n await ensureDirectory(componentInstallDir);\n await ensureDirectory(cssFileDir);\n await sleep(250);\n return \"Created project structure\";\n },\n });\n\n // ================================================================\n // Prepare Astro config file setup\n // ================================================================\n configTasks.push({\n title: \"Setup Astro config file\",\n task: async () => {\n const success = await setupAstroConfig();\n if (!success) {\n throw new Error(\"Failed to setup Astro config\");\n }\n await sleep(250);\n return \"Astro config setup completed\";\n },\n });\n\n // ================================================================\n // Prepare CSS file\n // ================================================================\n // Check if CSS file already exists\n const cssFileExists = await fileExists(configChoices.cssFile);\n let updatedTailwindConfig = tailwindConfig;\n\n if (configChoices.twBaseColor !== \"neutral\") {\n // replace all \"--color-neutral\" with \"--color-twBaseColor\"\n updatedTailwindConfig = updatedTailwindConfig.replace(\n /--color-neutral-/g,\n `--color-${configChoices.twBaseColor}-`,\n );\n }\n\n if (cssFileExists) {\n const shouldOverride = options?.defaults\n ? true\n : await p.confirm({\n message: `${highlighter.info(configChoices.cssFile)} already exists. Do you want to override it?`,\n });\n\n if (p.isCancel(shouldOverride)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldOverride) {\n p.log.info(\"Skipping Tailwind CSS configuration\");\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n\n // ================================================================\n // Prepare project starwind configuration\n // ================================================================\n configTasks.push({\n title: \"Updating project configuration\",\n task: async () => {\n await updateConfig({\n tailwind: {\n css: configChoices.cssFile,\n baseColor: configChoices.twBaseColor as \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: configChoices.installLocation,\n components: [],\n });\n await sleep(250);\n return \"Updated project starwind configuration\";\n },\n });\n\n // ================================================================\n // Prepare astro installation\n // ================================================================\n // Request package manager\n const pm = options?.defaults ? await getDefaultPackageManager() : await requestPackageManager();\n\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n if (!semver.gte(astroVersion, MIN_ASTRO_VERSION)) {\n const shouldUpgrade = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to upgrade from v${astroVersion}?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldUpgrade)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldUpgrade) {\n p.cancel(\"Astro v5 or higher is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: \"Upgrading Astro\",\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return \"Upgraded Astro successfully\";\n },\n });\n }\n } else {\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to install it?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldInstall) {\n p.cancel(\"Astro is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: `Installing ${ASTRO_PACKAGES.core}`,\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return `Installed ${highlighter.info(ASTRO_PACKAGES.core)} successfully`;\n },\n });\n }\n\n // ================================================================\n // Prepare tailwind and other package installation\n // ================================================================\n const otherPackages = getOtherPackages();\n\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Install ${highlighter.info(otherPackages.join(\", \"))} using ${highlighter.info(pm)}?`,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (shouldInstall) {\n installTasks.push({\n title: `Installing packages`,\n task: async () => {\n await installDependencies(getOtherPackages(), pm, false, false);\n return `${highlighter.info(\"Packages installed successfully\")}`;\n },\n });\n } else {\n p.log.warn(\n highlighter.warn(`Skipped installation of packages. Make sure to install them manually`),\n );\n }\n\n // ================================================================\n // Execute all tasks\n // ================================================================\n if (installTasks.length > 0) {\n await p.tasks(installTasks);\n }\n\n if (configTasks.length > 0) {\n await p.tasks(configTasks);\n }\n\n await sleep(250);\n\n p.note(\n `Make sure your layout imports the ${highlighter.infoBright(configChoices.cssFile)} file`,\n \"Next steps\",\n );\n\n if (!withinAdd) {\n sleep(1000);\n p.outro(\"Enjoy using Starwind UI 🚀\");\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","export const tailwindConfig = `@import \"tailwindcss\";\n@import \"tw-animate-css\";\n@plugin \"@tailwindcss/forms\";\n@variant dark (&:where(.dark, .dark *));\n\n@theme {\n\t--animate-accordion-down: accordion-down 0.2s ease-out;\n\t--animate-accordion-up: accordion-up 0.2s ease-out;\n\n\t@keyframes accordion-down {\n\t\tfrom {\n\t\t\theight: 0;\n\t\t}\n\t\tto {\n\t\t\theight: var(--starwind-accordion-content-height);\n\t\t}\n\t}\n\n\t@keyframes accordion-up {\n\t\tfrom {\n\t\t\theight: var(--starwind-accordion-content-height);\n\t\t}\n\t\tto {\n\t\t\theight: 0;\n\t\t}\n\t}\n}\n\n@theme inline {\n\t--color-background: var(--background);\n\t--color-foreground: var(--foreground);\n\t--color-card: var(--card);\n\t--color-card-foreground: var(--card-foreground);\n\t--color-popover: var(--popover);\n\t--color-popover-foreground: var(--popover-foreground);\n\t--color-primary: var(--primary);\n\t--color-primary-foreground: var(--primary-foreground);\n\t--color-secondary: var(--secondary);\n\t--color-secondary-foreground: var(--secondary-foreground);\n\t--color-muted: var(--muted);\n\t--color-muted-foreground: var(--muted-foreground);\n\t--color-accent: var(--accent);\n\t--color-accent-foreground: var(--accent-foreground);\n\t--color-info: var(--info);\n\t--color-info-foreground: var(--info-foreground);\n\t--color-success: var(--success);\n\t--color-success-foreground: var(--success-foreground);\n\t--color-warning: var(--warning);\n\t--color-warning-foreground: var(--warning-foreground);\n\t--color-error: var(--error);\n\t--color-error-foreground: var(--error-foreground);\n\t--color-border: var(--border);\n\t--color-input: var(--input);\n\t--color-outline: var(--outline);\n\n\t--radius-xs: calc(var(--radius) - 0.375rem);\n\t--radius-sm: calc(var(--radius) - 0.25rem);\n\t--radius-md: calc(var(--radius) - 0.125rem);\n\t--radius-lg: var(--radius);\n\t--radius-xl: calc(var(--radius) + 0.25rem);\n\t--radius-2xl: calc(var(--radius) + 0.5rem);\n\t--radius-3xl: calc(var(--radius) + 1rem);\n}\n\n@layer base {\n\t:root {\n\t\t--background: var(--color-neutral-50);\n\t\t--foreground: var(--color-neutral-950);\n\t\t--card: var(--color-neutral-50);\n\t\t--card-foreground: var(--color-neutral-950);\n\t\t--popover: var(--color-neutral-50);\n\t\t--popover-foreground: var(--color-neutral-950);\n\t\t--primary: var(--color-blue-700);\n\t\t--primary-foreground: var(--color-neutral-50);\n\t\t--secondary: var(--color-fuchsia-700);\n\t\t--secondary-foreground: var(--color-neutral-50);\n\t\t--muted: var(--color-neutral-100);\n\t\t--muted-foreground: var(--color-neutral-600);\n\t\t--accent: var(--color-neutral-200);\n\t\t--accent-foreground: var(--color-neutral-900);\n\t\t--info: var(--color-sky-300);\n\t\t--info-foreground: var(--color-sky-950);\n\t\t--success: var(--color-green-300);\n\t\t--success-foreground: var(--color-green-950);\n\t\t--warning: var(--color-amber-300);\n\t\t--warning-foreground: var(--color-amber-950);\n\t\t--error: var(--color-red-700);\n\t\t--error-foreground: var(--color-neutral-50);\n\t\t--border: var(--color-neutral-200);\n\t\t--input: var(--color-neutral-200);\n\t\t--outline: var(--color-blue-600);\n\t\t--radius: 0.5rem;\n\t}\n\n\t.dark {\n\t\t--background: var(--color-neutral-950);\n\t\t--foreground: var(--color-neutral-50);\n\t\t--card: var(--color-neutral-950);\n\t\t--card-foreground: var(--color-neutral-50);\n\t\t--popover: var(--color-neutral-950);\n\t\t--popover-foreground: var(--color-neutral-50);\n\t\t--primary: var(--color-blue-700);\n\t\t--primary-foreground: var(--color-neutral-50);\n\t\t--secondary: var(--color-fuchsia-300);\n\t\t--secondary-foreground: var(--color-neutral-950);\n\t\t--muted: var(--color-neutral-900);\n\t\t--muted-foreground: var(--color-neutral-400);\n\t\t--accent: var(--color-neutral-900);\n\t\t--accent-foreground: var(--color-neutral-100);\n\t\t--info: var(--color-sky-300);\n\t\t--info-foreground: var(--color-sky-950);\n\t\t--success: var(--color-green-300);\n\t\t--success-foreground: var(--color-green-950);\n\t\t--warning: var(--color-amber-300);\n\t\t--warning-foreground: var(--color-amber-950);\n\t\t--error: var(--color-red-800);\n\t\t--error-foreground: var(--color-neutral-50);\n\t\t--border: var(--color-neutral-800);\n\t\t--input: var(--color-neutral-800);\n\t\t--outline: var(--color-blue-600);\n\t\t--radius: 0.5rem;\n\t}\n\n\t* {\n\t\t@apply border-border;\n\t}\n\t*:focus-visible {\n\t\t@apply outline-outline;\n\t}\n\thtml {\n\t\t@apply bg-background text-foreground scheme-light dark:scheme-dark;\n\t}\n\tbutton {\n\t\t@apply cursor-pointer;\n\t}\n}\n\n@layer utilities {\n\t/* transition-colors but without outline-color transition property */\n\t.starwind-transition-colors {\n\t\ttransition-property: color, background-color, border-color, text-decoration-color, fill, stroke,\n\t\t\t--tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n\t\ttransition-timing-function: var(--default-transition-timing-function);\n\t\ttransition-duration: var(--default-transition-duration);\n\t}\n}\n`;\n","import * as p from \"@clack/prompts\";\nimport fs from \"fs-extra\";\nimport semver from \"semver\";\n\nimport { readJsonFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\n\nimport { fileExists } from \"./fs.js\";\n\nconst CONFIG_EXTENSIONS = [\"ts\", \"js\", \"mjs\", \"cjs\"] as const;\n// type ConfigExtension = (typeof CONFIG_EXTENSIONS)[number];\n\n/**\n * Finds the Astro config file in the current directory\n * @returns The path to the config file if found, null otherwise\n */\nasync function findAstroConfig(): Promise<string | null> {\n for (const ext of CONFIG_EXTENSIONS) {\n const configPath = `astro.config.${ext}`;\n if (await fileExists(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\n/**\n * Gets the installed Astro version from the project's package.json\n * @returns The installed Astro version or null if not found\n */\nasync function getAstroVersion(): Promise<string | null> {\n try {\n const pkg = await readJsonFile(\"package.json\");\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n return astroVersion;\n }\n\n p.log.error(\n highlighter.error(\n \"Astro seems not installed in your project, please check your package.json\",\n ),\n );\n return null;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to check Astro version: ${errorMessage}`));\n return null;\n }\n}\n\n/**\n * Updates or creates the Astro configuration file\n * @returns true if successful, false otherwise\n */\nexport async function setupAstroConfig(): Promise<boolean> {\n try {\n let configPath = await findAstroConfig();\n let content = \"\";\n\n if (configPath) {\n content = await fs.readFile(configPath, \"utf-8\");\n } else {\n configPath = \"astro.config.ts\";\n content = `import { defineConfig } from \"astro/config\";\\n\\nexport default defineConfig({});\\n`;\n }\n\n // Add tailwindcss import if not present\n if (!content.includes('import tailwindcss from \"@tailwindcss/vite\"')) {\n content = `import tailwindcss from \"@tailwindcss/vite\";\\n${content}`;\n }\n\n // Parse the configuration object\n const configStart = content.indexOf(\"defineConfig(\") + \"defineConfig(\".length;\n const configEnd = content.lastIndexOf(\");\");\n let config = content.slice(configStart, configEnd);\n\n // Remove outer braces and trim\n config = config.trim().replace(/^{|}$/g, \"\").trim();\n\n const astroVersion = await getAstroVersion();\n\n if (astroVersion && semver.lt(astroVersion, \"5.7.0\")) {\n // Add experimental configuration\n if (!config.includes(\"experimental\")) {\n config += `\\n\\texperimental: {\n\t\tsvg: true,\n\t},`;\n } else if (!config.includes(\"svg: true\") && !config.includes(\"svg: {\")) {\n // Insert svg config into existing experimental block\n const expEnd = config.indexOf(\"experimental:\") + \"experimental:\".length;\n const blockStart = config.indexOf(\"{\", expEnd) + 1;\n config = config.slice(0, blockStart) + `\\n\\t\\tsvg: true,` + config.slice(blockStart);\n }\n }\n\n // Add vite configuration\n if (!config.includes(\"vite:\")) {\n config += `\\n\\tvite: {\n\t\tplugins: [tailwindcss()],\n\t},`;\n } else if (!config.includes(\"plugins: [\")) {\n // Insert plugins into existing vite block\n const viteEnd = config.indexOf(\"vite:\") + \"vite:\".length;\n const blockStart = config.indexOf(\"{\", viteEnd) + 1;\n config =\n config.slice(0, blockStart) + `\\n\\t\\tplugins: [tailwindcss()],` + config.slice(blockStart);\n } else if (!config.includes(\"tailwindcss()\")) {\n // Add tailwindcss to existing plugins array\n const pluginsStart = config.indexOf(\"plugins:\") + \"plugins:\".length;\n const arrayStart = config.indexOf(\"[\", pluginsStart) + 1;\n config = config.slice(0, arrayStart) + `tailwindcss(), ` + config.slice(arrayStart);\n }\n\n // Reconstruct the file content\n const newContent = `${content.slice(0, configStart)}{\\n\\t${config}\\n}${content.slice(configEnd)}`;\n\n await fs.writeFile(configPath, newContent, \"utf-8\");\n return true;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to setup Astro config: ${errorMessage}`));\n return false;\n }\n}\n","import fs from \"fs-extra\";\n\n/**\n * Ensures a directory exists, creating it and its parents if necessary\n * @param dir - Directory path to ensure exists\n */\nexport async function ensureDirectory(dir: string) {\n await fs.ensureDir(dir);\n}\n\n/**\n * Copies a file from source to destination\n * @param src - Source file path\n * @param dest - Destination file path\n */\nexport async function copyFile(src: string, dest: string) {\n await fs.copy(src, dest);\n}\n\n/**\n * Reads and parses a JSON file\n * @param filePath - Path to the JSON file\n * @returns Parsed JSON content\n */\nexport async function readJsonFile(filePath: string) {\n return fs.readJson(filePath);\n}\n\n/**\n * Writes data to a JSON file\n * @param filePath - Path to write the JSON file\n * @param data - Data to write to the file\n */\nexport async function writeJsonFile(filePath: string, data: unknown) {\n await fs.writeJson(filePath, data, { spaces: 2 });\n}\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if the file exists, false otherwise\n */\nexport async function fileExists(filePath: string) {\n return fs.pathExists(filePath);\n}\n\n/**\n * Creates a CSS file with the provided content\n * @param filePath - Path to write the CSS file\n * @param content - CSS content to write\n */\nexport async function writeCssFile(filePath: string, content: string) {\n await fs.writeFile(filePath, content, \"utf-8\");\n}\n","import chalk from \"chalk\";\n\nexport const highlighter = {\n error: chalk.red,\n warn: chalk.yellow,\n info: chalk.cyan,\n infoBright: chalk.cyanBright,\n success: chalk.greenBright,\n underline: chalk.underline,\n title: chalk.bgBlue,\n};\n","export const MIN_ASTRO_VERSION = \"5.0.0\";\n\n/**\n * File system paths used throughout the application\n */\nexport const PATHS = {\n STARWIND_CORE: \"@starwind-ui/core\",\n STARWIND_CORE_COMPONENTS: \"src/components\",\n STARWIND_REMOTE_COMPONENT_REGISTRY: \"https://starwind.dev/registry.json\",\n LOCAL_CSS_FILE: \"src/styles/starwind.css\",\n LOCAL_CONFIG_FILE: \"starwind.config.json\",\n LOCAL_STYLES_DIR: \"src/styles\",\n LOCAL_COMPONENTS_DIR: \"src/components\",\n} as const;\n\n/**\n * Core framework dependencies\n */\nexport const ASTRO_PACKAGES = {\n core: \"astro@latest\",\n} as const;\n\n/**\n * Tailwind CSS related dependencies\n */\nexport const OTHER_PACKAGES = {\n tailwindCore: \"tailwindcss@latest\",\n tailwindVite: \"@tailwindcss/vite@latest\",\n tailwindForms: \"@tailwindcss/forms@latest\",\n tailwindAnimate: \"tw-animate-css@latest\",\n tailwindVariants: \"tailwind-variants@latest\",\n tablerIcons: \"@tabler/icons@latest\",\n} as const;\n\n/**\n * Get all Tailwind CSS related packages as an array\n */\nexport function getOtherPackages(): string[] {\n return Object.values(OTHER_PACKAGES);\n}\n\n/**\n * Get all Astro related packages as an array\n */\nexport function getAstroPackages(): string[] {\n return Object.values(ASTRO_PACKAGES);\n}\n","import { PATHS } from \"./constants.js\";\nimport { fileExists, readJsonFile, writeJsonFile } from \"./fs.js\";\n\ninterface ComponentConfig {\n name: string;\n version: string;\n}\n\ninterface TailwindConfig {\n css: string;\n baseColor: \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\";\n cssVariables: boolean;\n}\n\n// interface AliasConfig {\n// \tcomponents: string;\n// }\n\nexport interface StarwindConfig {\n $schema: string;\n tailwind: TailwindConfig;\n // aliases: AliasConfig;\n componentDir: string;\n components: ComponentConfig[];\n}\n\nconst defaultConfig: StarwindConfig = {\n $schema: \"https://starwind.dev/config-schema.json\",\n tailwind: {\n css: \"src/styles/starwind.css\",\n baseColor: \"neutral\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: \"src/components/starwind\",\n components: [],\n};\n\n/**\n * Get the current config, ensuring the file is fully read\n */\nexport async function getConfig(): Promise<StarwindConfig> {\n try {\n if (await fileExists(PATHS.LOCAL_CONFIG_FILE)) {\n const config = await readJsonFile(PATHS.LOCAL_CONFIG_FILE);\n return {\n ...defaultConfig,\n ...config,\n components: Array.isArray(config.components) ? config.components : [],\n };\n }\n } catch (error) {\n console.error(\"Error reading config:\", error);\n }\n\n return defaultConfig;\n}\n\n/**\n * Options for updating the config file\n */\nexport interface UpdateConfigOptions {\n /** If true, append new components to existing array. If false, replace the components array. */\n appendComponents?: boolean;\n}\n\n/**\n * Update the config file, ensuring the write operation is completed\n * @param updates - Partial config object to update\n * @param options - Options for updating the config\n */\nexport async function updateConfig(\n updates: Partial<StarwindConfig>,\n options: UpdateConfigOptions = { appendComponents: true },\n): Promise<void> {\n const currentConfig = await getConfig();\n\n // Ensure components array exists\n const currentComponents = Array.isArray(currentConfig.components) ? currentConfig.components : [];\n\n const newConfig = {\n ...currentConfig,\n tailwind: {\n ...currentConfig.tailwind,\n ...(updates.tailwind || {}),\n },\n componentDir: updates.componentDir ? updates.componentDir : currentConfig.componentDir,\n components: updates.components\n ? options.appendComponents\n ? [...currentComponents, ...updates.components]\n : updates.components\n : currentComponents,\n };\n\n try {\n await writeJsonFile(PATHS.LOCAL_CONFIG_FILE, newConfig);\n } catch (error) {\n throw new Error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n }\n}\n","import * as p from \"@clack/prompts\";\nimport { execa } from \"execa\";\n\nimport { fileExists } from \"./fs.js\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\n/**\n * Prompts the user to select their preferred package manager\n * @returns The selected package manager, defaults to npm if cancelled\n */\nexport async function requestPackageManager(): Promise<PackageManager> {\n const pm = await p.select({\n message: \"Select your preferred package manager\",\n options: [\n { value: \"pnpm\", label: \"pnpm\", hint: \"Default\" },\n { value: \"npm\", label: \"npm\" },\n { value: \"yarn\", label: \"yarn\" },\n { value: \"bun\", label: \"bun\" },\n ],\n });\n\n if (p.isCancel(pm)) {\n p.log.warn(\"No package manager selected, defaulting to npm\");\n return \"npm\";\n }\n\n return pm as PackageManager;\n}\n\n/**\n * Detects and returns the default package manager based on lock files\n * @returns The detected package manager, defaults to npm if no lock file is found\n */\nexport async function getDefaultPackageManager(): Promise<PackageManager> {\n // Check for yarn.lock, pnpm-lock.yaml, package-lock.json in order\n if (await fileExists(\"yarn.lock\")) {\n return \"yarn\";\n } else if (await fileExists(\"pnpm-lock.yaml\")) {\n return \"pnpm\";\n } else {\n return \"npm\";\n }\n}\n\n/**\n * Installs the specified packages using the detected package manager\n * @param packages - Array of package names to install\n * @param pm - The package manager to use\n * @param dev - Whether to install as dev dependencies\n * @param force - Whether to force install packages\n */\nexport async function installDependencies(\n packages: string[],\n pm: PackageManager,\n dev = false,\n force = false,\n): Promise<void> {\n const args = [\n pm === \"npm\" ? \"install\" : \"add\",\n ...packages,\n dev ? (pm === \"npm\" || pm === \"pnpm\" ? \"-D\" : \"--dev\") : \"\",\n force ? \"--force\" : \"\",\n ].filter(Boolean);\n\n await execa(pm, args);\n}\n","/**\n * Pauses execution for the specified number of milliseconds.\n * @param ms - The number of milliseconds to sleep\n */\nexport const sleep = async (ms: number): Promise<void> => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n"],"mappings":";AAAA,OAAO,UAAU;AAEjB,YAAYA,QAAO;AACnB,OAAOC,aAAY;;;ACHZ,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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SAAS,WAAW,YAAY,KAAK,cAAc,KAAK,IAAI,CAAC,CAAC,UAAU,YAAY,KAAK,EAAE,CAAC;AAAA,IAC9F,CAAC;AAEL,QAAM,YAAS,aAAa,GAAG;AAC7B,MAAE,UAAO,qBAAqB;AAC9B,aAAO,QAAQ,KAAK,CAAC;AAAA,IACvB;AAEA,QAAI,eAAe;AACjB,mBAAa,KAAK;AAAA,QAChB,OAAO;AAAA,QACP,MAAM,YAAY;AAChB,gBAAM,oBAAoB,iBAAiB,GAAG,IAAI,OAAO,KAAK;AAC9D,iBAAO,GAAG,YAAY,KAAK,iCAAiC,CAAC;AAAA,QAC/D;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,MAAE,OAAI;AAAA,QACJ,YAAY,KAAK,sEAAsE;AAAA,MACzF;AAAA,IACF;AAKA,QAAI,aAAa,SAAS,GAAG;AAC3B,YAAQ,SAAM,YAAY;AAAA,IAC5B;AAEA,QAAI,YAAY,SAAS,GAAG;AAC1B,YAAQ,SAAM,WAAW;AAAA,IAC3B;AAEA,UAAM,MAAM,GAAG;AAEf,IAAE;AAAA,MACA,qCAAqC,YAAY,WAAW,cAAc,OAAO,CAAC;AAAA,MAClF;AAAA,IACF;AAEA,QAAI,CAAC,WAAW;AACd,YAAM,GAAI;AACV,MAAE,SAAM,mCAA4B;AAAA,IACtC;AAAA,EACF,SAAS,OAAO;AACd,IAAE,OAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,0BAA0B;AAC/E,IAAE,UAAO,qBAAqB;AAC9B,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["p","semver","fs","fs","p","semver","shouldInstall"]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/init.ts","../src/templates/starwind.css.ts","../src/utils/astro-config.ts","../src/utils/fs.ts","../src/utils/highlighter.ts","../src/utils/constants.ts","../src/utils/config.ts","../src/utils/package-manager.ts","../src/utils/sleep.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport * as p from \"@clack/prompts\";\nimport semver from \"semver\";\n\nimport { tailwindConfig } from \"@/templates/starwind.css.js\";\nimport { setupAstroConfig } from \"@/utils/astro-config.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport { ASTRO_PACKAGES, getOtherPackages, MIN_ASTRO_VERSION, PATHS } from \"@/utils/constants.js\";\nimport { ensureDirectory, fileExists, readJsonFile, writeCssFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport {\n getDefaultPackageManager,\n installDependencies,\n requestPackageManager,\n} from \"@/utils/package-manager.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\nexport async function init(withinAdd: boolean = false, options?: { defaults?: boolean }) {\n if (!withinAdd) {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n }\n\n try {\n // Validate project structure\n if (!(await fileExists(\"package.json\"))) {\n throw new Error(\n \"No package.json found. Please run this command in the root of your project.\",\n );\n }\n\n const pkg = await readJsonFile(\"package.json\");\n\n // Check Astro version compatibility\n const installTasks = [];\n const configTasks = [];\n\n // ================================================================\n // Prepare project structure and configuration tasks\n // ================================================================\n let configChoices;\n\n // Use defaults if specified, otherwise prompt user for choices\n if (options?.defaults) {\n configChoices = {\n installLocation: PATHS.LOCAL_COMPONENTS_DIR,\n cssFile: PATHS.LOCAL_CSS_FILE,\n twBaseColor: \"neutral\",\n };\n\n if (!withinAdd) {\n p.log.info(\"Using default configuration values\");\n }\n } else {\n configChoices = await p.group(\n {\n // ask where to install components\n installLocation: () =>\n p.text({\n message: \"What is your components directory?\",\n placeholder: PATHS.LOCAL_COMPONENTS_DIR,\n initialValue: PATHS.LOCAL_COMPONENTS_DIR,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot install in system directories`;\n }\n },\n }),\n // ask where to add the css file\n cssFile: () =>\n p.text({\n message: `Where would you like to add the Tailwind ${highlighter.info(\".css\")} file?`,\n placeholder: PATHS.LOCAL_CSS_FILE,\n initialValue: PATHS.LOCAL_CSS_FILE,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Must end with .css\n if (!value.endsWith(\".css\")) return `File must end with .css extension`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot use system directories`;\n }\n\n // Ensure the path has a valid filename\n const basename = path.basename(value, \".css\");\n if (!basename || basename.trim().length === 0) {\n return `Invalid filename`;\n }\n },\n }),\n\n twBaseColor: () =>\n p.select({\n message: \"What Tailwind base color would you like to use?\",\n initialValue: \"neutral\",\n options: [\n { label: \"Neutral (default)\", value: \"neutral\" },\n { label: \"Stone\", value: \"stone\" },\n { label: \"Zinc\", value: \"zinc\" },\n { label: \"Gray\", value: \"gray\" },\n { label: \"Slate\", value: \"slate\" },\n ],\n }),\n },\n {\n // On Cancel callback that wraps the group\n // So if the user cancels one of the prompts in the group this function will be called\n onCancel: () => {\n p.cancel(\"Operation cancelled.\");\n process.exit(0);\n },\n },\n );\n }\n\n // ================================================================\n // Make sure appropriate directories exist\n // ================================================================\n const cssFileDir = path.dirname(configChoices.cssFile);\n const componentInstallDir = path.join(configChoices.installLocation, \"starwind\");\n configTasks.push({\n title: \"Creating project structure\",\n task: async () => {\n await ensureDirectory(componentInstallDir);\n await ensureDirectory(cssFileDir);\n await sleep(250);\n return \"Created project structure\";\n },\n });\n\n // ================================================================\n // Prepare Astro config file setup\n // ================================================================\n configTasks.push({\n title: \"Setup Astro config file\",\n task: async () => {\n const success = await setupAstroConfig();\n if (!success) {\n throw new Error(\"Failed to setup Astro config\");\n }\n await sleep(250);\n return \"Astro config setup completed\";\n },\n });\n\n // ================================================================\n // Prepare CSS file\n // ================================================================\n // Check if CSS file already exists\n const cssFileExists = await fileExists(configChoices.cssFile);\n let updatedTailwindConfig = tailwindConfig;\n\n if (configChoices.twBaseColor !== \"neutral\") {\n // replace all \"--color-neutral\" with \"--color-twBaseColor\"\n updatedTailwindConfig = updatedTailwindConfig.replace(\n /--color-neutral-/g,\n `--color-${configChoices.twBaseColor}-`,\n );\n }\n\n if (cssFileExists) {\n const shouldOverride = options?.defaults\n ? true\n : await p.confirm({\n message: `${highlighter.info(configChoices.cssFile)} already exists. Do you want to override it?`,\n });\n\n if (p.isCancel(shouldOverride)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldOverride) {\n p.log.info(\"Skipping Tailwind CSS configuration\");\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n\n // ================================================================\n // Prepare project starwind configuration\n // ================================================================\n configTasks.push({\n title: \"Updating project configuration\",\n task: async () => {\n await updateConfig({\n tailwind: {\n css: configChoices.cssFile,\n baseColor: configChoices.twBaseColor as \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: configChoices.installLocation,\n components: [],\n });\n await sleep(250);\n return \"Updated project starwind configuration\";\n },\n });\n\n // ================================================================\n // Prepare astro installation\n // ================================================================\n // Request package manager\n const pm = options?.defaults ? await getDefaultPackageManager() : await requestPackageManager();\n\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n if (!semver.gte(astroVersion, MIN_ASTRO_VERSION)) {\n const shouldUpgrade = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to upgrade from v${astroVersion}?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldUpgrade)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldUpgrade) {\n p.cancel(\"Astro v5 or higher is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: \"Upgrading Astro\",\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return \"Upgraded Astro successfully\";\n },\n });\n }\n } else {\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to install it?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldInstall) {\n p.cancel(\"Astro is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: `Installing ${ASTRO_PACKAGES.core}`,\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return `Installed ${highlighter.info(ASTRO_PACKAGES.core)} successfully`;\n },\n });\n }\n\n // ================================================================\n // Prepare tailwind and other package installation\n // ================================================================\n const otherPackages = getOtherPackages();\n\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Install ${highlighter.info(otherPackages.join(\", \"))} using ${highlighter.info(pm)}?`,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (shouldInstall) {\n installTasks.push({\n title: `Installing packages`,\n task: async () => {\n await installDependencies(getOtherPackages(), pm, false, false);\n return `${highlighter.info(\"Packages installed successfully\")}`;\n },\n });\n } else {\n p.log.warn(\n highlighter.warn(`Skipped installation of packages. Make sure to install them manually`),\n );\n }\n\n // ================================================================\n // Execute all tasks\n // ================================================================\n if (installTasks.length > 0) {\n await p.tasks(installTasks);\n }\n\n if (configTasks.length > 0) {\n await p.tasks(configTasks);\n }\n\n await sleep(250);\n\n p.note(\n `Make sure your layout imports the ${highlighter.infoBright(configChoices.cssFile)} file`,\n \"Next steps\",\n );\n\n if (!withinAdd) {\n sleep(1000);\n p.outro(\"Enjoy using Starwind UI 🚀\");\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","export const tailwindConfig = `@import \"tailwindcss\";\n@import \"tw-animate-css\";\n@plugin \"@tailwindcss/forms\";\n@variant dark (&:where(.dark, .dark *));\n\n@theme {\n\t--animate-accordion-down: accordion-down 0.2s ease-out;\n\t--animate-accordion-up: accordion-up 0.2s ease-out;\n\n\t@keyframes accordion-down {\n\t\tfrom {\n\t\t\theight: 0;\n\t\t}\n\t\tto {\n\t\t\theight: var(--starwind-accordion-content-height);\n\t\t}\n\t}\n\n\t@keyframes accordion-up {\n\t\tfrom {\n\t\t\theight: var(--starwind-accordion-content-height);\n\t\t}\n\t\tto {\n\t\t\theight: 0;\n\t\t}\n\t}\n}\n\n@theme inline {\n\t--color-background: var(--background);\n\t--color-foreground: var(--foreground);\n\t--color-card: var(--card);\n\t--color-card-foreground: var(--card-foreground);\n\t--color-popover: var(--popover);\n\t--color-popover-foreground: var(--popover-foreground);\n\t--color-primary: var(--primary);\n\t--color-primary-foreground: var(--primary-foreground);\n\t--color-secondary: var(--secondary);\n\t--color-secondary-foreground: var(--secondary-foreground);\n\t--color-muted: var(--muted);\n\t--color-muted-foreground: var(--muted-foreground);\n\t--color-accent: var(--accent);\n\t--color-accent-foreground: var(--accent-foreground);\n\t--color-info: var(--info);\n\t--color-info-foreground: var(--info-foreground);\n\t--color-success: var(--success);\n\t--color-success-foreground: var(--success-foreground);\n\t--color-warning: var(--warning);\n\t--color-warning-foreground: var(--warning-foreground);\n\t--color-error: var(--error);\n\t--color-error-foreground: var(--error-foreground);\n\t--color-border: var(--border);\n\t--color-input: var(--input);\n\t--color-outline: var(--outline);\n\n\t--radius-xs: calc(var(--radius) - 0.375rem);\n\t--radius-sm: calc(var(--radius) - 0.25rem);\n\t--radius-md: calc(var(--radius) - 0.125rem);\n\t--radius-lg: var(--radius);\n\t--radius-xl: calc(var(--radius) + 0.25rem);\n\t--radius-2xl: calc(var(--radius) + 0.5rem);\n\t--radius-3xl: calc(var(--radius) + 1rem);\n}\n\n@layer base {\n\t:root {\n\t\t--background: var(--color-neutral-50);\n\t\t--foreground: var(--color-neutral-950);\n\t\t--card: var(--color-neutral-50);\n\t\t--card-foreground: var(--color-neutral-950);\n\t\t--popover: var(--color-neutral-50);\n\t\t--popover-foreground: var(--color-neutral-950);\n\t\t--primary: var(--color-blue-700);\n\t\t--primary-foreground: var(--color-neutral-50);\n\t\t--secondary: var(--color-fuchsia-700);\n\t\t--secondary-foreground: var(--color-neutral-50);\n\t\t--muted: var(--color-neutral-100);\n\t\t--muted-foreground: var(--color-neutral-600);\n\t\t--accent: var(--color-neutral-200);\n\t\t--accent-foreground: var(--color-neutral-900);\n\t\t--info: var(--color-sky-300);\n\t\t--info-foreground: var(--color-sky-950);\n\t\t--success: var(--color-green-300);\n\t\t--success-foreground: var(--color-green-950);\n\t\t--warning: var(--color-amber-300);\n\t\t--warning-foreground: var(--color-amber-950);\n\t\t--error: var(--color-red-700);\n\t\t--error-foreground: var(--color-neutral-50);\n\t\t--border: var(--color-neutral-200);\n\t\t--input: var(--color-neutral-200);\n\t\t--outline: var(--color-blue-600);\n\t\t--radius: 0.5rem;\n\t}\n\n\t.dark {\n\t\t--background: var(--color-neutral-950);\n\t\t--foreground: var(--color-neutral-50);\n\t\t--card: var(--color-neutral-950);\n\t\t--card-foreground: var(--color-neutral-50);\n\t\t--popover: var(--color-neutral-950);\n\t\t--popover-foreground: var(--color-neutral-50);\n\t\t--primary: var(--color-blue-700);\n\t\t--primary-foreground: var(--color-neutral-50);\n\t\t--secondary: var(--color-fuchsia-300);\n\t\t--secondary-foreground: var(--color-neutral-950);\n\t\t--muted: var(--color-neutral-900);\n\t\t--muted-foreground: var(--color-neutral-400);\n\t\t--accent: var(--color-neutral-900);\n\t\t--accent-foreground: var(--color-neutral-100);\n\t\t--info: var(--color-sky-300);\n\t\t--info-foreground: var(--color-sky-950);\n\t\t--success: var(--color-green-300);\n\t\t--success-foreground: var(--color-green-950);\n\t\t--warning: var(--color-amber-300);\n\t\t--warning-foreground: var(--color-amber-950);\n\t\t--error: var(--color-red-800);\n\t\t--error-foreground: var(--color-neutral-50);\n\t\t--border: var(--color-neutral-800);\n\t\t--input: var(--color-neutral-800);\n\t\t--outline: var(--color-blue-600);\n\t\t--radius: 0.5rem;\n\t}\n\n\t* {\n\t\t@apply border-border;\n\t}\n\t*:focus-visible {\n\t\t@apply outline-outline;\n\t}\n\thtml {\n\t\t@apply bg-background text-foreground scheme-light dark:scheme-dark;\n\t}\n\tbutton {\n\t\t@apply cursor-pointer;\n\t}\n}\n\n@layer utilities {\n\t/* transition-colors but without outline-color transition property */\n\t.starwind-transition-colors {\n\t\ttransition-property: color, background-color, border-color, text-decoration-color, fill, stroke,\n\t\t\t--tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n\t\ttransition-timing-function: var(--default-transition-timing-function);\n\t\ttransition-duration: var(--default-transition-duration);\n\t}\n}\n`;\n","import * as p from \"@clack/prompts\";\nimport fs from \"fs-extra\";\nimport semver from \"semver\";\n\nimport { readJsonFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\n\nimport { fileExists } from \"./fs.js\";\n\nconst CONFIG_EXTENSIONS = [\"ts\", \"js\", \"mjs\", \"cjs\"] as const;\n// type ConfigExtension = (typeof CONFIG_EXTENSIONS)[number];\n\n/**\n * Finds the Astro config file in the current directory\n * @returns The path to the config file if found, null otherwise\n */\nasync function findAstroConfig(): Promise<string | null> {\n for (const ext of CONFIG_EXTENSIONS) {\n const configPath = `astro.config.${ext}`;\n if (await fileExists(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\n/**\n * Gets the installed Astro version from the project's package.json\n * @returns The installed Astro version or null if not found\n */\nasync function getAstroVersion(): Promise<string | null> {\n try {\n const pkg = await readJsonFile(\"package.json\");\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n return astroVersion;\n }\n\n p.log.error(\n highlighter.error(\n \"Astro seems not installed in your project, please check your package.json\",\n ),\n );\n return null;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to check Astro version: ${errorMessage}`));\n return null;\n }\n}\n\n/**\n * Updates or creates the Astro configuration file\n * @returns true if successful, false otherwise\n */\nexport async function setupAstroConfig(): Promise<boolean> {\n try {\n let configPath = await findAstroConfig();\n let content = \"\";\n\n if (configPath) {\n content = await fs.readFile(configPath, \"utf-8\");\n } else {\n configPath = \"astro.config.ts\";\n content = `import { defineConfig } from \"astro/config\";\\n\\nexport default defineConfig({});\\n`;\n }\n\n // Add tailwindcss import if not present\n if (!content.includes('import tailwindcss from \"@tailwindcss/vite\"')) {\n content = `import tailwindcss from \"@tailwindcss/vite\";\\n${content}`;\n }\n\n // Parse the configuration object\n const configStart = content.indexOf(\"defineConfig(\") + \"defineConfig(\".length;\n const configEnd = content.lastIndexOf(\");\");\n let config = content.slice(configStart, configEnd);\n\n // Remove outer braces and trim\n config = config.trim().replace(/^{|}$/g, \"\").trim();\n\n const astroVersion = await getAstroVersion();\n\n if (astroVersion && semver.lt(astroVersion, \"5.7.0\")) {\n // Add experimental configuration\n if (!config.includes(\"experimental\")) {\n config += `\\n\\texperimental: {\n\t\tsvg: true,\n\t},`;\n } else if (!config.includes(\"svg: true\") && !config.includes(\"svg: {\")) {\n // Insert svg config into existing experimental block\n const expEnd = config.indexOf(\"experimental:\") + \"experimental:\".length;\n const blockStart = config.indexOf(\"{\", expEnd) + 1;\n config = config.slice(0, blockStart) + `\\n\\t\\tsvg: true,` + config.slice(blockStart);\n }\n }\n\n // Add vite configuration\n if (!config.includes(\"vite:\")) {\n config += `\\n\\tvite: {\n\t\tplugins: [tailwindcss()],\n\t},`;\n } else if (!config.includes(\"plugins: [\")) {\n // Insert plugins into existing vite block\n const viteEnd = config.indexOf(\"vite:\") + \"vite:\".length;\n const blockStart = config.indexOf(\"{\", viteEnd) + 1;\n config =\n config.slice(0, blockStart) + `\\n\\t\\tplugins: [tailwindcss()],` + config.slice(blockStart);\n } else if (!config.includes(\"tailwindcss()\")) {\n // Add tailwindcss to existing plugins array\n const pluginsStart = config.indexOf(\"plugins:\") + \"plugins:\".length;\n const arrayStart = config.indexOf(\"[\", pluginsStart) + 1;\n config = config.slice(0, arrayStart) + `tailwindcss(), ` + config.slice(arrayStart);\n }\n\n // Reconstruct the file content\n const newContent = `${content.slice(0, configStart)}{\\n\\t${config}\\n}${content.slice(configEnd)}`;\n\n await fs.writeFile(configPath, newContent, \"utf-8\");\n return true;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to setup Astro config: ${errorMessage}`));\n return false;\n }\n}\n","import fs from \"fs-extra\";\n\n/**\n * Ensures a directory exists, creating it and its parents if necessary\n * @param dir - Directory path to ensure exists\n */\nexport async function ensureDirectory(dir: string) {\n await fs.ensureDir(dir);\n}\n\n/**\n * Copies a file from source to destination\n * @param src - Source file path\n * @param dest - Destination file path\n */\nexport async function copyFile(src: string, dest: string) {\n await fs.copy(src, dest);\n}\n\n/**\n * Reads and parses a JSON file\n * @param filePath - Path to the JSON file\n * @returns Parsed JSON content\n */\nexport async function readJsonFile(filePath: string) {\n return fs.readJson(filePath);\n}\n\n/**\n * Writes data to a JSON file\n * @param filePath - Path to write the JSON file\n * @param data - Data to write to the file\n */\nexport async function writeJsonFile(filePath: string, data: unknown) {\n await fs.writeJson(filePath, data, { spaces: 2 });\n}\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if the file exists, false otherwise\n */\nexport async function fileExists(filePath: string) {\n return fs.pathExists(filePath);\n}\n\n/**\n * Creates a CSS file with the provided content\n * @param filePath - Path to write the CSS file\n * @param content - CSS content to write\n */\nexport async function writeCssFile(filePath: string, content: string) {\n await fs.writeFile(filePath, content, \"utf-8\");\n}\n","import chalk from \"chalk\";\n\nexport const highlighter = {\n error: chalk.red,\n warn: chalk.yellow,\n info: chalk.cyan,\n infoBright: chalk.cyanBright,\n success: chalk.greenBright,\n underline: chalk.underline,\n title: chalk.bgBlue,\n};\n","export const MIN_ASTRO_VERSION = \"5.0.0\";\n\n/**\n * File system paths used throughout the application\n */\nexport const PATHS = {\n STARWIND_CORE: \"@starwind-ui/core\",\n STARWIND_CORE_COMPONENTS: \"src/components\",\n STARWIND_REMOTE_COMPONENT_REGISTRY: \"https://starwind.dev/registry.json\",\n LOCAL_CSS_FILE: \"src/styles/starwind.css\",\n LOCAL_CONFIG_FILE: \"starwind.config.json\",\n LOCAL_STYLES_DIR: \"src/styles\",\n LOCAL_COMPONENTS_DIR: \"src/components\",\n} as const;\n\n/**\n * Core framework dependencies\n */\nexport const ASTRO_PACKAGES = {\n core: \"astro@latest\",\n} as const;\n\n/**\n * Tailwind CSS and other dependencies\n */\nexport const OTHER_PACKAGES = {\n tailwindCore: \"tailwindcss@^4\",\n tailwindVite: \"@tailwindcss/vite@^4\",\n tailwindForms: \"@tailwindcss/forms@^0.5\",\n tailwindAnimate: \"tw-animate-css@^1\",\n tailwindVariants: \"tailwind-variants@^2\",\n tailwindMerge: \"tailwind-merge@^3\",\n tablerIcons: \"@tabler/icons@^3\",\n} as const;\n\n/**\n * Get all Tailwind CSS related packages as an array\n */\nexport function getOtherPackages(): string[] {\n return Object.values(OTHER_PACKAGES);\n}\n\n/**\n * Get all Astro related packages as an array\n */\nexport function getAstroPackages(): string[] {\n return Object.values(ASTRO_PACKAGES);\n}\n","import { PATHS } from \"./constants.js\";\nimport { fileExists, readJsonFile, writeJsonFile } from \"./fs.js\";\n\ninterface ComponentConfig {\n name: string;\n version: string;\n}\n\ninterface TailwindConfig {\n css: string;\n baseColor: \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\";\n cssVariables: boolean;\n}\n\n// interface AliasConfig {\n// \tcomponents: string;\n// }\n\nexport interface StarwindConfig {\n $schema: string;\n tailwind: TailwindConfig;\n // aliases: AliasConfig;\n componentDir: string;\n components: ComponentConfig[];\n}\n\nconst defaultConfig: StarwindConfig = {\n $schema: \"https://starwind.dev/config-schema.json\",\n tailwind: {\n css: \"src/styles/starwind.css\",\n baseColor: \"neutral\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: \"src/components/starwind\",\n components: [],\n};\n\n/**\n * Get the current config, ensuring the file is fully read\n */\nexport async function getConfig(): Promise<StarwindConfig> {\n try {\n if (await fileExists(PATHS.LOCAL_CONFIG_FILE)) {\n const config = await readJsonFile(PATHS.LOCAL_CONFIG_FILE);\n return {\n ...defaultConfig,\n ...config,\n components: Array.isArray(config.components) ? config.components : [],\n };\n }\n } catch (error) {\n console.error(\"Error reading config:\", error);\n }\n\n return defaultConfig;\n}\n\n/**\n * Options for updating the config file\n */\nexport interface UpdateConfigOptions {\n /** If true, append new components to existing array. If false, replace the components array. */\n appendComponents?: boolean;\n}\n\n/**\n * Update the config file, ensuring the write operation is completed\n * @param updates - Partial config object to update\n * @param options - Options for updating the config\n */\nexport async function updateConfig(\n updates: Partial<StarwindConfig>,\n options: UpdateConfigOptions = { appendComponents: true },\n): Promise<void> {\n const currentConfig = await getConfig();\n\n // Ensure components array exists\n const currentComponents = Array.isArray(currentConfig.components) ? currentConfig.components : [];\n\n const newConfig = {\n ...currentConfig,\n tailwind: {\n ...currentConfig.tailwind,\n ...(updates.tailwind || {}),\n },\n componentDir: updates.componentDir ? updates.componentDir : currentConfig.componentDir,\n components: updates.components\n ? options.appendComponents\n ? [...currentComponents, ...updates.components]\n : updates.components\n : currentComponents,\n };\n\n try {\n await writeJsonFile(PATHS.LOCAL_CONFIG_FILE, newConfig);\n } catch (error) {\n throw new Error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n }\n}\n","import * as p from \"@clack/prompts\";\nimport { execa } from \"execa\";\n\nimport { fileExists } from \"./fs.js\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\n/**\n * Prompts the user to select their preferred package manager\n * @returns The selected package manager, defaults to npm if cancelled\n */\nexport async function requestPackageManager(): Promise<PackageManager> {\n const pm = await p.select({\n message: \"Select your preferred package manager\",\n options: [\n { value: \"pnpm\", label: \"pnpm\", hint: \"Default\" },\n { value: \"npm\", label: \"npm\" },\n { value: \"yarn\", label: \"yarn\" },\n { value: \"bun\", label: \"bun\" },\n ],\n });\n\n if (p.isCancel(pm)) {\n p.log.warn(\"No package manager selected, defaulting to npm\");\n return \"npm\";\n }\n\n return pm as PackageManager;\n}\n\n/**\n * Detects and returns the default package manager based on lock files\n * @returns The detected package manager, defaults to npm if no lock file is found\n */\nexport async function getDefaultPackageManager(): Promise<PackageManager> {\n // Check for yarn.lock, pnpm-lock.yaml, package-lock.json in order\n if (await fileExists(\"yarn.lock\")) {\n return \"yarn\";\n } else if (await fileExists(\"pnpm-lock.yaml\")) {\n return \"pnpm\";\n } else {\n return \"npm\";\n }\n}\n\n/**\n * Installs the specified packages using the detected package manager\n * @param packages - Array of package names to install\n * @param pm - The package manager to use\n * @param dev - Whether to install as dev dependencies\n * @param force - Whether to force install packages\n */\nexport async function installDependencies(\n packages: string[],\n pm: PackageManager,\n dev = false,\n force = false,\n): Promise<void> {\n const args = [\n pm === \"npm\" ? \"install\" : \"add\",\n ...packages,\n dev ? (pm === \"npm\" || pm === \"pnpm\" ? \"-D\" : \"--dev\") : \"\",\n force ? \"--force\" : \"\",\n ].filter(Boolean);\n\n await execa(pm, args);\n}\n","/**\n * Pauses execution for the specified number of milliseconds.\n * @param ms - The number of milliseconds to sleep\n */\nexport const sleep = async (ms: number): Promise<void> => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n"],"mappings":";AAAA,OAAO,UAAU;AAEjB,YAAYA,QAAO;AACnB,OAAOC,aAAY;;;ACHZ,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AC9F,CAAC;AAEL,QAAM,YAAS,aAAa,GAAG;AAC7B,MAAE,UAAO,qBAAqB;AAC9B,aAAO,QAAQ,KAAK,CAAC;AAAA,IACvB;AAEA,QAAI,eAAe;AACjB,mBAAa,KAAK;AAAA,QAChB,OAAO;AAAA,QACP,MAAM,YAAY;AAChB,gBAAM,oBAAoB,iBAAiB,GAAG,IAAI,OAAO,KAAK;AAC9D,iBAAO,GAAG,YAAY,KAAK,iCAAiC,CAAC;AAAA,QAC/D;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,MAAE,OAAI;AAAA,QACJ,YAAY,KAAK,sEAAsE;AAAA,MACzF;AAAA,IACF;AAKA,QAAI,aAAa,SAAS,GAAG;AAC3B,YAAQ,SAAM,YAAY;AAAA,IAC5B;AAEA,QAAI,YAAY,SAAS,GAAG;AAC1B,YAAQ,SAAM,WAAW;AAAA,IAC3B;AAEA,UAAM,MAAM,GAAG;AAEf,IAAE;AAAA,MACA,qCAAqC,YAAY,WAAW,cAAc,OAAO,CAAC;AAAA,MAClF;AAAA,IACF;AAEA,QAAI,CAAC,WAAW;AACd,YAAM,GAAI;AACV,MAAE,SAAM,mCAA4B;AAAA,IACtC;AAAA,EACF,SAAS,OAAO;AACd,IAAE,OAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,0BAA0B;AAC/E,IAAE,UAAO,qBAAqB;AAC9B,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["p","semver","fs","fs","p","semver","shouldInstall"]}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
requestPackageManager,
|
|
10
10
|
sleep,
|
|
11
11
|
updateConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HDAZQTOL.js";
|
|
13
13
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
import { Command } from "commander";
|
|
@@ -288,7 +288,7 @@ async function isValidComponent(component, availableComponents) {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
// src/commands/add.ts
|
|
291
|
-
var { init: init2 } = await import("./init-
|
|
291
|
+
var { init: init2 } = await import("./init-NBNT5V74.js");
|
|
292
292
|
async function add(components, options) {
|
|
293
293
|
try {
|
|
294
294
|
p2.intro(highlighter.title(" Welcome to the Starwind CLI "));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starwind",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Add beautifully designed components to your Astro applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@clack/prompts": "0.11.0",
|
|
36
|
-
"@starwind-ui/core": "1.
|
|
36
|
+
"@starwind-ui/core": "1.8.0",
|
|
37
37
|
"chalk": "5.4.1",
|
|
38
38
|
"commander": "14.0.0",
|
|
39
39
|
"execa": "9.6.0",
|
package/dist/init-VWGSAZG5.js
DELETED
|
File without changes
|