Skip to content

Commit 02ab74f

Browse files
authored
refactor: migrate webpack configuration to ESM format and enhance build process (#27)
* refactor: migrate webpack configuration to ESM format and enhance build process - Updated webpack.config.js to use modern ESM syntax and added new plugins for optimization. - Configured caching, improved source maps, and added support for top-level await. - Enhanced devServer settings for better development experience. - Switched from babel-loader to swc-loader for TypeScript compilation. - Introduced CssMinimizerPlugin for CSS optimization and CompressionPlugin for gzip compression. - Added dotenv-webpack for environment variable management. - Created a new .env file for environment variables. * chore: migrate to pnpm for package management and update workflows * chore: migrate ESLint configuration from .eslintrc.js to .eslintrc.json * Refactor tests to remove concurrent execution and update option count in FormField tests; make icons optional in WizardHeaderProps; update Vitest configuration for coverage reporting. * fix: update timestamp in coverage report footer * fix: disable watch mode and threads in Vitest configuration
1 parent 2ee6139 commit 02ab74f

File tree

19 files changed

+12779
-7113
lines changed

19 files changed

+12779
-7113
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Environment variables for react-wizardry
2+
NODE_ENV=development

.eslintrc.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

.eslintrc.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"plugin:react/recommended",
8+
"standard",
9+
"prettier",
10+
"plugin:react/jsx-runtime"
11+
],
12+
"parser": "@typescript-eslint/parser",
13+
"parserOptions": {
14+
"ecmaFeatures": {
15+
"jsx": true
16+
},
17+
"ecmaVersion": 12,
18+
"sourceType": "module"
19+
},
20+
"plugins": ["react", "@typescript-eslint", "sort-keys-fix"],
21+
"rules": {
22+
"react/jsx-sort-props": 1,
23+
"sort-keys": [
24+
"error",
25+
"asc",
26+
{
27+
"caseSensitive": true,
28+
"natural": true
29+
}
30+
],
31+
"sort-keys-fix/sort-keys-fix": "warn"
32+
},
33+
"settings": {
34+
"react": {
35+
"version": "detect"
36+
}
37+
}
38+
}

.github/workflows/test-and-lint.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,63 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
# Run workflow manually from the Actions tab
9+
workflow_dispatch:
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
1214

1315
strategy:
1416
matrix:
15-
node-version: [16.x]
17+
node-version: [18.x, 20.x]
1618

1719
steps:
18-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
1923

2024
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@v4
2226
with:
2327
node-version: ${{ matrix.node-version }}
2428

29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v2
31+
with:
32+
version: 8
33+
run_install: false
34+
35+
- name: Get pnpm store directory
36+
shell: bash
37+
run: |
38+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
39+
40+
- name: Setup pnpm cache
41+
uses: actions/cache@v3
42+
with:
43+
path: ${{ env.STORE_PATH }}
44+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-pnpm-store-
47+
48+
- name: Install dependencies
49+
run: pnpm install
50+
51+
- name: Lint
52+
run: pnpm run lint
53+
54+
- name: Test
55+
run: pnpm run test
56+
2557
- name: Build
26-
- run: npm install
27-
- run: npm run lint
28-
- run: npm run test
58+
run: pnpm run build
59+
60+
- name: Upload coverage reports to Codecov
61+
uses: codecov/codecov-action@v4
62+
with:
63+
file: ./coverage/coverage-final.json
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
slug: prabhuignoto/react-wizardry
66+
fail_ci_if_error: false
2967

.github/workflows/webpack.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,55 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
# Run workflow manually from the Actions tab
9+
workflow_dispatch:
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
1214

1315
strategy:
1416
matrix:
15-
node-version: [16.x]
17+
node-version: [18.x, 20.x]
1618

1719
steps:
18-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
1923

2024
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v3
25+
uses: actions/setup-node@v4
2226
with:
2327
node-version: ${{ matrix.node-version }}
2428

25-
- name: Build
29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v2
31+
with:
32+
version: 8
33+
run_install: false
34+
35+
- name: Get pnpm store directory
36+
shell: bash
2637
run: |
27-
npm install
28-
npm run build:prod
38+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
39+
40+
- name: Setup pnpm cache
41+
uses: actions/cache@v3
42+
with:
43+
path: ${{ env.STORE_PATH }}
44+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-pnpm-store-
47+
48+
- name: Install dependencies
49+
run: pnpm install
50+
51+
- name: Build with Webpack
52+
run: pnpm run build:prod
53+
54+
- name: Upload build artifacts
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: webpack-build-${{ matrix.node-version }}
58+
path: dist/
59+
retention-days: 7

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false
3+
auto-install-peers=true
4+
node-linker=hoisted

coverage/coverage-final.json

Lines changed: 34 additions & 19 deletions
Large diffs are not rendered by default.

coverage/favicon.png

-95 Bytes
Loading

0 commit comments

Comments
 (0)