Skip to content

Commit 60ee910

Browse files
committed
Move Storybook from packages/ui to a dedicated apps/storybook app
- move storybook from packages/ui to apps/storybook while keeping stories in packages/ui. we need this to serve as standalone app so apps/editor doesn't depend on storybook - assess the migration, simplify configs when possible [Changes] - in storybook app, don't use workarounds - get rid of [Fragment] while not causing any warinings to appear - remove frozen lockfile ├── apps │ ├── browser │ │ └── tsconfig.json │ ├── editor │ │ ├── package.json │ │ └── tsconfig.json │ └── storybook │ ├── .gitignore │ ├── .storybook │ │ ├── main.ts │ │ ├── preview.ts │ │ └── styles.css │ ├── package.json │ └── tsconfig.json ├── install.ps1 ├── install.sh ├── packages │ └── ui │ ├── package.json │ ├── src │ │ ├── components │ │ │ └── editor │ │ │ ├── chats-view │ │ │ │ └── Progress │ │ │ │ └── Progress.stories.tsx │ │ │ ├── common │ │ │ │ ├── Button │ │ │ │ │ └── Button.stories.tsx │ │ │ │ ├── Checkbox │ │ │ │ │ └── Checkbox.stories.tsx │ │ │ │ ├── Dropdown │ │ │ │ │ └── Dropdown.stories.tsx │ │ │ │ ├── DropdownMenu │ │ │ │ │ └── DropdownMenu.stories.tsx │ │ │ │ ├── Field │ │ │ │ │ └── Field.stories.tsx │ │ │ │ ├── IconButton │ │ │ │ │ └── IconButton.stories.tsx │ │ │ │ ├── Input │ │ │ │ │ └── Input.stories.tsx │ │ │ │ ├── Radio │ │ │ │ │ └── Radio.stories.tsx │ │ │ │ ├── SimpleCheckbox │ │ │ │ │ └── SimpleCheckbox.stories.tsx │ │ │ │ ├── TextButton │ │ │ │ │ └── TextButton.stories.tsx │ │ │ │ ├── Textarea │ │ │ │ │ └── Textarea.stories.tsx │ │ │ │ └── prompts │ │ │ │ └── PromptField │ │ │ │ └── PromptField.stories.tsx │ │ │ ├── prompt-view │ │ │ │ ├── Configurations │ │ │ │ │ └── Configurations.stories.tsx │ │ │ │ ├── Fieldset │ │ │ │ │ └── Fieldset.stories.tsx │ │ │ │ ├── IconAccentButton │ │ │ │ │ └── IconAccentButton.stories.tsx │ │ │ │ ├── KeycapWrapper │ │ │ │ │ └── KeycapWrapper.stories.tsx │ │ │ │ ├── Page │ │ │ │ │ └── Page.stories.tsx │ │ │ │ ├── PresetOption │ │ │ │ │ └── PresetOption.stories.tsx │ │ │ │ ├── RecentDonations │ │ │ │ │ └── RecentDonations.stories.tsx │ │ │ │ ├── ResponsePreview │ │ │ │ │ └── ResponsePreview.stories.tsx │ │ │ │ ├── Responses │ │ │ │ │ └── Responses.stories.tsx │ │ │ │ ├── TargetButton │ │ │ │ │ └── TargetButton.stories.tsx │ │ │ │ ├── Tasks │ │ │ │ │ └── Tasks.stories.tsx │ │ │ │ └── modals │ │ │ │ ├── AutoClosingModal │ │ │ │ │ └── AutoClosingModal.stories.tsx │ │ │ │ ├── OngoingApiCallsModal │ │ │ │ │ └── OngoingApiCallsModal.stories.tsx │ │ │ │ ├── ProgressModal │ │ │ │ │ └── ProgressModal.stories.tsx │ │ │ │ └── QRCodeModal │ │ │ │ └── QRCodeModal.stories.tsx │ │ │ └── settings-view │ │ │ ├── Item │ │ │ │ └── Item.stories.tsx │ │ │ └── SortableList │ │ │ └── SortableList.stories.tsx │ │ └── styles │ │ ├── foundation │ │ │ ├── _colors.scss │ │ │ ├── _index.scss │ │ │ ├── _mixins.scss │ │ │ └── _variables.scss │ │ └── global.scss │ └── tsconfig.json └── pnpm-workspace.yaml
1 parent 27cced0 commit 60ee910

14 files changed

Lines changed: 899 additions & 719 deletions

File tree

‎apps/storybook/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*storybook.log
2+
storybook-static

‎apps/storybook/.storybook/main.ts‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import path from 'path'
2+
import type { StorybookConfig } from '@storybook/react-vite'
3+
import type svgrPlugin from 'vite-plugin-svgr'
4+
5+
process.env.VITE_CJS_IGNORE_WARNING = 'true'
6+
7+
const config: StorybookConfig = {
8+
stories: ['../../../packages/ui/src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
9+
framework: {
10+
name: '@storybook/react-vite',
11+
options: {}
12+
},
13+
core: {
14+
disableTelemetry: true
15+
},
16+
viteFinal: async (config) => {
17+
const svgrModule = await import('vite-plugin-svgr')
18+
const svgr = (
19+
typeof svgrModule.default === 'function'
20+
? svgrModule.default
21+
: (svgrModule.default as unknown as { default: typeof svgrPlugin })
22+
.default
23+
) as typeof svgrPlugin
24+
25+
const ui_src = path.resolve(__dirname, '../../../packages/ui/src')
26+
const shared_src = path.resolve(__dirname, '../../../packages/shared/src')
27+
const foundation_path = path
28+
.resolve(ui_src, 'styles/foundation')
29+
.replace(/\\/g, '/')
30+
31+
config.plugins = [...(config.plugins || []), svgr()]
32+
config.resolve = {
33+
...config.resolve,
34+
alias: {
35+
...config.resolve?.alias,
36+
'@ui': ui_src,
37+
'@shared': shared_src
38+
}
39+
}
40+
config.css = {
41+
...config.css,
42+
preprocessorOptions: {
43+
...config.css?.preprocessorOptions,
44+
scss: {
45+
...config.css?.preprocessorOptions?.scss,
46+
silenceDeprecations: ['legacy-js-api'],
47+
additionalData: `@use "${foundation_path}" as *;`
48+
}
49+
}
50+
}
51+
52+
return config
53+
}
54+
}
55+
56+
export default config
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '@vscode/codicons/dist/codicon.css'
22
import 'simplebar-react/dist/simplebar.min.css'
3-
import '../src/styles/global.scss'
3+
import '../../../packages/ui/src/styles/global.scss'
44
import './styles.css'
55

66
export const parameters = {

‎apps/storybook/package.json‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@cwc/storybook",
3+
"private": true,
4+
"scripts": {
5+
"storybook": "storybook dev -p 6006",
6+
"build-storybook": "storybook build"
7+
},
8+
"dependencies": {
9+
"@vscode/codicons": "0.0.46-51",
10+
"react": "18.2.0",
11+
"react-dom": "18.2.0",
12+
"simplebar-react": "3.3.1"
13+
},
14+
"devDependencies": {
15+
"@storybook/react": "7.6.24",
16+
"@storybook/react-vite": "7.6.24",
17+
"@types/node": "22.x",
18+
"@types/react": "18.2.60",
19+
"@types/react-dom": "18.2.19",
20+
"sass-embedded": "1.89.2",
21+
"storybook": "7.6.24",
22+
"vite": "5.4.14",
23+
"vite-plugin-svgr": "3.2.0"
24+
}
25+
}

‎apps/storybook/tsconfig.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"types": ["node", "react", "jest"],
5+
"paths": {
6+
"@shared/*": ["../../packages/shared/src/*"],
7+
"@ui/*": ["../../packages/ui/src/*"]
8+
}
9+
},
10+
"include": [
11+
".storybook/**/*",
12+
"../../packages/ui/src/**/*",
13+
"../../packages/shared/src/**/*"
14+
]
15+
}

‎install.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ if (-not $updated) {
539539
Set-Location $repoDir
540540

541541
$depsOk = Invoke-Step "$msg_step_deps..." {
542-
pnpm --filter gemini-coder install --frozen-lockfile --no-optional *>$null
542+
pnpm --filter gemini-coder install *>$null
543543
if ($LASTEXITCODE -ne 0) { throw "pnpm install failed" }
544544
}
545545

@@ -564,7 +564,7 @@ if (-not $depsOk) {
564564
Set-Location $repoDir
565565

566566
$null = Invoke-Step "$msg_step_deps..." {
567-
pnpm --filter gemini-coder install --frozen-lockfile --no-optional *>$null
567+
pnpm --filter gemini-coder install *>$null
568568
if ($LASTEXITCODE -ne 0) { throw "pnpm install failed" }
569569
} $msg_step_deps
570570
}

‎install.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,14 @@ for i in "${indices[@]}"; do
547547

548548
cd "$REPO_DIR"
549549

550-
if ! run_step "$msg_step_deps" pnpm --filter gemini-coder install --frozen-lockfile --no-optional; then
550+
if ! run_step "$msg_step_deps" pnpm --filter gemini-coder install; then
551551
echo -e " \033[33m$msg_deps_retry\033[0m"
552552
cd "$CWC_DIR"
553553
rm -rf "$CWC_DIR"/repository*
554554
pnpm store prune > /dev/null 2>&1 || true
555555
run_step "$msg_step_cloning" clone_repo
556556
cd "$REPO_DIR"
557-
run_step "$msg_step_deps" pnpm --filter gemini-coder install --frozen-lockfile --no-optional
557+
run_step "$msg_step_deps" pnpm --filter gemini-coder install
558558
fi
559559

560560
rm -f ./apps/editor/*.vsix

‎packages/ui/.gitignore‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎packages/ui/.storybook/main.ts‎

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)