Skip to content

Commit

Permalink
⬆️ [#49] update dependencies and make storybook working again
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkiysendoorn1 committed Mar 19, 2024
1 parent 0de18a8 commit 4d5c640
Show file tree
Hide file tree
Showing 13 changed files with 21,363 additions and 14,071 deletions.
85 changes: 32 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Build Storybook docs
run: |
yarn install
yarn build-storybook --quiet
npm ci
npm run build-storybook --quiet
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: ./storybook-static

Expand All @@ -47,59 +47,42 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Install dependencies
run: yarn install
run: npm ci

- name: Build library
run: |
yarn build
npm run build
- name: Store build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build
path: dist/
path: lib/
retention-days: 1

prettier:
name: prettier (code formatting)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Install dependencies
run: yarn install
run: npm ci

- name: Run prettier linter
run: yarn checkformat

eslint:
name: eslint (code formatting)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn

- name: Install dependencies
run: yarn install

- name: Run ESLint
run: yarn test:lint
run: npm run checkformat

tests:
name: Run Storybook tests
Expand All @@ -108,22 +91,22 @@ jobs:
- storybook

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm

- name: Install dependencies
run: yarn install
run: npm install

# Reference: https://storybook.js.org/docs/6.5/react/writing-tests/test-runner#run-against-non-deployed-storybooks
- name: Set up test environment
run: |
npx playwright install --with-deps
- name: Download storybook artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: github-pages
path: storybook-static
Expand All @@ -133,15 +116,13 @@ jobs:
cd storybook-static/ && tar -xvf artifact.tar && cd ..
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --quiet" \
"npx wait-on -l http://127.0.0.1:6006 && yarn test:storybook"
"npx wait-on -l http://127.0.0.1:6006 && npm run test:storybook"
deploy:
runs-on: ubuntu-latest
needs:
- storybook
- prettier
- eslint
- tests
# do not run in forks & only publish main branch
if: github.ref_name == 'main' && github.repository_owner == 'open-formulieren'

Expand All @@ -158,37 +139,35 @@ jobs:
steps:
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4

publish:
name: Publish the NPM package
runs-on: ubuntu-latest
needs:
- build-package
- prettier
- eslint
- tests

# do not publish in forks or non-tag pushes
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'open-formulieren'

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
cache: npm
registry-url: 'https://registry.npmjs.org'
scope: '@open-formulieren'

- name: Install dependencies
run: yarn install
run: npm install

- name: Download build artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: build
path: dist/
Expand All @@ -198,6 +177,6 @@ jobs:
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
yarn publish --access public --new-version=$VERSION
npm publish --access public --new-version=$VERSION
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
20
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"importOrder": ["^(formio-renderer)/(.*)$", "^[./]"],
"importOrder": ["^@/.*", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
30 changes: 0 additions & 30 deletions .storybook/main.js

This file was deleted.

32 changes: 32 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type {StorybookConfig} from '@storybook/react-webpack5';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';

const config: StorybookConfig = {
core: {
disableTelemetry: true,
disableWhatsNewNotifications: true,
},
framework: {
name: '@storybook/react-webpack5',
options: {},
},
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-react-intl',
],
docs: {
autodocs: 'tag',
},
webpackFinal: async config => {
if (!config.resolve) {
config.resolve = {};
}
config.resolve.plugins = [new TsconfigPathsPlugin()];
return config;
},
};

export default config;
4 changes: 2 additions & 2 deletions .storybook/preview.js → .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
};
5 changes: 5 additions & 0 deletions .storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {TestRunnerConfig} from '@storybook/test-runner';

const config: TestRunnerConfig = {};

export default config;
Loading

0 comments on commit 4d5c640

Please sign in to comment.