Skip to content

Commit

Permalink
enhance: add vite-based version of design system including Shadcn (#119)
Browse files Browse the repository at this point in the history
* start vite migration

* chore: upgrade pnpm

* add prettier

* add constants and copy, format

* updates

* initialize shadcn

* delete design system v3

* upgrade prettier etc

* install tailwind plugins

* add ladle

* ts for ladle

* working ladle with our design system theme

* fix package manager entry in package.json

* unknown instead of any

* update deps

* format
  • Loading branch information
rschlaefli authored Aug 7, 2024
1 parent a6579cb commit 3134456
Show file tree
Hide file tree
Showing 36 changed files with 3,360 additions and 644 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 9.6.0
version: 9.7.0
run_install: true

- run: pnpm run lint
Expand All @@ -34,7 +34,7 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 9.6.0
version: 9.7.0
run_install: true

- run: pnpm run check
Expand All @@ -53,7 +53,7 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 9.6.0
version: 9.7.0
run_install: true

- run: pnpm run format:check
Expand All @@ -72,7 +72,7 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 9.6.0
version: 9.7.0
run_install: true

- run: pnpm run test -- --ci --coverage --maxWorkers=2
Expand All @@ -92,7 +92,7 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 9.6.0
version: 9.7.0
run_install: true

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: pnpm/action-setup@v4
with:
version: 9.6.0
version: 9.7.0
run_install: true

- uses: andresz1/size-limit-action@v1
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
},
"volta": {
"node": "20.16.0",
"pnpm": "9.6.0"
"pnpm": "9.7.0"
},
"packageManager": "pnpm@9.6.0",
"packageManager": "pnpm@9.7.0",
"workspaces": [
"packages/*"
]
Expand Down
37 changes: 0 additions & 37 deletions packages/design-system-v3/package.json

This file was deleted.

56 changes: 0 additions & 56 deletions packages/design-system-v3/src/components/Button.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions packages/design-system-v3/src/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/design-system-v3/src/lib/utils.ts

This file was deleted.

74 changes: 0 additions & 74 deletions packages/design-system-v3/tailwind.config.cjs

This file was deleted.

10 changes: 0 additions & 10 deletions packages/design-system-v3/tsconfig.node.json

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions packages/design-system-vite/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.cache/
build/
.vercel/
10 changes: 10 additions & 0 deletions packages/design-system-vite/.ladle/components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// organize-imports-ignore
import type { GlobalProvider } from '@ladle/react'
import React from 'react'

import 'tailwindcss/src/css/preflight.css'
import 'tailwindcss/tailwind.css'

export const Provider: GlobalProvider = ({ children, globalState }) => (
<>{children}</>
)
22 changes: 22 additions & 0 deletions packages/design-system-vite/.ladle/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="" />
<link
href="https://fonts.googleapis.com/css2?family=Source+Sans+3&display=swap"
rel="stylesheet"
/>

<style>
:root {
--theme-color-primary: #dc6027;
--theme-color-primary-80: #e38052;
--theme-color-primary-60: #eaa07d;
--theme-color-primary-40: #f1bfa9;
--theme-color-primary-20: #f8dfd4;
--theme-color-secondary: #a3adb7;
--theme-color-secondary-80: #b5bdc5;
--theme-color-secondary-60: #c8ced4;
--theme-color-secondary-40: #dadee2;
--theme-color-secondary-20: #edeff1;
--theme-font-primary: 'Source Sans 3';
}
</style>
1 change: 1 addition & 0 deletions packages/design-system-vite/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
13 changes: 13 additions & 0 deletions packages/design-system-vite/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
export default {
semi: false,
singleQuote: true,
trailingComma: 'es5',
plugins: [
import('prettier-plugin-organize-imports'),
import('prettier-plugin-tailwindcss'),
],
}
30 changes: 30 additions & 0 deletions packages/design-system-vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: __dirname,
},
}
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/globals.css",
"css": "src/tailwind.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
Expand All @@ -14,4 +14,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
Loading

0 comments on commit 3134456

Please sign in to comment.