Skip to content

Commit

Permalink
docs: persistent package manager selection (#1257)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Obubelebra Amachree <[email protected]>
Co-authored-by: AdrianGonz97 <[email protected]>
  • Loading branch information
3 people authored Aug 28, 2024
1 parent 35b8ff9 commit e85fa1d
Show file tree
Hide file tree
Showing 65 changed files with 433 additions and 462 deletions.
2 changes: 1 addition & 1 deletion sites/docs/mdsx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function rehypeComponentExample() {

try {
for (const style of styles) {
// @ts-expect-error - this is fine for now.
// @ts-expect-error - this is fine
const component = Index[style.name][name];
const src = component.files[0].replace("/lib/", "/src/lib/");
let sourceCode = getComponentSourceFileContent(src);
Expand Down
16 changes: 7 additions & 9 deletions sites/docs/src/content/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ title: CLI
description: Use the CLI to add components to your project.
---

<script>
import { PMExecute } from '$lib/components/docs'
</script>

## init

Use the `init` command to initialize dependencies for a new project.

The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.cjs`, and creates CSS variables for the project.

```bash
npx shadcn-svelte@latest init
```
<PMExecute command="shadcn-svelte@latest init" />

You will be asked a few questions to configure `components.json`:

Expand Down Expand Up @@ -47,9 +49,7 @@ Options:

Use the `add` command to add components and dependencies to your project.

```bash
npx shadcn-svelte@latest add [component]
```
<PMExecute command="shadcn-svelte@latest add [component]" />

You will be presented with a list of components to choose from:

Expand Down Expand Up @@ -93,9 +93,7 @@ Options:

Use the `update` command to update components in your project. This will overwrite any modifications you've made to the components, so be sure to commit your changes before running this command.

```bash
npx shadcn-svelte@latest update [component]
```
<PMExecute command="shadcn-svelte@latest update [component]" />

### Options

Expand Down
6 changes: 2 additions & 4 deletions sites/docs/src/content/components-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Configuration for your project.
---

<script>
import { Callout, ComponentPreview } from '$lib/components/docs'
import { Callout, ComponentPreview, PMExecute } from '$lib/components/docs'
</script>

The `components.json` file holds configuration for your project.
Expand All @@ -19,9 +19,7 @@ We use it to understand how your project is set up and how to generate component

You can create a `components.json` file in your project by running the following command:

```bash
npx shadcn-svelte@latest init
```
<PMExecute command="shadcn-svelte@latest init" />

See the [CLI section](/docs/cli) for more information.

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/accordion.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/accordion
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="accordion-demo" class="[&_[data-melt-accordion]]:sm:max-w-[70%]">
Expand All @@ -18,17 +18,13 @@ bits: https://www.bits-ui.com/docs/components/accordion

## Installation

```bash
npx shadcn-svelte@latest add accordion
```
<PMAddComp name="accordion" />

<ManualInstall>

1. Install `bits-ui`:

```bash
npm install bits-ui
```
<PMInstall command="bits-ui" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/alert-dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bits: https://www.bits-ui.com/docs/components/alert-dialog
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="alert-dialog-demo">
Expand All @@ -19,17 +19,13 @@ bits: https://www.bits-ui.com/docs/components/alert-dialog

## Installation

```bash
npx shadcn-svelte@latest add alert-dialog
```
<PMAddComp name="alert-dialog" />

<ManualInstall>

1. Install `bits-ui`:

```bash
npm install bits-ui
```
<PMInstall command="bits-ui" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
6 changes: 2 additions & 4 deletions sites/docs/src/content/components/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
</script>

<ComponentPreview name="alert-demo">
Expand All @@ -17,9 +17,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/

## Installation

```bash
npx shadcn-svelte@latest add alert
```
<PMAddComp name="alert" />

<ManualInstall>

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/aspect-ratio.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/aspect-ratio
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="aspect-ratio-demo">
Expand All @@ -18,17 +18,13 @@ bits: https://www.bits-ui.com/docs/components/aspect-ratio

## Installation

```bash
npx shadcn-svelte@latest add aspect-ratio
```
<PMAddComp name="aspect-ratio" />

<ManualInstall>

1. Install `bits-ui`:

```bash
npm install bits-ui
```
<PMInstall command="bits-ui" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/avatar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/avatar
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="avatar-demo">
Expand All @@ -18,17 +18,13 @@ bits: https://www.bits-ui.com/docs/components/avatar

## Installation

```bash
npx shadcn-svelte@latest add avatar
```
<PMAddComp name="avatar" />

<ManualInstall>

1. Install `bits-ui`:

```bash
npm install bits-ui
```
<PMInstall command="bits-ui" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
6 changes: 2 additions & 4 deletions sites/docs/src/content/components/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
import { BadgeDemo, BadgeDestructive, BadgeOutline, BadgeSecondary } from '$lib/registry/default/example'
</script>

Expand All @@ -18,9 +18,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/

## Installation

```bash
npx shadcn-svelte@latest add badge
```
<PMAddComp name="badge" />

<ManualInstall>

Expand Down
6 changes: 2 additions & 4 deletions sites/docs/src/content/components/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
</script>

<ComponentPreview name="breadcrumb-demo">
Expand All @@ -17,9 +17,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/

## Installation

```bash
npx shadcn-svelte@latest add breadcrumb
```
<PMAddComp name="breadcrumb" />

<ManualInstall>

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bits: https://www.bits-ui.com/docs/components/button
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="button-demo">
Expand All @@ -19,17 +19,13 @@ bits: https://www.bits-ui.com/docs/components/button

## Installation

```bash
npx shadcn-svelte@latest add button
```
<PMAddComp name="button" />

<ManualInstall>

1. Install `bits-ui`:

```bash
npm install bits-ui
```
<PMInstall command="bits-ui" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/calendar
---

<script>
import { ComponentPreview, ManualInstall, Callout } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, Callout, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="calendar-demo">
Expand All @@ -24,17 +24,13 @@ If you're looking for a range calendar, check out the [Range Calendar](/docs/com

## Installation

```bash
npx shadcn-svelte@latest add calendar
```
<PMAddComp name="calendar" />

<ManualInstall>

1. Install `bits-ui` and `@internationalized/date`:

```bash
npm install bits-ui @internationalized/date
```
<PMInstall command="bits-ui @internationalized/date" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
6 changes: 2 additions & 4 deletions sites/docs/src/content/components/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
</script>

<ComponentPreview name="card-with-form">
Expand All @@ -17,9 +17,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/

## Installation

```bash
npx shadcn-svelte@latest add card
```
<PMAddComp name="card" />

<ManualInstall>

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bits: https://www.embla-carousel.com/get-started/svelte/
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="carousel-demo">
Expand All @@ -22,17 +22,13 @@ The carousel component is built using the [Embla Carousel](https://www.embla-car

## Installation

```bash
npx shadcn-svelte@latest add carousel
```
<PMAddComp name="carousel" />

<ManualInstall>

1. Install `embla-carousel-svelte`:

```bash
npm install embla-carousel-svelte -D
```
<PMInstall command="embla-carousel-svelte -D" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
10 changes: 3 additions & 7 deletions sites/docs/src/content/components/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/checkbox
---

<script>
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
</script>

<ComponentPreview name="checkbox-demo">
Expand All @@ -18,17 +18,13 @@ bits: https://www.bits-ui.com/docs/components/checkbox

## Installation

```bash
npx shadcn-svelte@latest add checkbox
```
<PMAddComp name="checkbox" />

<ManualInstall>

1. Install `bits-ui`:

```bash
npm install bits-ui
```
<PMInstall command="bits-ui" />

2. Copy and paste the component source files linked at the top of this page into your project.

Expand Down
Loading

0 comments on commit e85fa1d

Please sign in to comment.