mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
feat(storybook): import plugins (#3768)
This commit is contained in:
22
.github/workflows/build.yml
vendored
22
.github/workflows/build.yml
vendored
@@ -235,28 +235,6 @@ jobs:
|
|||||||
name: affine
|
name: affine
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: false
|
||||||
|
|
||||||
storybook-test:
|
|
||||||
name: Storybook Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: development
|
|
||||||
needs: [build-storybook]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: ./.github/actions/setup-node
|
|
||||||
with:
|
|
||||||
playwright-install: true
|
|
||||||
electron-install: false
|
|
||||||
- name: Download storybook artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: storybook
|
|
||||||
path: ./apps/storybook/storybook-static
|
|
||||||
- name: Run storybook tests
|
|
||||||
working-directory: ./apps/storybook
|
|
||||||
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"
|
|
||||||
|
|
||||||
e2e-plugin-test:
|
e2e-plugin-test:
|
||||||
name: E2E Plugin Test
|
name: E2E Plugin Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
2
.github/workflows/publish-storybook.yml
vendored
2
.github/workflows/publish-storybook.yml
vendored
@@ -26,6 +26,8 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
with:
|
with:
|
||||||
electron-install: false
|
electron-install: false
|
||||||
|
- name: Build Plugins
|
||||||
|
run: yarn run build:plugins
|
||||||
- name: Publish to Chromatic
|
- name: Publish to Chromatic
|
||||||
uses: chromaui/action@v1
|
uses: chromaui/action@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
"exports": {
|
"exports": {
|
||||||
"./app": "./src/app.tsx",
|
"./app": "./src/app.tsx",
|
||||||
"./router": "./src/router.ts",
|
"./router": "./src/router.ts",
|
||||||
"./bootstrap/setup": "./src/bootstrap/setup.ts"
|
"./bootstrap/setup": "./src/bootstrap/setup.ts",
|
||||||
|
"./bootstrap/register-plugins": "./src/bootstrap/register-plugins.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine-test/fixtures": "workspace:*",
|
"@affine-test/fixtures": "workspace:*",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'ses';
|
||||||
import '@affine/component/theme/global.css';
|
import '@affine/component/theme/global.css';
|
||||||
import '@affine/component/theme/theme.css';
|
import '@affine/component/theme/theme.css';
|
||||||
import '@toeverything/components/style.css';
|
import '@toeverything/components/style.css';
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
"concurrently": "^8.2.0",
|
"concurrently": "^8.2.0",
|
||||||
"jest-mock": "^29.6.2",
|
"jest-mock": "^29.6.2",
|
||||||
"serve": "^14.2.0",
|
"serve": "^14.2.0",
|
||||||
|
"ses": "^0.18.7",
|
||||||
"storybook": "^7.2.3",
|
"storybook": "^7.2.3",
|
||||||
"storybook-dark-mode": "^3.0.1",
|
"storybook-dark-mode": "^3.0.1",
|
||||||
"wait-on": "^7.0.1"
|
"wait-on": "^7.0.1"
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
import { pluginRegisterPromise } from '@affine/core/bootstrap/register-plugins';
|
||||||
import { routes } from '@affine/core/router';
|
import { routes } from '@affine/core/router';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import type { StoryContext, StoryFn } from '@storybook/react';
|
import type { StoryContext, StoryFn } from '@storybook/react';
|
||||||
import { userEvent, waitFor } from '@storybook/testing-library';
|
import { userEvent, waitFor } from '@storybook/testing-library';
|
||||||
|
import { use } from 'foxact/use';
|
||||||
import { Outlet, useLocation } from 'react-router-dom';
|
import { Outlet, useLocation } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
reactRouterOutlets,
|
reactRouterOutlets,
|
||||||
@@ -25,6 +27,7 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Index: StoryFn = () => {
|
export const Index: StoryFn = () => {
|
||||||
|
use(pluginRegisterPromise);
|
||||||
return <FakeApp />;
|
return <FakeApp />;
|
||||||
};
|
};
|
||||||
Index.decorators = [withRouter, withCleanLocalStorage];
|
Index.decorators = [withRouter, withCleanLocalStorage];
|
||||||
|
|||||||
@@ -723,6 +723,7 @@ __metadata:
|
|||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
react-dom: 18.2.0
|
react-dom: 18.2.0
|
||||||
serve: ^14.2.0
|
serve: ^14.2.0
|
||||||
|
ses: ^0.18.7
|
||||||
storybook: ^7.2.3
|
storybook: ^7.2.3
|
||||||
storybook-addon-react-router-v6: ^2.0.4
|
storybook-addon-react-router-v6: ^2.0.4
|
||||||
storybook-dark-mode: ^3.0.1
|
storybook-dark-mode: ^3.0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user