Skip to content

Commit a5b29f8

Browse files
committed
Update configuration. Update packages.
1 parent af261cf commit a5b29f8

File tree

4 files changed

+64
-48
lines changed

4 files changed

+64
-48
lines changed

.github/workflows/gh-pages-deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Webpack build to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Use Node.js 16.x
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: '16.x'
18+
19+
- name: Build
20+
run: |
21+
npm install
22+
npm run build
23+
24+
- name: Deploy
25+
uses: peaceiris/actions-gh-pages@v3
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
publish_dir: ./dist
29+
publish_branch: gh-pages

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
node_modules
22
dist
3-
package-lock.json

package.json

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
{
2-
"version": "1.0.1",
3-
"scripts": {
4-
"build": "webpack --mode production",
5-
"start": "webpack-dev-server"
6-
},
7-
"license": "Custom",
8-
"private": true,
9-
"main": "./src/index.js",
10-
"devDependencies": {
11-
"copy-webpack-plugin": "^6.0.2",
12-
"html-webpack-plugin": "^3.2.0",
13-
"webpack-cli": "^3.3.10",
14-
"webpack-dev-server": "^3.9.0"
15-
},
16-
"dependencies": {
17-
"@arction/lcjs": "^3.3.0",
18-
"@arction/xydata": "^1.4.0",
19-
"clean-webpack-plugin": "^3.0.0",
20-
"webpack": "^4.41.2",
21-
"webpack-stream": "^5.2.1"
22-
}
23-
}
1+
{
2+
"version": "2.0.0",
3+
"scripts": {
4+
"build": "webpack --mode production",
5+
"start": "webpack serve"
6+
},
7+
"license": "Custom",
8+
"private": true,
9+
"main": "./src/index.js",
10+
"devDependencies": {
11+
"clean-webpack-plugin": "^4.0.0",
12+
"copy-webpack-plugin": "^10.0.0",
13+
"html-webpack-plugin": "^5.5.0",
14+
"webpack": "^5.64.4",
15+
"webpack-cli": "^4.9.1",
16+
"webpack-dev-server": "^4.6.0",
17+
"webpack-stream": "^7.0.0"
18+
},
19+
"dependencies": {
20+
"@arction/lcjs": "^3.3.0",
21+
"@arction/xydata": "^1.4.0"
22+
},
23+
"lightningChart": {
24+
"eID": "0465"
25+
}
26+
}

webpack.config.js

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,9 @@ module.exports = {
1313
entry: {
1414
app: packageJSON.main
1515
},
16-
node: {
17-
buffer: false,
18-
setImmediate: false
19-
},
2016
devServer: {
21-
contentBase: outputPath,
17+
static: outputPath,
2218
compress: true,
23-
// handle asset renaming
24-
before: function(app, server, compiler){
25-
app.get('/examples/assets/*', (req, res, next)=>{
26-
if(req.originalUrl.match(/lcjs_example_\d*_\w*-/g)){
27-
res.redirect(req.originalUrl.replace(/lcjs_example_\d*_\w*-/g,''))
28-
}
29-
else{
30-
next()
31-
}
32-
})
33-
}
3419
},
3520
resolve: {
3621
modules: [
@@ -48,15 +33,15 @@ module.exports = {
4833
splitChunks: {
4934
chunks: 'all',
5035
cacheGroups: {
51-
// make separate 'vendor' chunk that contains any depenedencies
36+
// make separate 'vendor' chunk that contains any dependencies
5237
// allows for smaller file sizes and faster builds
5338
vendor: {
54-
test: /node_modules/,
55-
chunks: 'initial',
56-
name: 'vendor',
57-
priority: 10,
58-
enforce: true
59-
}
39+
test: /[\\/]node_modules[\\/]/,
40+
chunks: 'initial',
41+
name: 'vendor',
42+
priority: -10,
43+
reuseExistingChunk: true,
44+
},
6045
}
6146
},
6247
runtimeChunk: 'single'
@@ -69,7 +54,7 @@ module.exports = {
6954
}),
7055
new CopyWebpackPlugin({
7156
patterns: [
72-
{ from: './assets/**/*', to: './examples/assets', flatten: true, noErrorOnMissing: true },
57+
{ from: './assets/**/*', to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`, noErrorOnMissing: true },
7358
{ from: './node_modules/@arction/lcjs/dist/resources', to: 'resources', noErrorOnMissing: true },
7459
]
7560
})

0 commit comments

Comments
 (0)