shadcn-svelte 0.0.2 → 0.0.3
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 +2 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -67,9 +67,7 @@ import fs2 from "fs-extra";
|
|
|
67
67
|
async function getProjectInfo() {
|
|
68
68
|
const info = {
|
|
69
69
|
tsconfig: null,
|
|
70
|
-
alias: null
|
|
71
|
-
srcDir: false,
|
|
72
|
-
appDir: false
|
|
70
|
+
alias: null
|
|
73
71
|
};
|
|
74
72
|
try {
|
|
75
73
|
const tsconfig = await getTsConfig();
|
|
@@ -179,7 +177,7 @@ var STYLES = `@tailwind base;
|
|
|
179
177
|
--accent: 216 34% 17%;
|
|
180
178
|
--accent-foreground: 210 40% 98%;
|
|
181
179
|
|
|
182
|
-
--destructive:
|
|
180
|
+
--destructive: 360 62% 55%;
|
|
183
181
|
--destructive-foreground: 210 40% 98%;
|
|
184
182
|
|
|
185
183
|
--ring: 216 34% 17%;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils/get-components.ts","../src/utils/get-package-info.ts","../src/utils/get-package-manager.ts","../src/utils/get-project-info.ts","../src/utils/logger.ts","../src/utils/templates.ts"],"sourcesContent":["#!/usr/bin/env node\n// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\nimport { existsSync, promises as fs } from \"fs\";\nimport path from \"path\";\nimport { Command } from \"commander\";\nimport { execa } from \"execa\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport { Component, getAvailableComponents } from \"./utils/get-components\";\nimport { getPackageInfo } from \"./utils/get-package-info\";\nimport { getPackageManager } from \"./utils/get-package-manager\";\nimport { getProjectInfo } from \"./utils/get-project-info\";\nimport { logger } from \"./utils/logger\";\nimport { STYLES, TAILWIND_CONFIG, UTILS } from \"./utils/templates\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nconst PROJECT_DEPENDENCIES = [\n\t\"tailwindcss-animate\",\n\t\"class-variance-authority\",\n\t\"clsx\",\n\t\"tailwind-merge\",\n\t\"lucide-svelte\"\n];\n\nasync function main() {\n\tconst packageInfo = getPackageInfo();\n\tconst projectInfo = await getProjectInfo();\n\tconst packageManager = getPackageManager();\n\n\tconst program = new Command()\n\t\t.name(\"shadcn-svelte\")\n\t\t.description(\"Add shadcn-svelte components to your project\")\n\t\t.version(\n\t\t\tpackageInfo.version || \"1.0.0\",\n\t\t\t\"-v, --version\",\n\t\t\t\"display the version number\"\n\t\t);\n\n\tprogram\n\t\t.command(\"init\")\n\t\t.description(\"Configure your SvelteKit project.\")\n\t\t.option(\"-y, --yes\", \"Skip confirmation prompt.\")\n\t\t.action(async (options) => {\n\t\t\tlogger.warn(\n\t\t\t\t\"This command assumes a SvelteKit project with TypeScript and Tailwind CSS.\"\n\t\t\t);\n\t\t\tlogger.warn(\n\t\t\t\t\"If you don't have these, follow the manual steps at https://ui.shadcn.com/docs/installation.\"\n\t\t\t);\n\t\t\tlogger.warn(\"\");\n\n\t\t\tif (!options.yes) {\n\t\t\t\tconst { proceed } = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"proceed\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Running this command will install dependencies and overwrite your existing tailwind.config.cjs. Proceed?\",\n\t\t\t\t\tinitial: true\n\t\t\t\t});\n\n\t\t\t\tif (!proceed) {\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Install dependencies.\n\t\t\tconst dependenciesSpinner = ora(\n\t\t\t\t`Installing dependencies...`\n\t\t\t).start();\n\t\t\tawait execa(packageManager, [\n\t\t\t\tpackageManager === \"npm\" ? \"install\" : \"add\",\n\t\t\t\t...PROJECT_DEPENDENCIES\n\t\t\t]);\n\t\t\tdependenciesSpinner.succeed();\n\n\t\t\t// Update styles\n\t\t\tlet stylesDestination = \"./src/app.postcss\";\n\n\t\t\tconst stylesSpinner = ora(\n\t\t\t\t`Adding styles with CSS variables...`\n\t\t\t).start();\n\t\t\tawait fs.writeFile(stylesDestination, STYLES, \"utf8\");\n\t\t\tstylesSpinner.succeed();\n\n\t\t\t// Ensure lib directory exists.\n\t\t\tconst libDir = \"./src/lib\";\n\t\t\tif (!existsSync(path.resolve(libDir))) {\n\t\t\t\tawait fs.mkdir(path.resolve(libDir), { recursive: true });\n\t\t\t}\n\n\t\t\t// Create lib/utils.ts\n\t\t\tconst utilsDestination = \"./src/lib/utils.ts\";\n\n\t\t\tconst utilsSpinner = ora(`Adding utils...`).start();\n\t\t\tawait fs.writeFile(utilsDestination, UTILS, \"utf8\");\n\t\t\tutilsSpinner.succeed();\n\n\t\t\t// Update tailwind.config.cjs\n\t\t\tconst tailwindDestination = \"./tailwind.config.cjs\";\n\t\t\tconst tailwindSpinner = ora(\n\t\t\t\t`Updating tailwind.config.cjs...`\n\t\t\t).start();\n\t\t\tawait fs.writeFile(tailwindDestination, TAILWIND_CONFIG, \"utf8\");\n\t\t\ttailwindSpinner.succeed();\n\t\t});\n\n\tprogram\n\t\t.command(\"add\")\n\t\t.description(\"add components to your project\")\n\t\t.argument(\"[components...]\", \"name of components\")\n\t\t.action(async (components: string[]) => {\n\t\t\tlogger.warn(\n\t\t\t\t\"Running the following command will overwrite existing files.\"\n\t\t\t);\n\t\t\tlogger.warn(\n\t\t\t\t\"Make sure you have committed your changes before proceeding.\"\n\t\t\t);\n\t\t\tlogger.warn(\"\");\n\n\t\t\tconst availableComponents = await getAvailableComponents();\n\n\t\t\tif (!availableComponents?.length) {\n\t\t\t\tlogger.error(\n\t\t\t\t\t\"An error occurred while fetching components. Please try again.\"\n\t\t\t\t);\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tlet selectedComponents = availableComponents.filter((component) =>\n\t\t\t\tcomponents.includes(component.component)\n\t\t\t);\n\n\t\t\tif (!selectedComponents?.length) {\n\t\t\t\tselectedComponents = await promptForComponents(\n\t\t\t\t\tavailableComponents\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst dir = await promptForDestinationDir();\n\n\t\t\tif (!selectedComponents?.length) {\n\t\t\t\tlogger.warn(\"No components selected. Nothing to install.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\t// Create componentPath directory if it doesn't exist.\n\t\t\tconst destinationDir = path.resolve(dir);\n\t\t\tif (!existsSync(destinationDir)) {\n\t\t\t\tconst spinner = ora(`Creating ${dir}...`).start();\n\t\t\t\tawait fs.mkdir(destinationDir, { recursive: true });\n\t\t\t\tspinner.succeed();\n\t\t\t}\n\n\t\t\tlogger.success(\n\t\t\t\t`Installing ${selectedComponents.length} component(s) and dependencies...`\n\t\t\t);\n\t\t\tfor (const component of selectedComponents) {\n\t\t\t\tconst componentSpinner = ora(`${component.name}...`).start();\n\n\t\t\t\t// Write the files.\n\t\t\t\tfor (const file of component.files) {\n\t\t\t\t\t// Replace alias with the project's alias.\n\t\t\t\t\tif (projectInfo?.alias) {\n\t\t\t\t\t\tfile.content = file.content.replace(\n\t\t\t\t\t\t\t/$\\//g,\n\t\t\t\t\t\t\tprojectInfo.alias\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst dirPath = path.join(dir, file.dir);\n\t\t\t\t\tawait fs.mkdir(dirPath, { recursive: true });\n\t\t\t\t\tconst filePath = path.resolve(dirPath, file.name);\n\t\t\t\t\tawait fs.writeFile(filePath, file.content);\n\t\t\t\t}\n\n\t\t\t\t// Install dependencies.\n\t\t\t\tif (component.dependencies?.length) {\n\t\t\t\t\tawait execa(packageManager, [\n\t\t\t\t\t\tpackageManager === \"npm\" ? \"install\" : \"add\",\n\t\t\t\t\t\t...component.dependencies\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t\tcomponentSpinner.succeed(component.name);\n\t\t\t}\n\t\t});\n\n\tprogram.parse();\n}\n\nasync function promptForComponents(components: Component[]) {\n\tconst { components: selectedComponents } = await prompts({\n\t\ttype: \"autocompleteMultiselect\",\n\t\tname: \"components\",\n\t\tmessage: \"Which component(s) would you like to add?\",\n\t\thint: \"Space to select. A to select all. I to invert selection.\",\n\t\tinstructions: false,\n\t\tchoices: components.map((component) => ({\n\t\t\ttitle: component.name,\n\t\t\tvalue: component\n\t\t}))\n\t});\n\n\treturn selectedComponents;\n}\n\nasync function promptForDestinationDir() {\n\tconst { dir } = await prompts([\n\t\t{\n\t\t\ttype: \"text\",\n\t\t\tname: \"dir\",\n\t\t\tmessage: \"Where would you like to install the component(s)?\",\n\t\t\tinitial: \"./src/lib/components/ui\"\n\t\t}\n\t]);\n\n\treturn dir;\n}\n\nmain();\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport fetch from \"node-fetch\";\nimport * as z from \"zod\";\n\nconst baseUrl = process.env.COMPONENTS_BASE_URL ?? \"https://shadcn-svelte.com\";\n\nconst componentSchema = z.object({\n\tcomponent: z.string(),\n\tname: z.string(),\n\tdependencies: z.array(z.string()).optional(),\n\tfiles: z.array(\n\t\tz.object({\n\t\t\tname: z.string(),\n\t\t\tdir: z.string(),\n\t\t\tcontent: z.string()\n\t\t})\n\t)\n});\n\nexport type Component = z.infer<typeof componentSchema>;\n\nconst componentsSchema = z.array(componentSchema);\n\nexport async function getAvailableComponents() {\n\ttry {\n\t\tconst response = await fetch(`${baseUrl}/api/components`);\n\t\tconst components = await response.json();\n\n\t\treturn componentsSchema.parse(components);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to fetch components from ${baseUrl}/api/components.`\n\t\t);\n\t}\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport path from \"path\";\nimport fs from \"fs-extra\";\nimport { type PackageJson } from \"type-fest\";\n\nexport function getPackageInfo() {\n\tconst packageJsonPath = path.join(\"package.json\");\n\n\treturn fs.readJSONSync(packageJsonPath) as PackageJson;\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nexport function getPackageManager() {\n\tconst userAgent = process.env.npm_config_user_agent;\n\n\tif (!userAgent) {\n\t\treturn \"npm\";\n\t}\n\n\tif (userAgent.startsWith(\"yarn\")) {\n\t\treturn \"yarn\";\n\t}\n\n\tif (userAgent.startsWith(\"pnpm\")) {\n\t\treturn \"pnpm\";\n\t}\n\n\treturn \"npm\";\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport { existsSync } from \"fs\";\nimport path from \"path\";\nimport fs from \"fs-extra\";\n\nexport async function getProjectInfo() {\n\tconst info = {\n\t\ttsconfig: null,\n\t\talias: null,\n\t\tsrcDir: false,\n\t\tappDir: false\n\t};\n\n\ttry {\n\t\tconst tsconfig = await getTsConfig();\n\t\tconst paths = tsconfig?.compilerOptions?.paths;\n\t\tconst alias = paths ? Object.keys(paths)[0].replace(\"*\", \"\") : null;\n\n\t\treturn {\n\t\t\ttsconfig,\n\t\t\talias,\n\t\t\tsrcDir: existsSync(path.resolve(\"./src\")),\n\t\t\tappDir:\n\t\t\t\texistsSync(path.resolve(\"./app\")) ||\n\t\t\t\texistsSync(path.resolve(\"./src/app\"))\n\t\t};\n\t} catch (error) {\n\t\treturn info;\n\t}\n}\n\nexport async function getTsConfig() {\n\ttry {\n\t\tconst tsconfigPath = path.join(\"tsconfig.json\");\n\t\tconst tsconfig = await fs.readJSON(tsconfigPath);\n\n\t\tif (!tsconfig) {\n\t\t\tthrow new Error(\"tsconfig.json is missing\");\n\t\t}\n\n\t\treturn tsconfig;\n\t} catch (error) {\n\t\treturn null;\n\t}\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport chalk from \"chalk\";\n\nexport const logger = {\n\terror(...args: unknown[]) {\n\t\tconsole.log(chalk.red(...args));\n\t},\n\twarn(...args: unknown[]) {\n\t\tconsole.log(chalk.yellow(...args));\n\t},\n\tinfo(...args: unknown[]) {\n\t\tconsole.log(chalk.cyan(...args));\n\t},\n\tsuccess(...args: unknown[]) {\n\t\tconsole.log(chalk.green(...args));\n\t}\n};\n","export const STYLES = `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n \n@layer base {\n :root {\n --background: 0 0% 100%;\n --foreground: 222.2 47.4% 11.2%;\n \n --muted: 210 40% 96.1%;\n --muted-foreground: 215.4 16.3% 46.9%;\n \n --popover: 0 0% 100%;\n --popover-foreground: 222.2 47.4% 11.2%;\n \n --card: 0 0% 100%;\n --card-foreground: 222.2 47.4% 11.2%;\n \n --border: 214.3 31.8% 91.4%;\n --input: 214.3 31.8% 91.4%;\n \n --primary: 222.2 47.4% 11.2%;\n --primary-foreground: 210 40% 98%;\n \n --secondary: 210 40% 96.1%;\n --secondary-foreground: 222.2 47.4% 11.2%;\n \n --accent: 210 40% 96.1%;\n --accent-foreground: 222.2 47.4% 11.2%;\n \n --destructive: 0 100% 50%;\n --destructive-foreground: 210 40% 98%;\n \n --ring: 215 20.2% 65.1%;\n \n --radius: 0.5rem;\n }\n \n .dark {\n --background: 224 71% 4%;\n --foreground: 213 31% 91%;\n \n --muted: 223 47% 11%;\n --muted-foreground: 215.4 16.3% 56.9%;\n \n --popover: 224 71% 4%;\n --popover-foreground: 215 20.2% 65.1%;\n \n --card: 224 71% 4%;\n --card-foreground: 213 31% 91%;\n \n --border: 216 34% 17%;\n --input: 216 34% 17%;\n \n --primary: 210 40% 98%;\n --primary-foreground: 222.2 47.4% 1.2%;\n \n --secondary: 222.2 47.4% 11.2%;\n --secondary-foreground: 210 40% 98%;\n \n --accent: 216 34% 17%;\n --accent-foreground: 210 40% 98%;\n \n --destructive: 0 63% 31%;\n --destructive-foreground: 210 40% 98%;\n \n --ring: 216 34% 17%;\n \n --radius: 0.5rem;\n }\n}\n \n@layer base {\n * {\n @apply border-border;\n }\n body {\n @apply bg-background text-foreground;\n font-feature-settings: \"rlig\" 1, \"calt\" 1;\n }\n}`;\n\nexport const UTILS = `import { ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n \nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n`;\n\nexport const TAILWIND_CONFIG = `const { fontFamily } = require(\"tailwindcss/defaultTheme\")\n/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n darkMode: [\"class\"],\n content: [\"./src/**/*.{html,js,svelte,ts}\"],\n theme: {\n container: {\n center: true,\n padding: \"2rem\",\n screens: {\n \"2xl\": \"1400px\",\n },\n },\n extend: {\n colors: {\n border: \"hsl(var(--border))\",\n input: \"hsl(var(--input))\",\n ring: \"hsl(var(--ring))\",\n background: \"hsl(var(--background))\",\n foreground: \"hsl(var(--foreground))\",\n primary: {\n DEFAULT: \"hsl(var(--primary))\",\n foreground: \"hsl(var(--primary-foreground))\",\n },\n secondary: {\n DEFAULT: \"hsl(var(--secondary))\",\n foreground: \"hsl(var(--secondary-foreground))\",\n },\n destructive: {\n DEFAULT: \"hsl(var(--destructive))\",\n foreground: \"hsl(var(--destructive-foreground))\",\n },\n muted: {\n DEFAULT: \"hsl(var(--muted))\",\n foreground: \"hsl(var(--muted-foreground))\",\n },\n accent: {\n DEFAULT: \"hsl(var(--accent))\",\n foreground: \"hsl(var(--accent-foreground))\",\n },\n popover: {\n DEFAULT: \"hsl(var(--popover))\",\n foreground: \"hsl(var(--popover-foreground))\",\n },\n card: {\n DEFAULT: \"hsl(var(--card))\",\n foreground: \"hsl(var(--card-foreground))\",\n },\n },\n borderRadius: {\n lg: \"var(--radius)\",\n md: \"calc(var(--radius) - 2px)\",\n sm: \"calc(var(--radius) - 4px)\",\n },\n fontFamily: {\n sans: [...fontFamily.sans]\n }\n }\n },\n plugins: [require(\"tailwindcss-animate\")],\n}`;\n\nexport const SVELTE_CONFIG = `import adapter from '@sveltejs/adapter-auto';\nimport { vitePreprocess } from '@sveltejs/kit/vite';\n\n/** @type {import('@sveltejs/kit').Config} */\nconst config = {\n // Consult https://kit.svelte.dev/docs/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.\n // If your environment is not supported or you settled on a specific environment, switch out the adapter.\n // See https://kit.svelte.dev/docs/adapters for more information about adapters.\n adapter: adapter(),\n alias: {\n $components: \"src/lib/components\",\n \"$components/*\": \"src/lib/components/*\"\n }\n }\n};\n\nexport default config;`;\n"],"mappings":";;;AAEA,SAAS,cAAAA,aAAY,YAAYC,WAAU;AAC3C,OAAOC,WAAU;AACjB,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,OAAO,SAAS;AAChB,OAAO,aAAa;;;ACLpB,OAAO,WAAW;AAClB,YAAY,OAAO;AAEnB,IAAM,UAAU,QAAQ,IAAI,uBAAuB;AAEnD,IAAM,kBAAoB,SAAO;AAAA,EAChC,WAAa,SAAO;AAAA,EACpB,MAAQ,SAAO;AAAA,EACf,cAAgB,QAAQ,SAAO,CAAC,EAAE,SAAS;AAAA,EAC3C,OAAS;AAAA,IACN,SAAO;AAAA,MACR,MAAQ,SAAO;AAAA,MACf,KAAO,SAAO;AAAA,MACd,SAAW,SAAO;AAAA,IACnB,CAAC;AAAA,EACF;AACD,CAAC;AAID,IAAM,mBAAqB,QAAM,eAAe;AAEhD,eAAsB,yBAAyB;AAC9C,MAAI;AACH,UAAM,WAAW,MAAM,MAAM,GAAG,wBAAwB;AACxD,UAAM,aAAa,MAAM,SAAS,KAAK;AAEvC,WAAO,iBAAiB,MAAM,UAAU;AAAA,EACzC,SAAS,OAAP;AACD,UAAM,IAAI;AAAA,MACT,mCAAmC;AAAA,IACpC;AAAA,EACD;AACD;;;ACjCA,OAAO,UAAU;AACjB,OAAO,QAAQ;AAGR,SAAS,iBAAiB;AAChC,QAAM,kBAAkB,KAAK,KAAK,cAAc;AAEhD,SAAO,GAAG,aAAa,eAAe;AACvC;;;ACRO,SAAS,oBAAoB;AACnC,QAAM,YAAY,QAAQ,IAAI;AAE9B,M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AAS,EAAE,MAAM;AAG3D,iBAAW,QAAQ,UAAU,OAAO;AAEnC,YAAI,aAAa,OAAO;AACvB,eAAK,UAAU,KAAK,QAAQ;AAAA,YAC3B;AAAA,YACA,YAAY;AAAA,UACb;AAAA,QACD;AACA,cAAM,UAAUE,MAAK,KAAK,KAAK,KAAK,GAAG;AACvC,cAAMF,IAAG,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AAC3C,cAAM,WAAWE,MAAK,QAAQ,SAAS,KAAK,IAAI;AAChD,cAAMF,IAAG,UAAU,UAAU,KAAK,OAAO;AAAA,MAC1C;AAGA,UAAI,UAAU,cAAc,QAAQ;AACnC,cAAM,MAAM,gBAAgB;AAAA,UAC3B,mBAAmB,QAAQ,YAAY;AAAA,UACvC,GAAG,UAAU;AAAA,QACd,CAAC;AAAA,MACF;AACA,uBAAiB,QAAQ,UAAU,IAAI;AAAA,IACxC;AAAA,EACD,CAAC;AAEF,UAAQ,MAAM;AACf;AAEA,eAAe,oBAAoB,YAAyB;AAC3D,QAAM,EAAE,YAAY,mBAAmB,IAAI,MAAM,QAAQ;AAAA,IACxD,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,IACN,cAAc;AAAA,IACd,SAAS,WAAW,IAAI,CAAC,eAAe;AAAA,MACvC,OAAO,UAAU;AAAA,MACjB,OAAO;AAAA,IACR,EAAE;AAAA,EACH,CAAC;AAED,SAAO;AACR;AAEA,eAAe,0BAA0B;AACxC,QAAM,EAAE,IAAI,IAAI,MAAM,QAAQ;AAAA,IAC7B;AAAA,MACC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IACV;AAAA,EACD,CAAC;AAED,SAAO;AACR;AAEA,KAAK;","names":["existsSync","fs","path","path","fs","fs","existsSync","path"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/get-components.ts","../src/utils/get-package-info.ts","../src/utils/get-package-manager.ts","../src/utils/get-project-info.ts","../src/utils/logger.ts","../src/utils/templates.ts"],"sourcesContent":["#!/usr/bin/env node\n// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\nimport { existsSync, promises as fs } from \"fs\";\nimport path from \"path\";\nimport { Command } from \"commander\";\nimport { execa } from \"execa\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport { Component, getAvailableComponents } from \"./utils/get-components\";\nimport { getPackageInfo } from \"./utils/get-package-info\";\nimport { getPackageManager } from \"./utils/get-package-manager\";\nimport { getProjectInfo } from \"./utils/get-project-info\";\nimport { logger } from \"./utils/logger\";\nimport { STYLES, TAILWIND_CONFIG, UTILS } from \"./utils/templates\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nconst PROJECT_DEPENDENCIES = [\n\t\"tailwindcss-animate\",\n\t\"class-variance-authority\",\n\t\"clsx\",\n\t\"tailwind-merge\",\n\t\"lucide-svelte\"\n];\n\nasync function main() {\n\tconst packageInfo = getPackageInfo();\n\tconst projectInfo = await getProjectInfo();\n\tconst packageManager = getPackageManager();\n\n\tconst program = new Command()\n\t\t.name(\"shadcn-svelte\")\n\t\t.description(\"Add shadcn-svelte components to your project\")\n\t\t.version(\n\t\t\tpackageInfo.version || \"1.0.0\",\n\t\t\t\"-v, --version\",\n\t\t\t\"display the version number\"\n\t\t);\n\n\tprogram\n\t\t.command(\"init\")\n\t\t.description(\"Configure your SvelteKit project.\")\n\t\t.option(\"-y, --yes\", \"Skip confirmation prompt.\")\n\t\t.action(async (options) => {\n\t\t\tlogger.warn(\n\t\t\t\t\"This command assumes a SvelteKit project with TypeScript and Tailwind CSS.\"\n\t\t\t);\n\t\t\tlogger.warn(\n\t\t\t\t\"If you don't have these, follow the manual steps at https://ui.shadcn.com/docs/installation.\"\n\t\t\t);\n\t\t\tlogger.warn(\"\");\n\n\t\t\tif (!options.yes) {\n\t\t\t\tconst { proceed } = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"proceed\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Running this command will install dependencies and overwrite your existing tailwind.config.cjs. Proceed?\",\n\t\t\t\t\tinitial: true\n\t\t\t\t});\n\n\t\t\t\tif (!proceed) {\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Install dependencies.\n\t\t\tconst dependenciesSpinner = ora(\n\t\t\t\t`Installing dependencies...`\n\t\t\t).start();\n\t\t\tawait execa(packageManager, [\n\t\t\t\tpackageManager === \"npm\" ? \"install\" : \"add\",\n\t\t\t\t...PROJECT_DEPENDENCIES\n\t\t\t]);\n\t\t\tdependenciesSpinner.succeed();\n\n\t\t\t// Update styles\n\t\t\tlet stylesDestination = \"./src/app.postcss\";\n\n\t\t\tconst stylesSpinner = ora(\n\t\t\t\t`Adding styles with CSS variables...`\n\t\t\t).start();\n\t\t\tawait fs.writeFile(stylesDestination, STYLES, \"utf8\");\n\t\t\tstylesSpinner.succeed();\n\n\t\t\t// Ensure lib directory exists.\n\t\t\tconst libDir = \"./src/lib\";\n\t\t\tif (!existsSync(path.resolve(libDir))) {\n\t\t\t\tawait fs.mkdir(path.resolve(libDir), { recursive: true });\n\t\t\t}\n\n\t\t\t// Create lib/utils.ts\n\t\t\tconst utilsDestination = \"./src/lib/utils.ts\";\n\n\t\t\tconst utilsSpinner = ora(`Adding utils...`).start();\n\t\t\tawait fs.writeFile(utilsDestination, UTILS, \"utf8\");\n\t\t\tutilsSpinner.succeed();\n\n\t\t\t// Update tailwind.config.cjs\n\t\t\tconst tailwindDestination = \"./tailwind.config.cjs\";\n\t\t\tconst tailwindSpinner = ora(\n\t\t\t\t`Updating tailwind.config.cjs...`\n\t\t\t).start();\n\t\t\tawait fs.writeFile(tailwindDestination, TAILWIND_CONFIG, \"utf8\");\n\t\t\ttailwindSpinner.succeed();\n\t\t});\n\n\tprogram\n\t\t.command(\"add\")\n\t\t.description(\"add components to your project\")\n\t\t.argument(\"[components...]\", \"name of components\")\n\t\t.action(async (components: string[]) => {\n\t\t\tlogger.warn(\n\t\t\t\t\"Running the following command will overwrite existing files.\"\n\t\t\t);\n\t\t\tlogger.warn(\n\t\t\t\t\"Make sure you have committed your changes before proceeding.\"\n\t\t\t);\n\t\t\tlogger.warn(\"\");\n\n\t\t\tconst availableComponents = await getAvailableComponents();\n\n\t\t\tif (!availableComponents?.length) {\n\t\t\t\tlogger.error(\n\t\t\t\t\t\"An error occurred while fetching components. Please try again.\"\n\t\t\t\t);\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tlet selectedComponents = availableComponents.filter((component) =>\n\t\t\t\tcomponents.includes(component.component)\n\t\t\t);\n\n\t\t\tif (!selectedComponents?.length) {\n\t\t\t\tselectedComponents = await promptForComponents(\n\t\t\t\t\tavailableComponents\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst dir = await promptForDestinationDir();\n\n\t\t\tif (!selectedComponents?.length) {\n\t\t\t\tlogger.warn(\"No components selected. Nothing to install.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\t// Create componentPath directory if it doesn't exist.\n\t\t\tconst destinationDir = path.resolve(dir);\n\t\t\tif (!existsSync(destinationDir)) {\n\t\t\t\tconst spinner = ora(`Creating ${dir}...`).start();\n\t\t\t\tawait fs.mkdir(destinationDir, { recursive: true });\n\t\t\t\tspinner.succeed();\n\t\t\t}\n\n\t\t\tlogger.success(\n\t\t\t\t`Installing ${selectedComponents.length} component(s) and dependencies...`\n\t\t\t);\n\t\t\tfor (const component of selectedComponents) {\n\t\t\t\tconst componentSpinner = ora(`${component.name}...`).start();\n\n\t\t\t\t// Write the files.\n\t\t\t\tfor (const file of component.files) {\n\t\t\t\t\t// Replace alias with the project's alias.\n\t\t\t\t\tif (projectInfo?.alias) {\n\t\t\t\t\t\tfile.content = file.content.replace(\n\t\t\t\t\t\t\t/$\\//g,\n\t\t\t\t\t\t\tprojectInfo.alias\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst dirPath = path.join(dir, file.dir);\n\t\t\t\t\tawait fs.mkdir(dirPath, { recursive: true });\n\t\t\t\t\tconst filePath = path.resolve(dirPath, file.name);\n\t\t\t\t\tawait fs.writeFile(filePath, file.content);\n\t\t\t\t}\n\n\t\t\t\t// Install dependencies.\n\t\t\t\tif (component.dependencies?.length) {\n\t\t\t\t\tawait execa(packageManager, [\n\t\t\t\t\t\tpackageManager === \"npm\" ? \"install\" : \"add\",\n\t\t\t\t\t\t...component.dependencies\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t\tcomponentSpinner.succeed(component.name);\n\t\t\t}\n\t\t});\n\n\tprogram.parse();\n}\n\nasync function promptForComponents(components: Component[]) {\n\tconst { components: selectedComponents } = await prompts({\n\t\ttype: \"autocompleteMultiselect\",\n\t\tname: \"components\",\n\t\tmessage: \"Which component(s) would you like to add?\",\n\t\thint: \"Space to select. A to select all. I to invert selection.\",\n\t\tinstructions: false,\n\t\tchoices: components.map((component) => ({\n\t\t\ttitle: component.name,\n\t\t\tvalue: component\n\t\t}))\n\t});\n\n\treturn selectedComponents;\n}\n\nasync function promptForDestinationDir() {\n\tconst { dir } = await prompts([\n\t\t{\n\t\t\ttype: \"text\",\n\t\t\tname: \"dir\",\n\t\t\tmessage: \"Where would you like to install the component(s)?\",\n\t\t\tinitial: \"./src/lib/components/ui\"\n\t\t}\n\t]);\n\n\treturn dir;\n}\n\nmain();\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport fetch from \"node-fetch\";\nimport * as z from \"zod\";\n\nconst baseUrl = process.env.COMPONENTS_BASE_URL ?? \"https://shadcn-svelte.com\";\n\nconst componentSchema = z.object({\n\tcomponent: z.string(),\n\tname: z.string(),\n\tdependencies: z.array(z.string()).optional(),\n\tfiles: z.array(\n\t\tz.object({\n\t\t\tname: z.string(),\n\t\t\tdir: z.string(),\n\t\t\tcontent: z.string()\n\t\t})\n\t)\n});\n\nexport type Component = z.infer<typeof componentSchema>;\n\nconst componentsSchema = z.array(componentSchema);\n\nexport async function getAvailableComponents() {\n\ttry {\n\t\tconst response = await fetch(`${baseUrl}/api/components`);\n\t\tconst components = await response.json();\n\n\t\treturn componentsSchema.parse(components);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to fetch components from ${baseUrl}/api/components.`\n\t\t);\n\t}\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport path from \"path\";\nimport fs from \"fs-extra\";\nimport { type PackageJson } from \"type-fest\";\n\nexport function getPackageInfo() {\n\tconst packageJsonPath = path.join(\"package.json\");\n\n\treturn fs.readJSONSync(packageJsonPath) as PackageJson;\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nexport function getPackageManager() {\n\tconst userAgent = process.env.npm_config_user_agent;\n\n\tif (!userAgent) {\n\t\treturn \"npm\";\n\t}\n\n\tif (userAgent.startsWith(\"yarn\")) {\n\t\treturn \"yarn\";\n\t}\n\n\tif (userAgent.startsWith(\"pnpm\")) {\n\t\treturn \"pnpm\";\n\t}\n\n\treturn \"npm\";\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport { existsSync } from \"fs\";\nimport path from \"path\";\nimport fs from \"fs-extra\";\n\nexport async function getProjectInfo() {\n\tconst info = {\n\t\ttsconfig: null,\n\t\talias: null\n\t};\n\n\ttry {\n\t\tconst tsconfig = await getTsConfig();\n\t\tconst paths = tsconfig?.compilerOptions?.paths;\n\t\tconst alias = paths ? Object.keys(paths)[0].replace(\"*\", \"\") : null;\n\n\t\treturn {\n\t\t\ttsconfig,\n\t\t\talias,\n\t\t\tsrcDir: existsSync(path.resolve(\"./src\")),\n\t\t\tappDir:\n\t\t\t\texistsSync(path.resolve(\"./app\")) ||\n\t\t\t\texistsSync(path.resolve(\"./src/app\"))\n\t\t};\n\t} catch (error) {\n\t\treturn info;\n\t}\n}\n\nexport async function getTsConfig() {\n\ttry {\n\t\tconst tsconfigPath = path.join(\"tsconfig.json\");\n\t\tconst tsconfig = await fs.readJSON(tsconfigPath);\n\n\t\tif (!tsconfig) {\n\t\t\tthrow new Error(\"tsconfig.json is missing\");\n\t\t}\n\n\t\treturn tsconfig;\n\t} catch (error) {\n\t\treturn null;\n\t}\n}\n","// Credit to @shadcn for the original code. It has been slightly modified to fit the needs of this project.\n\nimport chalk from \"chalk\";\n\nexport const logger = {\n\terror(...args: unknown[]) {\n\t\tconsole.log(chalk.red(...args));\n\t},\n\twarn(...args: unknown[]) {\n\t\tconsole.log(chalk.yellow(...args));\n\t},\n\tinfo(...args: unknown[]) {\n\t\tconsole.log(chalk.cyan(...args));\n\t},\n\tsuccess(...args: unknown[]) {\n\t\tconsole.log(chalk.green(...args));\n\t}\n};\n","export const STYLES = `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n \n@layer base {\n :root {\n --background: 0 0% 100%;\n --foreground: 222.2 47.4% 11.2%;\n \n --muted: 210 40% 96.1%;\n --muted-foreground: 215.4 16.3% 46.9%;\n \n --popover: 0 0% 100%;\n --popover-foreground: 222.2 47.4% 11.2%;\n \n --card: 0 0% 100%;\n --card-foreground: 222.2 47.4% 11.2%;\n \n --border: 214.3 31.8% 91.4%;\n --input: 214.3 31.8% 91.4%;\n \n --primary: 222.2 47.4% 11.2%;\n --primary-foreground: 210 40% 98%;\n \n --secondary: 210 40% 96.1%;\n --secondary-foreground: 222.2 47.4% 11.2%;\n \n --accent: 210 40% 96.1%;\n --accent-foreground: 222.2 47.4% 11.2%;\n \n --destructive: 0 100% 50%;\n --destructive-foreground: 210 40% 98%;\n \n --ring: 215 20.2% 65.1%;\n \n --radius: 0.5rem;\n }\n \n .dark {\n --background: 224 71% 4%;\n --foreground: 213 31% 91%;\n \n --muted: 223 47% 11%;\n --muted-foreground: 215.4 16.3% 56.9%;\n \n --popover: 224 71% 4%;\n --popover-foreground: 215 20.2% 65.1%;\n \n --card: 224 71% 4%;\n --card-foreground: 213 31% 91%;\n \n --border: 216 34% 17%;\n --input: 216 34% 17%;\n \n --primary: 210 40% 98%;\n --primary-foreground: 222.2 47.4% 1.2%;\n \n --secondary: 222.2 47.4% 11.2%;\n --secondary-foreground: 210 40% 98%;\n \n --accent: 216 34% 17%;\n --accent-foreground: 210 40% 98%;\n \n --destructive: 360 62% 55%;\n --destructive-foreground: 210 40% 98%;\n \n --ring: 216 34% 17%;\n \n --radius: 0.5rem;\n }\n}\n \n@layer base {\n * {\n @apply border-border;\n }\n body {\n @apply bg-background text-foreground;\n font-feature-settings: \"rlig\" 1, \"calt\" 1;\n }\n}`;\n\nexport const UTILS = `import { ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n \nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n`;\n\nexport const TAILWIND_CONFIG = `const { fontFamily } = require(\"tailwindcss/defaultTheme\")\n/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n darkMode: [\"class\"],\n content: [\"./src/**/*.{html,js,svelte,ts}\"],\n theme: {\n container: {\n center: true,\n padding: \"2rem\",\n screens: {\n \"2xl\": \"1400px\",\n },\n },\n extend: {\n colors: {\n border: \"hsl(var(--border))\",\n input: \"hsl(var(--input))\",\n ring: \"hsl(var(--ring))\",\n background: \"hsl(var(--background))\",\n foreground: \"hsl(var(--foreground))\",\n primary: {\n DEFAULT: \"hsl(var(--primary))\",\n foreground: \"hsl(var(--primary-foreground))\",\n },\n secondary: {\n DEFAULT: \"hsl(var(--secondary))\",\n foreground: \"hsl(var(--secondary-foreground))\",\n },\n destructive: {\n DEFAULT: \"hsl(var(--destructive))\",\n foreground: \"hsl(var(--destructive-foreground))\",\n },\n muted: {\n DEFAULT: \"hsl(var(--muted))\",\n foreground: \"hsl(var(--muted-foreground))\",\n },\n accent: {\n DEFAULT: \"hsl(var(--accent))\",\n foreground: \"hsl(var(--accent-foreground))\",\n },\n popover: {\n DEFAULT: \"hsl(var(--popover))\",\n foreground: \"hsl(var(--popover-foreground))\",\n },\n card: {\n DEFAULT: \"hsl(var(--card))\",\n foreground: \"hsl(var(--card-foreground))\",\n },\n },\n borderRadius: {\n lg: \"var(--radius)\",\n md: \"calc(var(--radius) - 2px)\",\n sm: \"calc(var(--radius) - 4px)\",\n },\n fontFamily: {\n sans: [...fontFamily.sans]\n }\n }\n },\n plugins: [require(\"tailwindcss-animate\")],\n}`;\n\nexport const SVELTE_CONFIG = `import adapter from '@sveltejs/adapter-auto';\nimport { vitePreprocess } from '@sveltejs/kit/vite';\n\n/** @type {import('@sveltejs/kit').Config} */\nconst config = {\n // Consult https://kit.svelte.dev/docs/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.\n // If your environment is not supported or you settled on a specific environment, switch out the adapter.\n // See https://kit.svelte.dev/docs/adapters for more information about adapters.\n adapter: adapter(),\n alias: {\n $components: \"src/lib/components\",\n \"$components/*\": \"src/lib/components/*\"\n }\n }\n};\n\nexport default config;`;\n"],"mappings":";;;AAEA,SAAS,cAAAA,aAAY,YAAYC,WAAU;AAC3C,OAAOC,WAAU;AACjB,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,OAAO,SAAS;AAChB,OAAO,aAAa;;;ACLpB,OAAO,WAAW;AAClB,YAAY,OAAO;AAEnB,IAAM,UAAU,QAAQ,IAAI,uBAAuB;AAEnD,IAAM,kBAAoB,SAAO;AAAA,EAChC,WAAa,SAAO;AAAA,EACpB,MAAQ,SAAO;AAAA,EACf,cAAgB,QAAQ,SAAO,CAAC,EAAE,SAAS;AAAA,EAC3C,OAAS;AAAA,IACN,SAAO;AAAA,MACR,MAAQ,SAAO;AAAA,MACf,KAAO,SAAO;AAAA,MACd,SAAW,SAAO;AAAA,IACnB,CAAC;AAAA,EACF;AACD,CAAC;AAID,IAAM,mBAAqB,QAAM,eAAe;AAEhD,eAAsB,yBAAyB;AAC9C,MAAI;AACH,UAAM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