From 3695bff39ac6d5c6b44ce9791bd0f91f19248a2e Mon Sep 17 00:00:00 2001 From: yanguoyu <841185308@qq.com> Date: Wed, 28 Jun 2023 11:08:51 +0800 Subject: [PATCH 1/3] chore(CI): Add check story book to CI --- .github/workflows/check_storybook.yml | 66 + .gitignore | 1 + packages/neuron-ui/package.json | 22 +- .../src/components/LanguageDialog/index.tsx | 2 +- .../src/components/NetworkSetting/index.tsx | 14 +- .../src/components/PageContainer/index.tsx | 2 +- .../src/components/SendFieldset/index.tsx | 4 +- packages/neuron-ui/src/services/remote/app.ts | 5 +- .../stateProvider/actionCreators/app.ts | 24 +- .../src/widgets/AlertDialog/index.tsx | 12 +- .../widgets/DatetimePickerDialog/index.tsx | 4 +- yarn.lock | 1352 ++++++++++------- 12 files changed, 874 insertions(+), 634 deletions(-) create mode 100644 .github/workflows/check_storybook.yml diff --git a/.github/workflows/check_storybook.yml b/.github/workflows/check_storybook.yml new file mode 100644 index 0000000000..23119e232c --- /dev/null +++ b/.github/workflows/check_storybook.yml @@ -0,0 +1,66 @@ +name: Check storybook + +on: + push: + pull_request: + +jobs: + default: + strategy: + matrix: + node: + - 18.12.0 + os: + - macos-latest + - ubuntu-20.04 + - windows-latest + + runs-on: ${{ matrix.os }} + + name: ${{ matrix.os }}(Node.js ${{ matrix.node }}) + + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: "yarn" + + - name: Restore + uses: actions/cache@v3 + with: + path: | + node_modules + */*/node_modules + key: 2022-10-11-${{ runner.os }}-${{ hashFiles('**/yarn.lock')}} + + - name: Install libudev + if: matrix.os == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev + + - name: Install Lerna + run: yarn global add lerna + + - name: Boostrap + run: | + yarn + yarn build + env: + CI: false + + - name: Build storybook + run: | + cd packages/neuron-ui + yarn build-storybook + env: + CI: true diff --git a/.gitignore b/.gitignore index e752ec8fce..7e8a5d078a 100755 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ build dist pages release +/packages/neuron-ui/storybook-static /packages/neuron-wallet/bin/mac /packages/neuron-wallet/bin/linux /packages/neuron-wallet/bin/win diff --git a/packages/neuron-ui/package.json b/packages/neuron-ui/package.json index 96248ce2b6..2cd6fd7c5b 100644 --- a/packages/neuron-ui/package.json +++ b/packages/neuron-ui/package.json @@ -63,18 +63,18 @@ "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "7.21.11", "@babel/preset-typescript": "7.22.5", - "@storybook/addon-actions": "6.5.16", - "@storybook/addon-essentials": "6.5.16", - "@storybook/addon-interactions": "6.5.16", - "@storybook/addon-links": "6.5.16", - "@storybook/builder-webpack4": "6.5.16", - "@storybook/builder-webpack5": "6.5.16", - "@storybook/manager-webpack4": "6.5.16", - "@storybook/manager-webpack5": "6.5.16", - "@storybook/node-logger": "6.5.16", + "@storybook/addon-actions": "6.5.17-alpha.0", + "@storybook/addon-essentials": "6.5.17-alpha.0", + "@storybook/addon-interactions": "6.5.17-alpha.0", + "@storybook/addon-links": "6.5.17-alpha.0", + "@storybook/builder-webpack4": "6.5.17-alpha.0", + "@storybook/builder-webpack5": "6.5.17-alpha.0", + "@storybook/manager-webpack4": "6.5.17-alpha.0", + "@storybook/manager-webpack5": "6.5.17-alpha.0", + "@storybook/node-logger": "6.5.17-alpha.0", "@storybook/preset-create-react-app": "4.1.2", - "@storybook/react": "6.5.16", - "@storybook/testing-library": "0.2.0", + "@storybook/react": "6.5.17-alpha.0", + "@storybook/testing-library": "0.0.13", "@types/enzyme": "3.10.13", "@types/enzyme-adapter-react-16": "1.0.6", "@types/node": "18.16.18", diff --git a/packages/neuron-ui/src/components/LanguageDialog/index.tsx b/packages/neuron-ui/src/components/LanguageDialog/index.tsx index 58174feb08..d8d61f6266 100644 --- a/packages/neuron-ui/src/components/LanguageDialog/index.tsx +++ b/packages/neuron-ui/src/components/LanguageDialog/index.tsx @@ -32,7 +32,7 @@ const SelectItem = ({ locale, className, sufIcon, ...res }: SelectItemProps) => const LanguageDialog = ({ show, close }: { show: boolean; close: () => void }) => { const [t, i18n] = useTranslation() - const [lng, setLng] = useState(i18n.language as typeof LOCALES[number]) + const [lng, setLng] = useState(i18n.language as (typeof LOCALES)[number]) const [isDropdownOpen, setIsDropdownOpen] = useState(false) diff --git a/packages/neuron-ui/src/components/NetworkSetting/index.tsx b/packages/neuron-ui/src/components/NetworkSetting/index.tsx index 248a47aef1..d72dc65975 100644 --- a/packages/neuron-ui/src/components/NetworkSetting/index.tsx +++ b/packages/neuron-ui/src/components/NetworkSetting/index.tsx @@ -62,14 +62,12 @@ const NetworkSetting = ({ chain = chainState, settings: { networks = [] } }: Sta ), suffix: (