Skip to content

Commit 0ab9f32

Browse files
committed
fix(design-system): isolate design system package, and upgrade storybook
Isolated Design System apps. Upgraded Storybook, and also updated dependencies to use official releases from the components and svg libraries. BREAKING CHANGE: design-system apps is an isolated project, so this means, it will not be hoisted into the yarn workspace, when you run `yarn install` in the root workspace. Any dependencies will be free to be added without dependencies issues in the workspace. fix #156, fix #194
1 parent c479704 commit 0ab9f32

File tree

13 files changed

+13124
-8149
lines changed

13 files changed

+13124
-8149
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ dist/**
3030
!.yarn/sdks
3131
!.yarn/versions
3232

33-
packages/design-system/dist/**
33+
**/storybook-static/**
3434
lerna-debug.log
35-
pub.sh
35+
pub.sh

apps/design-system/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25-
26-
storybook-static

apps/design-system/.storybook/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ function getAbsolutePath(value: string): any {
1010
return dirname(require.resolve(join(value, 'package.json')));
1111
}
1212
const config: StorybookConfig = {
13-
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
13+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
1414
addons: [
1515
getAbsolutePath('@storybook/addon-links'),
1616
getAbsolutePath('@storybook/addon-essentials'),
1717
getAbsolutePath('@storybook/addon-onboarding'),
18-
getAbsolutePath('@storybook/addon-interactions')
18+
getAbsolutePath('@storybook/addon-interactions'),
19+
getAbsolutePath('@storybook/addon-themes')
1920
],
2021
framework: {
2122
name: getAbsolutePath('@storybook/react-vite'),
2223
options: {}
2324
},
2425
docs: {
2526
autodocs: 'tag'
26-
}
27+
},
28+
logLevel: 'debug'
2729
};
2830
export default config;

apps/design-system/.storybook/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CssBaseline, ThemeProvider } from '@mui/material';
2-
import { withThemeFromJSXProvider } from '@storybook/addon-styling';
2+
import { withThemeFromJSXProvider } from '@storybook/addon-themes';
33
import type { Preview } from '@storybook/react';
44
import { darkTheme, lightTheme } from '../src/stories/themes/app';
55

@@ -9,7 +9,7 @@ const preview: Preview = {
99
controls: {
1010
matchers: {
1111
color: /(background|color)$/i,
12-
date: /Date$/
12+
date: /Date$/i
1313
}
1414
}
1515
}
1.09 MB
Binary file not shown.

apps/design-system/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@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
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13+
14+
- Configure the top-level `parserOptions` property like this:
15+
16+
```js
17+
parserOptions: {
18+
ecmaVersion: 'latest',
19+
sourceType: 'module',
20+
project: ['./tsconfig.json', './tsconfig.node.json'],
21+
tsconfigRootDir: __dirname,
22+
},
23+
```
24+
25+
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
26+
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
27+
- 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

apps/design-system/package.json

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,34 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7+
"build": "tsc && vite build",
78
"build-storybook": "storybook build",
89
"dev": "vite",
910
"init-msw": "msw init public/",
10-
"lint": "eslint .",
11-
"lint:fix": "eslint --fix",
11+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1212
"preview": "vite preview",
1313
"storybook": "storybook dev -p 6006"
1414
},
1515
"dependencies": {
16-
"@layer5/sistent-components": "workspace:^",
17-
"@layer5/sistent-svg": "workspace:^"
16+
"@layer5/sistent-components": "^0.8.1-beta.10",
17+
"@layer5/sistent-svg": "^0.11.1-beta.3",
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0"
1820
},
1921
"devDependencies": {
2022
"@emotion/react": "^11.11.1",
2123
"@emotion/styled": "^11.11.0",
22-
"@mui/material": "^5.14.16",
23-
"@storybook/addon-essentials": "^7.4.3",
24-
"@storybook/addon-interactions": "^7.4.3",
25-
"@storybook/addon-links": "^7.4.3",
24+
"@mui/icons-material": "^5.14.16",
25+
"@mui/material": "^5.14.17",
26+
"@storybook/addon-essentials": "^7.5.3",
27+
"@storybook/addon-interactions": "^7.5.3",
28+
"@storybook/addon-links": "^7.5.3",
2629
"@storybook/addon-onboarding": "^1.0.8",
27-
"@storybook/addon-styling": "^1.3.7",
28-
"@storybook/blocks": "^7.4.3",
29-
"@storybook/react": "^7.4.3",
30-
"@storybook/react-vite": "^7.4.3",
31-
"@storybook/testing-library": "^0.2.1",
30+
"@storybook/addon-themes": "^7.5.3",
31+
"@storybook/blocks": "^7.5.3",
32+
"@storybook/react": "^7.5.3",
33+
"@storybook/react-vite": "^7.5.3",
34+
"@storybook/testing-library": "^0.2.2",
3235
"@types/react": "^18.2.15",
3336
"@types/react-dom": "^18.2.7",
3437
"@typescript-eslint/eslint-plugin": "^6.0.0",
@@ -37,13 +40,15 @@
3740
"eslint": "^8.45.0",
3841
"eslint-plugin-react-hooks": "^4.6.0",
3942
"eslint-plugin-react-refresh": "^0.4.3",
40-
"eslint-plugin-storybook": "^0.6.13",
41-
"msw": "^1.3.0",
42-
"msw-storybook-addon": "^1.8.0",
43-
"react": "^18.2.0",
44-
"react-dom": "^18.2.0",
45-
"storybook": "^7.4.3",
43+
"eslint-plugin-storybook": "^0.6.15",
44+
"msw": "^2.0.3",
45+
"msw-storybook-addon": "^1.10.0",
46+
"mui-datatables": "^4.3.0",
47+
"storybook": "^7.5.3",
4648
"typescript": "^5.0.2",
47-
"vite": "^4.5.0"
49+
"vite": "^4.4.5"
50+
},
51+
"installConfig": {
52+
"hoistingLimits": "workspaces"
4853
}
4954
}

apps/design-system/src/App.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
1+
import { useState } from 'react';
2+
import './App.css';
3+
import reactLogo from './assets/react.svg';
4+
import viteLogo from '/vite.svg';
5+
16
function App() {
2-
return <div></div>;
7+
const [count, setCount] = useState(0);
8+
9+
return (
10+
<>
11+
<div>
12+
<a href="https://vitejs.dev" target="_blank">
13+
<img src={viteLogo} className="logo" alt="Vite logo" />
14+
</a>
15+
<a href="https://react.dev" target="_blank">
16+
<img src={reactLogo} className="logo react" alt="React logo" />
17+
</a>
18+
</div>
19+
<h1>Vite + React</h1>
20+
<div className="card">
21+
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button>
22+
<p>
23+
Edit <code>src/App.tsx</code> and save to test HMR
24+
</p>
25+
</div>
26+
<p className="read-the-docs">Click on the Vite and React logos to learn more</p>
27+
</>
28+
);
329
}
430

531
export default App;

apps/design-system/src/stories/AppBar.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const meta = {
1212
} satisfies Meta<typeof AppBar>;
1313

1414
export default meta;
15-
// type Story = StoryObj<typeof meta>;
15+
type Story = StoryObj<typeof meta>;
1616

17-
export function Primary() {
17+
export function Primary(): Story {
1818
return (
1919
<AppBar position="fixed" color="primary">
2020
<Toolbar>

0 commit comments

Comments
 (0)