Skip to content

Commit ada7ba5

Browse files
✨ [#49] update workflow
⬆️ [#49] update dependencies and make storybook working again
1 parent 0de18a8 commit ada7ba5

13 files changed

+21363
-14071
lines changed

.github/workflows/ci.yml

+32-53
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ jobs:
2626
runs-on: ubuntu-latest
2727

2828
steps:
29-
- uses: actions/checkout@v3
30-
- uses: actions/setup-node@v3
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
3131
with:
3232
node-version-file: '.nvmrc'
33-
cache: yarn
33+
cache: npm
3434

3535
- name: Build Storybook docs
3636
run: |
37-
yarn install
38-
yarn build-storybook --quiet
37+
npm ci
38+
npm run build-storybook --quiet
3939
4040
- name: Upload artifact
41-
uses: actions/upload-pages-artifact@v1
41+
uses: actions/upload-pages-artifact@v4
4242
with:
4343
path: ./storybook-static
4444

@@ -47,59 +47,42 @@ jobs:
4747
runs-on: ubuntu-latest
4848

4949
steps:
50-
- uses: actions/checkout@v3
51-
- uses: actions/setup-node@v3
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-node@v4
5252
with:
5353
node-version-file: '.nvmrc'
54-
cache: yarn
54+
cache: npm
5555

5656
- name: Install dependencies
57-
run: yarn install
57+
run: npm ci
5858

5959
- name: Build library
6060
run: |
61-
yarn build
61+
npm run build
6262
6363
- name: Store build artifact
64-
uses: actions/upload-artifact@v3
64+
uses: actions/upload-artifact@v4
6565
with:
6666
name: build
67-
path: dist/
67+
path: lib/
6868
retention-days: 1
6969

7070
prettier:
7171
name: prettier (code formatting)
7272
runs-on: ubuntu-latest
7373

7474
steps:
75-
- uses: actions/checkout@v3
76-
- uses: actions/setup-node@v3
75+
- uses: actions/checkout@v4
76+
- uses: actions/setup-node@v4
7777
with:
7878
node-version-file: '.nvmrc'
79-
cache: yarn
79+
cache: npm
8080

8181
- name: Install dependencies
82-
run: yarn install
82+
run: npm ci
8383

8484
- name: Run prettier linter
85-
run: yarn checkformat
86-
87-
eslint:
88-
name: eslint (code formatting)
89-
runs-on: ubuntu-latest
90-
91-
steps:
92-
- uses: actions/checkout@v3
93-
- uses: actions/setup-node@v3
94-
with:
95-
node-version-file: '.nvmrc'
96-
cache: yarn
97-
98-
- name: Install dependencies
99-
run: yarn install
100-
101-
- name: Run ESLint
102-
run: yarn test:lint
85+
run: npm run checkformat
10386

10487
tests:
10588
name: Run Storybook tests
@@ -108,22 +91,22 @@ jobs:
10891
- storybook
10992

11093
steps:
111-
- uses: actions/checkout@v3
112-
- uses: actions/setup-node@v3
94+
- uses: actions/checkout@v4
95+
- uses: actions/setup-node@v4
11396
with:
11497
node-version-file: '.nvmrc'
115-
cache: yarn
98+
cache: npm
11699

117100
- name: Install dependencies
118-
run: yarn install
101+
run: npm install
119102

120103
# Reference: https://storybook.js.org/docs/6.5/react/writing-tests/test-runner#run-against-non-deployed-storybooks
121104
- name: Set up test environment
122105
run: |
123106
npx playwright install --with-deps
124107
125108
- name: Download storybook artifact
126-
uses: actions/download-artifact@v3
109+
uses: actions/download-artifact@v4
127110
with:
128111
name: github-pages
129112
path: storybook-static
@@ -133,15 +116,13 @@ jobs:
133116
cd storybook-static/ && tar -xvf artifact.tar && cd ..
134117
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
135118
"npx http-server storybook-static --port 6006 --quiet" \
136-
"npx wait-on -l http://127.0.0.1:6006 && yarn test:storybook"
119+
"npx wait-on -l http://127.0.0.1:6006 && npm run test:storybook"
137120
138121
deploy:
139122
runs-on: ubuntu-latest
140123
needs:
141124
- storybook
142125
- prettier
143-
- eslint
144-
- tests
145126
# do not run in forks & only publish main branch
146127
if: github.ref_name == 'main' && github.repository_owner == 'open-formulieren'
147128

@@ -158,37 +139,35 @@ jobs:
158139
steps:
159140
- name: Setup Pages
160141
id: pages
161-
uses: actions/configure-pages@v3
142+
uses: actions/configure-pages@v4
162143
- name: Deploy to GitHub Pages
163144
id: deployment
164-
uses: actions/deploy-pages@v1
145+
uses: actions/deploy-pages@v4
165146

166147
publish:
167148
name: Publish the NPM package
168149
runs-on: ubuntu-latest
169150
needs:
170151
- build-package
171152
- prettier
172-
- eslint
173-
- tests
174153

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

178157
steps:
179-
- uses: actions/checkout@v3
180-
- uses: actions/setup-node@v3
158+
- uses: actions/checkout@v4
159+
- uses: actions/setup-node@v4
181160
with:
182161
node-version-file: '.nvmrc'
183-
cache: yarn
162+
cache: npm
184163
registry-url: 'https://registry.npmjs.org'
185164
scope: '@open-formulieren'
186165

187166
- name: Install dependencies
188-
run: yarn install
167+
run: npm install
189168

190169
- name: Download build artifact
191-
uses: actions/download-artifact@v3
170+
uses: actions/download-artifact@v4
192171
with:
193172
name: build
194173
path: dist/
@@ -198,6 +177,6 @@ jobs:
198177
# Strip git ref prefix from version
199178
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
200179
201-
yarn publish --access public --new-version=$VERSION
180+
npm publish --access public --new-version=$VERSION
202181
env:
203182
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
20

.prettierrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"tabWidth": 2,
1313
"trailingComma": "es5",
1414
"useTabs": false,
15-
"importOrder": ["^(formio-renderer)/(.*)$", "^[./]"],
15+
"importOrder": ["^@/.*", "^[./]"],
1616
"importOrderSeparation": true,
1717
"importOrderSortSpecifiers": true
1818
}

.storybook/main.js

-30
This file was deleted.

.storybook/main.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type {StorybookConfig} from '@storybook/react-webpack5';
2+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
3+
4+
const config: StorybookConfig = {
5+
core: {
6+
disableTelemetry: true,
7+
disableWhatsNewNotifications: true,
8+
},
9+
framework: {
10+
name: '@storybook/react-webpack5',
11+
options: {},
12+
},
13+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
14+
addons: [
15+
'@storybook/addon-links',
16+
'@storybook/addon-essentials',
17+
'@storybook/addon-interactions',
18+
'storybook-react-intl',
19+
],
20+
docs: {
21+
autodocs: 'tag',
22+
},
23+
webpackFinal: async config => {
24+
if (!config.resolve) {
25+
config.resolve = {};
26+
}
27+
config.resolve.plugins = [new TsconfigPathsPlugin()];
28+
return config;
29+
},
30+
};
31+
32+
export default config;
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export const parameters = {
2-
actions: { argTypesRegex: "^on[A-Z].*" },
2+
actions: {argTypesRegex: '^on[A-Z].*'},
33
controls: {
44
matchers: {
55
color: /(background|color)$/i,
66
date: /Date$/,
77
},
88
},
9-
}
9+
};

.storybook/test-runner.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {TestRunnerConfig} from '@storybook/test-runner';
2+
3+
const config: TestRunnerConfig = {};
4+
5+
export default config;

0 commit comments

Comments
 (0)