Skip to content

Commit ac84bae

Browse files
committed
[fix] Improve CI coverage and fix webpack configurations
- Update CI to use matrix strategy for 'dev' (unit+browser), 'prod' (browser), and 'echarts-only' (browser) builds. - Remove unsafe Terser optimizations to ensure stability. - Fix 'InjectLeafletLoaderPlugin' regex to prevent accidental removal of plugin scripts. - Use 'http-server' via npx in CI for serving production builds. Signed-off-by: Sankalp <sankalp.nex@gmail.com>
1 parent 9ec1d62 commit ac84bae

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ jobs:
4949
run: ./run-qa-checks
5050

5151
build:
52-
name: Tests and Coverage
52+
name: Tests and Coverage (${{ matrix.build-type }})
5353
runs-on: ubuntu-latest
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
build-type: [dev, prod, echarts-only]
5458

5559
steps:
5660
- uses: actions/checkout@v6
@@ -76,9 +80,22 @@ jobs:
7680
run: |
7781
yarn install
7882
79-
- name: Running Server
83+
- name: Build (Prod Full)
84+
if: matrix.build-type == 'prod'
85+
run: yarn build:full
86+
87+
- name: Build (Echarts Only)
88+
if: matrix.build-type == 'echarts-only'
89+
run: yarn build:echarts-only
90+
91+
- name: Running Server (Dev)
92+
if: matrix.build-type == 'dev'
8093
run: yarn start &
8194

95+
- name: Running Server (Dist)
96+
if: matrix.build-type == 'prod' || matrix.build-type == 'echarts-only'
97+
run: npx --yes http-server dist -p 8080 &
98+
8299
- name: Wait for server to be ready
83100
run: npx wait-on http://localhost:8080
84101

@@ -96,13 +113,15 @@ jobs:
96113
which chromedriver
97114
98115
- name: Unit tests
116+
if: matrix.build-type == 'dev'
99117
run: yarn coverage --testPathIgnorePatterns=test/netjsongraph.browser.test.js
100118

101119
- name: Browser tests
102120
# Test timeout set to 30 seconds in CI since it runs slower
103121
run: yarn test --runInBand --testTimeout=30000 test/netjsongraph.browser.test.js
104122

105123
- name: Coveralls
124+
if: matrix.build-type == 'dev'
106125
uses: coverallsapp/github-action@master
107126
with:
108127
github-token: ${{ secrets.GITHUB_TOKEN }}

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ <h1>NetJSONGraph.js Example Demos</h1>
242242
>
243243
</div>
244244

245-
246245
<div class="cards">
247246
<a href="./examples/netjsongraph-nodeExpand.html" target="_blank"
248247
>Nodes expand or fold</a

webpack-plugins/inject-leaflet-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ ${
173173
}
174174

175175
// Remove main leaflet.js script if present
176-
const leafletJSRegex = /<script[^>]*leaflet[^>]*>[\s\S]*?<\/script>/gi;
176+
const leafletJSRegex = /<script[^>]*leaflet\.js[^>]*>[\s\S]*?<\/script>/gi;
177177
let prev;
178178
do {
179179
prev = html;

webpack.config.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ const getMinimizers = (isProduction) => {
4646
hoist_funs: true,
4747
hoist_vars: false,
4848
pure_getters: true,
49-
unsafe: true,
50-
unsafe_comps: true,
51-
unsafe_Function: true,
52-
unsafe_math: true,
53-
unsafe_proto: true,
54-
unsafe_regexp: true,
55-
unsafe_undefined: true,
5649
},
5750
output: {
5851
comments: false,

0 commit comments

Comments
 (0)