Skip to content

Commit

Permalink
feat(docs): added instructions for tauri
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-karger committed Apr 4, 2024
1 parent be0717e commit e4071f2
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 2 deletions.
10 changes: 10 additions & 0 deletions apps/docs/src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ export function IconLogo(props: IconProps) {

// ICONS

export function IconAlertTriangle(props: IconProps) {
return (
<Icon {...props}>
<path d="M12 9v4" />
<path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z" />
<path d="M12 16h.01" />
</Icon>
)
}

export function IconArrowRight(props: IconProps) {
return (
<Icon {...props}>
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/routes/docs/installation/astro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Install Solid using the Astro CLI:
npx astro add solid
```

<Callout className="mt-4">
<Callout class="mt-4">

Answer `Yes` to all the question prompted by the CLI when installing Solid.

Expand All @@ -43,7 +43,7 @@ Install Tailwind CSS using the Astro CLI:
npx astro add tailwind
```

<Callout className="mt-4">
<Callout class="mt-4">

Answer `Yes` to all the question prompted by the CLI when installing Tailwind CSS.

Expand Down
28 changes: 28 additions & 0 deletions apps/docs/src/routes/docs/installation/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,32 @@
</svg>
<p className="font-medium mt-2">Astro</p>
</LinkedCard>
<LinkedCard href="/docs/installation/tauri">
<svg
role="img"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
className="w-10 h-10"
fill="currentColor"
>
<title>Tauri</title>
<path
fill="currentColor"
d="M 15.625 8.378906 C 15.625 9.585938 14.621094 10.5625 13.382812 10.5625 C 12.144531 10.5625 11.140625 9.585938 11.140625 8.378906 C 11.140625 7.175781 12.144531 6.199219 13.382812 6.199219 C 14.621094 6.199219 15.625 7.175781 15.625 8.378906 Z M 15.625 8.378906 "
/>
<path
fill="currentColor"
d="M 7.375 14.628906 C 7.375 13.421875 8.375 12.445312 9.613281 12.445312 C 10.851562 12.445312 11.855469 13.421875 11.855469 14.628906 C 11.855469 15.832031 10.851562 16.808594 9.613281 16.808594 C 8.375 16.808594 7.375 15.832031 7.375 14.628906 Z M 7.375 14.628906 "
/>
<path
fill="currentColor"
d="M 18.027344 15.371094 C 17.128906 15.9375 16.125 16.335938 15.074219 16.542969 C 15.378906 15.695312 15.480469 14.792969 15.371094 13.902344 C 17.816406 13.070312 19.4375 10.804688 19.394531 8.28125 C 19.351562 5.757812 17.652344 3.546875 15.179688 2.796875 C 12.707031 2.042969 10.015625 2.917969 8.503906 4.96875 C 7.363281 5.09375 6.253906 5.40625 5.222656 5.898438 C 6.34375 2.382812 9.699219 0 13.480469 0.0351562 C 17.261719 0.0703125 20.570312 2.519531 21.617188 6.054688 C 22.667969 9.59375 21.207031 13.378906 18.027344 15.371094 Z M 5.324219 7.417969 L 7.425781 7.664062 C 7.472656 7.269531 7.558594 6.882812 7.6875 6.503906 C 6.859375 6.691406 6.0625 7 5.324219 7.417969 Z M 5.324219 7.417969 "
/>
<path
fill="currentColor"
d="M 4.957031 7.636719 C 5.863281 7.0625 6.875 6.664062 7.933594 6.457031 C 7.613281 7.300781 7.496094 8.207031 7.597656 9.105469 C 5.160156 9.949219 3.550781 12.21875 3.601562 14.734375 C 3.65625 17.253906 5.359375 19.457031 7.828125 20.203125 C 10.300781 20.953125 12.984375 20.078125 14.492188 18.03125 C 15.632812 17.90625 16.742188 17.597656 17.773438 17.109375 C 16.652344 20.621094 13.296875 23 9.519531 22.964844 C 5.742188 22.929688 2.433594 20.484375 1.382812 16.949219 C 0.332031 13.417969 1.785156 9.632812 4.957031 7.636719 Z M 17.660156 15.589844 L 17.621094 15.609375 Z M 17.660156 15.589844 "
/>
</svg>
<p className="font-medium mt-2">Tauri</p>
</LinkedCard>
</div>
130 changes: 130 additions & 0 deletions apps/docs/src/routes/docs/installation/tauri.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { IconAlertTriangle } from "~/components/icons"

<MDXHeader title="Tauri" description="Install and configure Tauri." />

<Callout variant="warning" class="mt-4">

<IconAlertTriangle class="size-10" /> **Prerelease Warning**

This installation guide is for the prerelease version of Tauri 2.0 and is subject to change as development continues.

</Callout>

<Steps>

### Create project

Start by creating a new Tauri project:

```bash
npm create tauri-app@latest --beta
```

When asked make sure to use Solid:

```txt showLineNumbers
✔ Project name · tauri-app
✔ Choose which language to use for your frontend · TypeScript / JavaScript
✔ Choose your UI template · Solid
✔ Choose your UI flavor · TypeScript
```

### Add Tailwind and its configuration

Install `tailwindcss` and its peer dependencies, then generate your `tailwind.config.js` and `postcss.config.js` files:

```bash
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
```

### Edit tsconfig.json file

Add the following code to the `tsconfig.json` file to resolve paths:

```ts {4-9}
{
"compilerOptions": {
// ...
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
]
}
// ...
}
}
```

### Update vite.config.ts

Add the following code to the `vite.config.ts` so your app can resolve paths without error

```bash
# (so you can import "path" without error)
npm i -D @types/node
```

```ts
import path from "path"

import solid from "@vitejs/plugin-solid"
import { defineConfig } from "vite"

export default defineConfig({
plugins: [solid()],
resolve: {
alias: {
"~": path.resolve(__dirname, "./src")
}
}
})
```

### Run the CLI

Run the `solidui-cli` init command to setup your project:

```bash
npx solidui-cli@latest init
```

### Configure ui.config.json

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

```txt showLineNumbers
Would you like to use TypeScript? (recommended) yes
Where is your global CSS file? src/App.css
Where is your tailwind.config.js located? tailwind.config.js
Configure the import alias for the src directory: ~/*
```

### That's it

You can now start adding components to your project.

```bash
npx solidui-cli@latest add button
```

The command above will add the `Button` component to your project. You can then import it like this:

```tsx {1,6} showLineNumbers
import { Button } from "~/components/ui/button"

export default function App() {
return (
<div>
<Button>Click me</Button>
</div>
)
}
```

</Steps>

## Integration into existing projects

If you already have a SolidStart, Vite or Astro project with solid-ui set up you can add Tauri by simply following the steps provided [here](https://tauri.app/v1/guides/getting-started/setup/integrate/).

0 comments on commit e4071f2

Please sign in to comment.