create-shadcn-js 0.0.0-stage → 1.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Skandan-V
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,247 @@
1
- # Temporary Holding Version
1
+ # create-shadcn-js
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > Scaffold a fully configured **Vite + React (JavaScript) + Tailwind CSS + shadcn/ui** project in seconds — zero manual setup, zero config headaches.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/create-shadcn-js.svg?style=flat-square)](https://www.npmjs.com/package/create-shadcn-js)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
7
+
8
+ ---
9
+
10
+ ## Why create-shadcn-js?
11
+
12
+ The official `shadcn` CLI focuses on TypeScript projects. Building with **JavaScript / JSX** normally means doing the same manual setup every time:
13
+
14
+ 1. **Creating `jsconfig.json`** with `baseUrl` and `@/*` paths so your editor and the shadcn CLI can resolve imports.
15
+ 2. **Updating `vite.config.js`** with `path.resolve` and the `@` path alias.
16
+ 3. **Installing and configuring Tailwind CSS** — v4 with `@tailwindcss/vite` and `@import "tailwindcss";`, or v3 with `tailwind.config.js` and `postcss.config.js`.
17
+ 4. **Purging default Vite boilerplate** (conflicting `App.css` styles and assets).
18
+ 5. **Configuring `components.json`** with `"tsx": false` so shadcn generates `.jsx` components and `utils.js` instead of TypeScript.
19
+
20
+ `create-shadcn-js` handles all of this automatically with an interactive CLI powered by [`@clack/prompts`](https://github.com/natemoo-re/clack).
21
+
22
+ ---
23
+
24
+ ## Prerequisites
25
+
26
+ - **Node.js `^20.19.0` or `>=22.12.0`** (required by the Vite 8 scaffold).
27
+ - `npm`, `pnpm`, `yarn`, or `bun` on your `PATH`.
28
+ - Network access for `create-vite`, the selected package manager, and the shadcn CLI.
29
+
30
+ ---
31
+
32
+ ## Quick Start
33
+
34
+ Run any of the following in your terminal:
35
+
36
+ ### With `npx`:
37
+ ```bash
38
+ npx create-shadcn-js@latest
39
+ ```
40
+
41
+ ### With `npm`:
42
+ ```bash
43
+ npm create shadcn-js@latest
44
+ ```
45
+
46
+ ### With `pnpm`:
47
+ ```bash
48
+ pnpm create shadcn-js
49
+ ```
50
+
51
+ ### With `bun`:
52
+ ```bash
53
+ bun create shadcn-js
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Features
59
+
60
+ - **Vite + React (JavaScript)**: Fast HMR and production builds from standard `.jsx` files.
61
+ - **Tailwind CSS v4 by default**: Uses `@tailwindcss/vite` and the CSS-first `@import "tailwindcss";` setup.
62
+ - **Tailwind CSS v3 legacy path**: Installs Tailwind 3.4 and the matching shadcn CLI for projects that still need `tailwind.config.js`.
63
+ - **Seamless shadcn/ui integration (v4)**: Hands off to the official `shadcn@4` init flow so you can choose your primitive library (**Base UI**, **Radix UI**, or **React Aria**), style preset (**Nova**, **Vega**, etc.), and colors.
64
+ - **Auto-configured path aliases**: Generates `jsconfig.json` and updates `vite.config.js` with the `@/*` mapping.
65
+ - **JavaScript-first output**: Forces `components.json` to `"tsx": false` and verifies that `src/lib/utils.js` exists.
66
+ - **Clean slate**: Removes conflicting Vite boilerplate and writes a responsive `index.html` with the Geist font.
67
+ - **Optional starter demo**: Installs a `Button` component and an interactive dark/light mode showcase in `src/App.jsx`.
68
+ - **Non-zero exit on real failures**: If shadcn init does not produce a usable `components.json`, the CLI fails instead of printing a false “Project ready”.
69
+
70
+ ---
71
+
72
+ ## CLI Usage & Options
73
+
74
+ You can specify the project name directly or pass command-line options:
75
+
76
+ ```bash
77
+ npx create-shadcn-js [project-name] [options]
78
+ ```
79
+
80
+ ### Options:
81
+
82
+ | Flag | Description | Default |
83
+ | --- | --- | --- |
84
+ | `[project-name]` | Name of the project directory to create | Prompted (`my-shadcn-app`) |
85
+ | `--pm <manager>` | Package manager to use (`npm`, `pnpm`, `yarn`, `bun`) | Auto-detected |
86
+ | `-t, --tailwind <v>` | Tailwind version (`v4` or `v3`) | `v4` |
87
+ | `-m, --mode <mode>` | shadcn init mode (`interactive` or `quickstart`). v4 only | `interactive` |
88
+ | `-b, --base <base>` | Component library (`base`, `radix`, `aria`). v4 only | User selection |
89
+ | `-p, --preset <preset>` | Style preset (`nova`, `vega`, `maia`, etc.). v4 only | User selection |
90
+ | `-y, --yes` | Skip interactive prompts and use recommended defaults. Fails on a non-empty target unless `--force` is also set | `false` |
91
+ | `-f, --force` | Overwrite an existing directory without confirmation | `false` |
92
+ | `--no-sample` | Skip the starter Button component and demo | `false` |
93
+ | `--no-git` | Skip initializing a Git repository | `false` |
94
+ | `-v, --version` | Output the CLI version | — |
95
+ | `-h, --help` | Display the help screen | — |
96
+
97
+ Invalid option values are rejected with a clear error instead of silently falling back to a different setup.
98
+
99
+ ### Examples:
100
+
101
+ #### 1. Interactive Wizard (Recommended)
102
+ ```bash
103
+ npx create-shadcn-js
104
+ ```
105
+
106
+ #### 2. Create in a Specific Directory
107
+ ```bash
108
+ npx create-shadcn-js my-dashboard
109
+ ```
110
+
111
+ #### 3. Quick Non-Interactive Setup (Fast CI / Demo)
112
+ ```bash
113
+ npx create-shadcn-js my-app -y
114
+ ```
115
+
116
+ #### 4. Custom Preset with pnpm and Tailwind v4
117
+ ```bash
118
+ npx create-shadcn-js my-app --pm pnpm --base radix --preset nova -y
119
+ ```
120
+
121
+ #### 5. Tailwind CSS v3 (Legacy)
122
+ ```bash
123
+ npx create-shadcn-js my-app --tailwind v3 -y
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Tailwind CSS v3 (Legacy)
129
+
130
+ Tailwind v3 needs the legacy `shadcn@2.3.0` CLI, which predates the v4 preset system. The v3 path is intentionally fixed so it stays reproducible:
131
+
132
+ - **Tailwind CSS `3.4.17`** with `postcss` and `autoprefixer`.
133
+ - **React `18.3.1`** (the legacy shadcn CLI installs non-interactively on React 18).
134
+ - **shadcn `2.3.0`** with the **`new-york`** style and **zinc** base color.
135
+ - A scaffold-owned `tailwind.config.js`, `postcss.config.js`, `components.json`, HSL theme variables, and `src/lib/utils.js`.
136
+
137
+ `--mode`, `--base`, and `--preset` do not apply to Tailwind v3 and are ignored (`--base` and `--preset` also emit a warning). Use Tailwind v4 if you want the interactive library/preset picker.
138
+
139
+ ---
140
+
141
+ ## What the Generated Project Looks Like
142
+
143
+ ### Tailwind v4 (default)
144
+
145
+ ```
146
+ my-shadcn-app/
147
+ ├── index.html # Viewport, Geist font, clean body classes
148
+ ├── jsconfig.json # {"paths": {"@/*": ["./src/*"]}}
149
+ ├── vite.config.js # React + @tailwindcss/vite + @ alias
150
+ ├── components.json # Written by shadcn, normalized to "tsx": false
151
+ ├── package.json
152
+ ├── src/
153
+ │ ├── components/
154
+ │ │ └── ui/
155
+ │ │ └── button.jsx # (Optional starter component)
156
+ │ ├── lib/
157
+ │ │ └── utils.js # cn() helper
158
+ │ ├── App.jsx # Interactive demo with dark/light toggle
159
+ │ ├── index.css # shadcn theme tokens
160
+ │ └── main.jsx
161
+ ```
162
+
163
+ ### Tailwind v3 (legacy)
164
+
165
+ ```
166
+ my-shadcn-app/
167
+ ├── index.html
168
+ ├── jsconfig.json
169
+ ├── vite.config.js # React + @ alias (PostCSS handles Tailwind)
170
+ ├── tailwind.config.js
171
+ ├── postcss.config.js
172
+ ├── components.json # "tsx": false, "style": "new-york"
173
+ ├── package.json
174
+ ├── src/
175
+ │ ├── components/
176
+ │ │ └── ui/
177
+ │ │ └── button.jsx # (Optional starter component)
178
+ │ ├── lib/
179
+ │ │ └── utils.js # clsx + tailwind-merge cn() helper
180
+ │ ├── App.jsx
181
+ │ ├── index.css # HSL theme variables (@tailwind layers)
182
+ │ └── main.jsx
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Adding More Components
188
+
189
+ `cd` into your project and use the shadcn CLI version that matches your Tailwind setup.
190
+
191
+ ### Tailwind v4
192
+
193
+ ```bash
194
+ cd my-shadcn-app
195
+ npx shadcn@4 add dialog dropdown-menu input card avatar table
196
+ ```
197
+
198
+ With other package managers:
199
+
200
+ ```bash
201
+ pnpm dlx shadcn@4 add dialog
202
+ bunx --bun shadcn@4 add dialog
203
+ yarn dlx shadcn@4 add dialog
204
+ ```
205
+
206
+ ### Tailwind v3 (legacy)
207
+
208
+ ```bash
209
+ cd my-shadcn-app
210
+ npx shadcn@2.3.0 add dialog dropdown-menu input card avatar table
211
+ ```
212
+
213
+ Components are generated as `.jsx` files inside `src/components/ui/` because `components.json` sets `"tsx": false`.
214
+
215
+ ---
216
+
217
+ ## Troubleshooting
218
+
219
+ - **“components.json is missing or invalid”** — the shadcn init step did not finish (usually a network or registry error). Re-run the CLI, or for a v4 project run `npx shadcn@4 init` inside the project.
220
+ - **“index.css is missing theme variables”** — the shadcn init stopped before writing the theme. Re-run the CLI, or add the missing `--background`/`--primary` tokens with `npx shadcn@4 init` inside the project.
221
+ - **A starter component could not be added** — the scaffold still completes, and `src/App.jsx` remains valid. Add the component later with the command printed in the warning.
222
+ - **“Target directory … is not empty” with `-y`** — non-interactive mode never deletes existing files. Re-run with `--force`, or choose a new project name.
223
+ - **`yarn dlx` is unavailable** — Yarn 1 does not support `dlx`; the CLI automatically falls back to `npx`. Newer Berry releases use `yarn dlx`.
224
+
225
+ ---
226
+
227
+ ## Contributing
228
+
229
+ Contributions, issues, and feature requests are welcome!
230
+
231
+ 1. Fork the repository
232
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
233
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
234
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
235
+ 5. Open a Pull Request
236
+
237
+ Run the unit tests with:
238
+
239
+ ```bash
240
+ npm test
241
+ ```
242
+
243
+ ---
244
+
245
+ ## License
246
+
247
+ [MIT](LICENSE) © 2026 create-shadcn-js
package/SECURITY.md ADDED
@@ -0,0 +1,25 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 1.1.x | :white_check_mark: |
8
+ | < 1.1.0 | :x: |
9
+
10
+ ## Supply Chain Security Principles
11
+
12
+ `create-shadcn-js` adheres to strict security standards to ensure package and dependency integrity:
13
+
14
+ 1. **Strict Input Sanitization**: All user inputs (project directory, components, flags, presets, package managers) are strictly validated against strict allowlists and regex patterns to prevent command injection, flag injection, and path traversal vulnerabilities.
15
+ 2. **Zero Arbitrary Execution**: The package does not use `eval`, dynamic require, or shell string interpolation. All child processes use direct argument vector passing via `cross-spawn`.
16
+ 3. **Dependency Integrity**: Dependencies are regularly audited for known CVEs. All dependencies must have verified registry signatures and 0 vulnerabilities reported by `npm audit`.
17
+ 4. **Minimal Surface Area**: Export maps explicitly define public entrypoints, preventing unauthorized file access.
18
+
19
+ ## Reporting a Vulnerability
20
+
21
+ If you discover a security vulnerability in this project:
22
+
23
+ 1. Please do **not** open a public issue.
24
+ 2. Send an email to **skandan.studio4as@gmail.com** with details of the vulnerability, proof of concept, and affected versions.
25
+ 3. You will receive an initial response within 48 hours.
package/bin/cli.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { run } from "../src/index.js"
4
+
5
+ run().catch((error) => {
6
+ console.error(error)
7
+ process.exit(1)
8
+ })
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "create-shadcn-js",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.2.0",
4
+ "description": "Scaffold a Vite + React + shadcn/ui JavaScript project with zero manual configuration.",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-shadcn-js": "bin/cli.js"
8
+ },
9
+ "main": "./src/index.js",
10
+ "exports": {
11
+ ".": "./src/index.js",
12
+ "./package.json": "./package.json"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "src",
17
+ "README.md",
18
+ "LICENSE",
19
+ "SECURITY.md"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "sideEffects": false,
25
+ "scripts": {
26
+ "start": "node ./bin/cli.js",
27
+ "test": "node --test",
28
+ "audit": "npm audit --audit-level=high"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/Skandan-V/create-shadcn-js.git"
33
+ },
34
+ "keywords": [
35
+ "create-shadcn-js",
36
+ "shadcn",
37
+ "shadcn-ui",
38
+ "vite",
39
+ "react",
40
+ "javascript",
41
+ "jsx",
42
+ "tailwind",
43
+ "tailwindcss",
44
+ "cli",
45
+ "scaffold",
46
+ "clack"
47
+ ],
48
+ "author": "Skandan-V <skandan.studio4as@gmail.com>",
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/Skandan-V/create-shadcn-js/issues"
52
+ },
53
+ "homepage": "https://github.com/Skandan-V/create-shadcn-js#readme",
54
+ "engines": {
55
+ "node": "^20.19.0 || >=22.12.0"
56
+ },
57
+ "dependencies": {
58
+ "@clack/prompts": "^0.9.1",
59
+ "commander": "^13.1.0",
60
+ "cross-spawn": "^7.0.6",
61
+ "fs-extra": "^11.3.0",
62
+ "picocolors": "^1.1.1"
63
+ }
64
+ }
package/src/index.js ADDED
@@ -0,0 +1,137 @@
1
+ import path from "node:path"
2
+ import fs from "fs-extra"
3
+ import * as p from "@clack/prompts"
4
+ import pc from "picocolors"
5
+ import { Command } from "commander"
6
+ import { runInteractivePrompts } from "./prompts.js"
7
+ import { scaffoldProject } from "./scaffold.js"
8
+ import { initShadcn, addComponents } from "./shadcn.js"
9
+ import { buildCliOptions } from "./options.js"
10
+ import { runCommandOutput, formatPath, getShadcnAddCommand } from "./utils.js"
11
+
12
+ // Package metadata
13
+ const packageJson = fs.readJsonSync(
14
+ new URL("../package.json", import.meta.url)
15
+ )
16
+
17
+ /**
18
+ * Initializes Git repository in target directory.
19
+ * @param {string} targetDir
20
+ */
21
+ function initializeGit(targetDir) {
22
+ try {
23
+ if (!fs.existsSync(path.join(targetDir, ".git"))) {
24
+ runCommandOutput("git", ["init"], { cwd: targetDir })
25
+ runCommandOutput("git", ["add", "-A"], { cwd: targetDir })
26
+ runCommandOutput("git", ["commit", "-m", "Initial commit from create-shadcn-js"], {
27
+ cwd: targetDir,
28
+ })
29
+ }
30
+ } catch {
31
+ // Non-fatal if Git is not installed or configured
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Builds the Commander program without parsing argv. Exported so tests can
37
+ * assert that options without a default stay undefined (the interactive
38
+ * Tailwind v3 prompt depends on it).
39
+ * @returns {Command}
40
+ */
41
+ export function createProgram() {
42
+ return new Command()
43
+ .name("create-shadcn-js")
44
+ .description("Scaffold a Vite + React + shadcn/ui JavaScript project with zero manual setup")
45
+ .version(packageJson.version, "-v, --version", "Output the current version")
46
+ .argument("[project-name]", "Name of the project directory")
47
+ .option("--pm <manager>", "Package manager to use (npm, pnpm, yarn, bun)")
48
+ .option("-t, --tailwind <version>", "Tailwind CSS version (v4, v3)")
49
+ .option("-m, --mode <mode>", "shadcn init mode (interactive, quickstart)")
50
+ .option("-b, --base <base>", "Component library (base, radix, aria)")
51
+ .option("-p, --preset <preset>", "shadcn preset (nova, vega, maia, etc.)")
52
+ .option("--no-sample", "Skip installing sample components")
53
+ .option("--no-git", "Skip initializing a git repository")
54
+ .option("-y, --yes", "Skip interactive prompts and use defaults")
55
+ .option("-f, --force", "Overwrite existing directory without prompt")
56
+ }
57
+
58
+ /**
59
+ * Main CLI runner.
60
+ */
61
+ export async function run() {
62
+ const program = createProgram()
63
+ program.parse(process.argv)
64
+
65
+ const args = program.args
66
+ const opts = program.opts()
67
+
68
+ try {
69
+ const cliOptions = buildCliOptions(args, opts)
70
+
71
+ // 1. Run interactive prompts (or resolve defaults)
72
+ const answers = await runInteractivePrompts(cliOptions, {
73
+ version: packageJson.version,
74
+ })
75
+
76
+ // 2. Scaffold Vite React JavaScript project with Tailwind and Aliases
77
+ await scaffoldProject({
78
+ projectName: answers.projectName,
79
+ targetDir: answers.targetDir,
80
+ packageManager: answers.packageManager,
81
+ tailwindVersion: answers.tailwindVersion,
82
+ })
83
+
84
+ // 3. Initialize shadcn/ui (custom interactive or quickstart)
85
+ await initShadcn({
86
+ targetDir: answers.targetDir,
87
+ packageManager: answers.packageManager,
88
+ tailwindVersion: answers.tailwindVersion,
89
+ initMode: answers.initMode,
90
+ nonInteractive: cliOptions.yes,
91
+ base: cliOptions.base,
92
+ preset: cliOptions.preset,
93
+ })
94
+
95
+ // 4. Optionally install sample components and starter demo
96
+ if (answers.addSampleComponents) {
97
+ await addComponents({
98
+ targetDir: answers.targetDir,
99
+ packageManager: answers.packageManager,
100
+ tailwindVersion: answers.tailwindVersion,
101
+ components: ["button"],
102
+ })
103
+ }
104
+
105
+ // 5. Optionally initialize Git repository
106
+ if (answers.initGit) {
107
+ initializeGit(answers.targetDir)
108
+ }
109
+
110
+ // 6. Success message and next steps
111
+ const relPath = formatPath(answers.targetDir)
112
+ const cdCmd = relPath === "." ? "" : `cd ${relPath}\n `
113
+ const devCmd =
114
+ answers.packageManager === "npm"
115
+ ? "npm run dev"
116
+ : `${answers.packageManager} dev`
117
+ const addCmd = getShadcnAddCommand(
118
+ answers.packageManager,
119
+ answers.tailwindVersion
120
+ )
121
+
122
+ p.note(
123
+ `${pc.bold("Next steps:")}\n\n` +
124
+ ` ${pc.cyan(cdCmd + devCmd)}\n\n` +
125
+ `${pc.bold("Add shadcn components anytime:")}\n\n` +
126
+ ` ${pc.cyan(addCmd)}`,
127
+ "🎉 Project ready!"
128
+ )
129
+
130
+ p.outro(
131
+ `${pc.green("All set!")} Happy hacking with ${pc.bold("Vite")}, ${pc.bold("JavaScript")}, and ${pc.bold("shadcn/ui")}! 🚀`
132
+ )
133
+ } catch (error) {
134
+ p.cancel(`Error: ${error.message}`)
135
+ process.exit(1)
136
+ }
137
+ }
package/src/options.js ADDED
@@ -0,0 +1,53 @@
1
+ import {
2
+ sanitizeBaseLibrary,
3
+ sanitizeInitMode,
4
+ sanitizePackageManager,
5
+ sanitizePreset,
6
+ sanitizeTailwindVersion,
7
+ validateProjectName,
8
+ } from "./utils.js"
9
+
10
+ /**
11
+ * Validates CLI arguments and normalizes them into the option object used by
12
+ * the prompt layer. Undefined values are intentional: they mean "ask the
13
+ * user" (or, with --yes, "use the non-interactive default").
14
+ *
15
+ * @param {string[]} args
16
+ * @param {Record<string, unknown>} opts
17
+ * @returns {object}
18
+ */
19
+ export function buildCliOptions(args, opts = {}) {
20
+ if (args[0]) {
21
+ const valid = validateProjectName(args[0])
22
+ if (typeof valid === "string") {
23
+ throw new Error(`Invalid project name: ${valid}`)
24
+ }
25
+ }
26
+
27
+ const cliOptions = {
28
+ name: args[0],
29
+ pm: opts.pm ? sanitizePackageManager(opts.pm) : undefined,
30
+ tailwind: opts.tailwind
31
+ ? sanitizeTailwindVersion(opts.tailwind)
32
+ : undefined,
33
+ mode: opts.mode ? sanitizeInitMode(opts.mode) : undefined,
34
+ base: opts.base ? sanitizeBaseLibrary(opts.base) : undefined,
35
+ preset: opts.preset ? sanitizePreset(opts.preset) : undefined,
36
+ sampleComponents: opts.sample === false ? false : undefined,
37
+ git: opts.git === false ? false : undefined,
38
+ force: opts.force || false,
39
+ yes: opts.yes || false,
40
+ }
41
+
42
+ // If -y / --yes is passed, supply defaults for any missing arguments.
43
+ if (cliOptions.yes) {
44
+ cliOptions.name = cliOptions.name || "my-shadcn-app"
45
+ cliOptions.pm = cliOptions.pm || "npm"
46
+ cliOptions.tailwind = cliOptions.tailwind || "v4"
47
+ cliOptions.mode = cliOptions.mode || "quickstart"
48
+ cliOptions.sampleComponents = cliOptions.sampleComponents ?? true
49
+ cliOptions.git = cliOptions.git ?? true
50
+ }
51
+
52
+ return cliOptions
53
+ }