refactor(storybook): move to apps folder (#2901)

This commit is contained in:
Alex Yang
2023-06-28 20:29:52 +08:00
parent 81bac496b4
commit 1bff46d5f0
34 changed files with 29 additions and 19 deletions

View File

@@ -9,6 +9,7 @@
"server", "server",
"web", "web",
"docs", "docs",
"storybook",
"component", "component",
"workspace", "workspace",
"env", "env",
@@ -20,8 +21,7 @@
"native", "native",
"templates", "templates",
"y-indexeddb", "y-indexeddb",
"debug", "debug"
"theme"
] ]
] ]
} }

View File

@@ -41,6 +41,7 @@ const allPackages = [
'apps/web', 'apps/web',
'apps/server', 'apps/server',
'apps/electron', 'apps/electron',
'apps/storybook',
'plugins/copilot', 'plugins/copilot',
'plugins/bookmark-block', 'plugins/bookmark-block',
]; ];

View File

@@ -78,7 +78,7 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: storybook name: storybook
path: ./packages/storybook/storybook-static path: ./apps/storybook/storybook-static
if-no-files-found: error if-no-files-found: error
build-web: build-web:
@@ -191,9 +191,9 @@ jobs:
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: storybook name: storybook
path: ./packages/storybook/storybook-static path: ./apps/storybook/storybook-static
- name: Run storybook tests - name: Run storybook tests
working-directory: ./packages/storybook working-directory: ./apps/storybook
run: | run: |
yarn exec concurrently -k -s first -n "SB,TEST" -c "magenta,blue" "yarn exec serve ./storybook-static -l 6006" "yarn exec wait-on tcp:6006 && yarn test" yarn exec concurrently -k -s first -n "SB,TEST" -c "magenta,blue" "yarn exec serve ./storybook-static -l 6006" "yarn exec wait-on tcp:6006 && yarn test"
@@ -232,7 +232,7 @@ jobs:
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: storybook name: storybook
path: ./packages/storybook/storybook-static path: ./apps/storybook/storybook-static
- name: Wait for Octobase Ready - name: Wait for Octobase Ready
run: | run: |

View File

@@ -3,7 +3,7 @@ import {
PublicLinkDisableModal, PublicLinkDisableModal,
StyledDisableButton, StyledDisableButton,
} from '@affine/component/share-menu'; } from '@affine/component/share-menu';
import { ShareMenu } from '@affine/component/share-menu/share-menu'; import { ShareMenu } from '@affine/component/share-menu';
import type { import type {
AffineLegacyCloudWorkspace, AffineLegacyCloudWorkspace,
LocalWorkspace, LocalWorkspace,

View File

@@ -2,17 +2,22 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"include": ["./src"], "include": ["./src"],
"compilerOptions": { "compilerOptions": {
// Workaround for storybook build
"baseUrl": "../..",
"composite": true, "composite": true,
"noEmit": false, "noEmit": false,
"outDir": "lib", "outDir": "lib",
"paths": { "types": ["react/experimental"]
"@affine/component": ["../component/src"],
"@affine/component/*": ["../component/src/components/*"]
}
}, },
"references": [ "references": [
{ {
"path": "../component" "path": "../../packages/component"
},
{
"path": "../../packages/env"
},
{
"path": "../../packages/workspace"
}, },
{ {
"path": "./tsconfig.node.json" "path": "./tsconfig.node.json"

View File

@@ -13,9 +13,9 @@
"include": [".storybook/**/*"], "include": [".storybook/**/*"],
"exclude": ["lib"], "exclude": ["lib"],
"references": [ "references": [
{ "path": "../i18n" }, { "path": "../../packages/i18n" },
{ {
"path": "../env" "path": "../../packages/env"
} }
] ]
} }

View File

@@ -15,7 +15,8 @@
"jsx": "preserve", "jsx": "preserve",
"jsxImportSource": "@emotion/react", "jsxImportSource": "@emotion/react",
"incremental": true, "incremental": true,
"experimentalDecorators": true "experimentalDecorators": true,
"types": ["react/experimental"]
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/types/types.d.ts"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/types/types.d.ts"],
"exclude": ["node_modules"], "exclude": ["node_modules"],

View File

@@ -32,7 +32,7 @@
"{projectRoot}/node_modules/.cache", "{projectRoot}/node_modules/.cache",
"{projectRoot}/target", "{projectRoot}/target",
"{workspaceRoot}/apps/web/.next", "{workspaceRoot}/apps/web/.next",
"{workspaceRoot}/packages/storybook/storybook-static", "{workspaceRoot}/apps/storybook/storybook-static",
"{workspaceRoot}/packages/i18n/src/i18n-generated.ts", "{workspaceRoot}/packages/i18n/src/i18n-generated.ts",
"{workspaceRoot}/packages/native/affine.*.node", "{workspaceRoot}/packages/native/affine.*.node",
"{workspaceRoot}/affine.db", "{workspaceRoot}/affine.db",

View File

@@ -22,7 +22,7 @@
"build:storybook": "nx build @affine/storybook", "build:storybook": "nx build @affine/storybook",
"build:plugins": "./apps/electron/scripts/plugins/build-plugins.mjs", "build:plugins": "./apps/electron/scripts/plugins/build-plugins.mjs",
"start:web": "yarn workspace @affine/web start", "start:web": "yarn workspace @affine/web start",
"start:storybook": "yarn exec serve packages/storybook/storybook-static -l 6006", "start:storybook": "yarn exec serve apps/storybook/storybook-static -l 6006",
"serve:test-static": "yarn exec serve tests/fixtures --cors -p 8081", "serve:test-static": "yarn exec serve tests/fixtures --cors -p 8081",
"lint": "eslint . --ext .js,mjs,.ts,.tsx --cache", "lint": "eslint . --ext .js,mjs,.ts,.tsx --cache",
"lint:fix": "yarn lint --fix", "lint:fix": "yarn lint --fix",

View File

@@ -96,6 +96,9 @@
{ {
"path": "./apps/server" "path": "./apps/server"
}, },
{
"path": "./apps/storybook"
},
// Top level packages // Top level packages
{ {
"path": "./packages/infra" "path": "./packages/infra"

View File

@@ -426,9 +426,9 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@affine/storybook@workspace:packages/storybook": "@affine/storybook@workspace:apps/storybook":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@affine/storybook@workspace:packages/storybook" resolution: "@affine/storybook@workspace:apps/storybook"
dependencies: dependencies:
"@affine/component": "workspace:*" "@affine/component": "workspace:*"
"@affine/i18n": "workspace:*" "@affine/i18n": "workspace:*"