Skip to content

Commit e85fa1d

Browse files
huntabyteMichael-ObeleAdrianGonz97
authored
docs: persistent package manager selection (#1257)
Co-authored-by: Michael Obubelebra Amachree <[email protected]> Co-authored-by: AdrianGonz97 <[email protected]>
1 parent 35b8ff9 commit e85fa1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+433
-462
lines changed

sites/docs/mdsx.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function rehypeComponentExample() {
169169

170170
try {
171171
for (const style of styles) {
172-
// @ts-expect-error - this is fine for now.
172+
// @ts-expect-error - this is fine
173173
const component = Index[style.name][name];
174174
const src = component.files[0].replace("/lib/", "/src/lib/");
175175
let sourceCode = getComponentSourceFileContent(src);

sites/docs/src/content/cli.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ title: CLI
33
description: Use the CLI to add components to your project.
44
---
55

6+
<script>
7+
import { PMExecute } from '$lib/components/docs'
8+
</script>
9+
610
## init
711

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

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

12-
```bash
13-
npx shadcn-svelte@latest init
14-
```
16+
<PMExecute command="shadcn-svelte@latest init" />
1517

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

@@ -47,9 +49,7 @@ Options:
4749

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

50-
```bash
51-
npx shadcn-svelte@latest add [component]
52-
```
52+
<PMExecute command="shadcn-svelte@latest add [component]" />
5353

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

@@ -93,9 +93,7 @@ Options:
9393

9494
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.
9595

96-
```bash
97-
npx shadcn-svelte@latest update [component]
98-
```
96+
<PMExecute command="shadcn-svelte@latest update [component]" />
9997

10098
### Options
10199

sites/docs/src/content/components-json.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Configuration for your project.
44
---
55

66
<script>
7-
import { Callout, ComponentPreview } from '$lib/components/docs'
7+
import { Callout, ComponentPreview, PMExecute } from '$lib/components/docs'
88
</script>
99

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

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

22-
```bash
23-
npx shadcn-svelte@latest init
24-
```
22+
<PMExecute command="shadcn-svelte@latest init" />
2523

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

sites/docs/src/content/components/accordion.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/accordion
77
---
88

99
<script>
10-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
10+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1111
</script>
1212

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

1919
## Installation
2020

21-
```bash
22-
npx shadcn-svelte@latest add accordion
23-
```
21+
<PMAddComp name="accordion" />
2422

2523
<ManualInstall>
2624

2725
1. Install `bits-ui`:
2826

29-
```bash
30-
npm install bits-ui
31-
```
27+
<PMInstall command="bits-ui" />
3228

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

sites/docs/src/content/components/alert-dialog.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ bits: https://www.bits-ui.com/docs/components/alert-dialog
88
---
99

1010
<script>
11-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
11+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1212
</script>
1313

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

2020
## Installation
2121

22-
```bash
23-
npx shadcn-svelte@latest add alert-dialog
24-
```
22+
<PMAddComp name="alert-dialog" />
2523

2624
<ManualInstall>
2725

2826
1. Install `bits-ui`:
2927

30-
```bash
31-
npm install bits-ui
32-
```
28+
<PMInstall command="bits-ui" />
3329

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

sites/docs/src/content/components/alert.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
66
---
77

88
<script>
9-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
9+
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
1010
</script>
1111

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

1818
## Installation
1919

20-
```bash
21-
npx shadcn-svelte@latest add alert
22-
```
20+
<PMAddComp name="alert" />
2321

2422
<ManualInstall>
2523

sites/docs/src/content/components/aspect-ratio.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/aspect-ratio
77
---
88

99
<script>
10-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
10+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1111
</script>
1212

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

1919
## Installation
2020

21-
```bash
22-
npx shadcn-svelte@latest add aspect-ratio
23-
```
21+
<PMAddComp name="aspect-ratio" />
2422

2523
<ManualInstall>
2624

2725
1. Install `bits-ui`:
2826

29-
```bash
30-
npm install bits-ui
31-
```
27+
<PMInstall command="bits-ui" />
3228

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

sites/docs/src/content/components/avatar.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/avatar
77
---
88

99
<script>
10-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
10+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1111
</script>
1212

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

1919
## Installation
2020

21-
```bash
22-
npx shadcn-svelte@latest add avatar
23-
```
21+
<PMAddComp name="avatar" />
2422

2523
<ManualInstall>
2624

2725
1. Install `bits-ui`:
2826

29-
```bash
30-
npm install bits-ui
31-
```
27+
<PMInstall command="bits-ui" />
3228

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

sites/docs/src/content/components/badge.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
66
---
77

88
<script>
9-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
9+
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
1010
import { BadgeDemo, BadgeDestructive, BadgeOutline, BadgeSecondary } from '$lib/registry/default/example'
1111
</script>
1212

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

1919
## Installation
2020

21-
```bash
22-
npx shadcn-svelte@latest add badge
23-
```
21+
<PMAddComp name="badge" />
2422

2523
<ManualInstall>
2624

sites/docs/src/content/components/breadcrumb.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
66
---
77

88
<script>
9-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
9+
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
1010
</script>
1111

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

1818
## Installation
1919

20-
```bash
21-
npx shadcn-svelte@latest add breadcrumb
22-
```
20+
<PMAddComp name="breadcrumb" />
2321

2422
<ManualInstall>
2523

sites/docs/src/content/components/button.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ bits: https://www.bits-ui.com/docs/components/button
88
---
99

1010
<script>
11-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
11+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1212
</script>
1313

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

2020
## Installation
2121

22-
```bash
23-
npx shadcn-svelte@latest add button
24-
```
22+
<PMAddComp name="button" />
2523

2624
<ManualInstall>
2725

2826
1. Install `bits-ui`:
2927

30-
```bash
31-
npm install bits-ui
32-
```
28+
<PMInstall command="bits-ui" />
3329

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

sites/docs/src/content/components/calendar.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/calendar
77
---
88

99
<script>
10-
import { ComponentPreview, ManualInstall, Callout } from '$lib/components/docs';
10+
import { ComponentPreview, ManualInstall, Callout, PMAddComp, PMInstall } from '$lib/components/docs';
1111
</script>
1212

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

2525
## Installation
2626

27-
```bash
28-
npx shadcn-svelte@latest add calendar
29-
```
27+
<PMAddComp name="calendar" />
3028

3129
<ManualInstall>
3230

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

35-
```bash
36-
npm install bits-ui @internationalized/date
37-
```
33+
<PMInstall command="bits-ui @internationalized/date" />
3834

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

sites/docs/src/content/components/card.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: https://github.com/huntabyte/shadcn-svelte/tree/main/sites/docs/src/lib/
66
---
77

88
<script>
9-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
9+
import { ComponentPreview, ManualInstall, PMAddComp } from '$lib/components/docs';
1010
</script>
1111

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

1818
## Installation
1919

20-
```bash
21-
npx shadcn-svelte@latest add card
22-
```
20+
<PMAddComp name="card" />
2321

2422
<ManualInstall>
2523

sites/docs/src/content/components/carousel.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bits: https://www.embla-carousel.com/get-started/svelte/
77
---
88

99
<script>
10-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
10+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1111
</script>
1212

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

2323
## Installation
2424

25-
```bash
26-
npx shadcn-svelte@latest add carousel
27-
```
25+
<PMAddComp name="carousel" />
2826

2927
<ManualInstall>
3028

3129
1. Install `embla-carousel-svelte`:
3230

33-
```bash
34-
npm install embla-carousel-svelte -D
35-
```
31+
<PMInstall command="embla-carousel-svelte -D" />
3632

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

sites/docs/src/content/components/checkbox.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bits: https://www.bits-ui.com/docs/components/checkbox
77
---
88

99
<script>
10-
import { ComponentPreview, ManualInstall } from '$lib/components/docs';
10+
import { ComponentPreview, ManualInstall, PMAddComp, PMInstall } from '$lib/components/docs';
1111
</script>
1212

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

1919
## Installation
2020

21-
```bash
22-
npx shadcn-svelte@latest add checkbox
23-
```
21+
<PMAddComp name="checkbox" />
2422

2523
<ManualInstall>
2624

2725
1. Install `bits-ui`:
2826

29-
```bash
30-
npm install bits-ui
31-
```
27+
<PMInstall command="bits-ui" />
3228

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

0 commit comments

Comments
 (0)