Skip to content

Commit

Permalink
feat: Add flags for init command (#1186)
Browse files Browse the repository at this point in the history
Co-authored-by: Hunter Johnston <64506580+huntabyte@users.noreply.github.com>
Co-authored-by: AdrianGonz97 <31664583+AdrianGonz97@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 18, 2024
1 parent 45f38a6 commit 6c9b9ee
Show file tree
Hide file tree
Showing 15 changed files with 308 additions and 157 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-snails-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn-svelte": minor
---

feat: Added CLI flags for each option for `init`
5 changes: 5 additions & 0 deletions .changeset/rich-onions-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn-svelte": minor
---

feat: Removed TypeScript prompt in favor of auto detection
11 changes: 8 additions & 3 deletions apps/www/src/content/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ npx shadcn-svelte@latest init
You will be asked a few questions to configure `components.json`:

```txt showLineNumbers
Would you like to use TypeScript? (recommended) › Yes
Which style would you like to use? › Default
Which base color would you like to use? › Slate
Where is your global CSS file? (this file will be overwritten) › src/app.css
Expand All @@ -33,8 +32,14 @@ Usage: shadcn-svelte init [options]
initialize your project and install dependencies
Options:
-c, --cwd <cwd> the working directory. (default: the current directory)
-h, --help display help for command
-c, --cwd <cwd> the working directory. defaults to the current directory. (default: the current directory)
--style <name> the style for the components (choices: "default", "new-york")
--base-color <name> the base color for the components (choices: "slate", "gray", "zinc", "neutral", "stone")
--css <path> path to the global CSS file
--tailwind-config <path> path to the tailwind config file
--components-alias <path> import alias for components
--utils-alias <path> import alias for utils
-h, --help display help for command
```

## add
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/content/installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ To opt out of TypeScript, set the `typescript` flag to `false` in your `componen
}
```

To configure import aliases, you need to create a `jsconfig.json`:
To configure import aliases, create a `jsconfig.json` file:

```json {4} title="jsconfig.json"
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build:registry": "pnpm -F www build:registry",
"build:site": "pnpm -F www build",
"dev": "pnpm build:registry && pnpm -F www dev",
"dev:cli": "pnpm -F shadcn-svelte start:dev",
"dev:cli": "pnpm -F shadcn-svelte dev",
"preview": "pnpm -F www preview",
"test": "pnpm -F www test",
"check": "pnpm -F www check",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"tsup": "^8.0.0",
"type-fest": "^3.13.1",
"typescript": "^5.0.0",
"valibot": "^0.30.0",
"valibot": "^0.36.0",
"vitest": "^0.34.6"
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const addOptionsSchema = v.object({
proxy: v.optional(v.string()),
});

type AddOptions = v.Output<typeof addOptionsSchema>;
type AddOptions = v.InferOutput<typeof addOptionsSchema>;

export const add = new Command()
.command("add")
Expand Down
Loading

0 comments on commit 6c9b9ee

Please sign in to comment.