Skip to content

Commit f37f986

Browse files
authored
Minify bundles (#40)
* Use webpack to minify bundles
1 parent 793f6df commit f37f986

24 files changed

+888
-107
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Build
22

33
on:
4-
pull_request:
54
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
610
release:
711
types: published
812

@@ -61,7 +65,7 @@ jobs:
6165
generate_release_notes: true
6266
body: |
6367
# Summary
64-
See [changelog](https://github.com/PhilippeChab/nwscript-ee-language-server/blob/main/CHANGELOG.md)
68+
See the [Changelog](https://github.com/PhilippeChab/nwscript-ee-language-server/blob/main/CHANGELOG.md).
6569
name: ${{ github.ref_name }}
6670
fail_on_unmatched_files: true
6771
files: ${{ needs.build.outputs.vsixPath }}

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Tests
33
on:
44
pull_request:
55
push:
6+
branches:
7+
- main
8+
69
jobs:
710
tests:
811
name: Tests

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ dist
33
node_modules
44
tsconfig.tsbuildinfo
55
*.vsix
6-
server/resources/nwscript.nss
6+
server/scripts/nwscript.nss
77
yarn-error.log
88
.DS_Store
99
TODO.txt

.vscodeignore

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
.vscode/**
2-
client/src/**
3-
server/src/**
4-
!server/src/resources
2+
.github/**
53
.gitignore
64
.yarnrc
7-
webpack.config.js
85
**/tsconfig.json
96
**/.eslintrc.json
10-
test/**
11-
server/resources/nwscript.nss
12-
server/scripts
13-
server/test
7+
**/*.ts
8+
**/*.map
9+
shared.webpack.config.js
1410
images/**
1511
TODO.txt
12+
*.vsix
13+
14+
client/**
15+
server/**
16+
!client/out/extension.js
17+
!server/out/server.js
18+
!server/out/indexer.js
19+
!server/resources/**

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ All notable changes to the "nwscript-ee-language-server" extension will be docum
3535
## [1.4.2]
3636

3737
- Fixed a few issues with the tokenizer
38+
39+
## [1.5.0]
40+
41+
- The extension size has been lowered from 14.7 to 4.8 MB.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
![Build](https://github.com/PhilippeChab/nwscript-ee-language-server/actions/workflows/build.yml/badge.svg)
44
![Tests](https://github.com/PhilippeChab/nwscript-ee-language-server/actions/workflows/tests.yml/badge.svg)
55

6-
76
NWScript: EE Language Server is a Visual Studio Code extension LSP for the NWScript language.
87

98
While it seems to work well, even in bigger and older code bases, it is still an early project and there might be some unintended behaviours.
@@ -74,7 +73,7 @@ Notes:
7473

7574
Notes:
7675

77-
- The executable setting must either bet set to you path executable's identifier, or its absolute path.
76+
- The executable setting must either bet set to your path executable's identifier, or its absolute path.
7877
- The style object must respect clang-format [rules](https://clang.llvm.org/docs/ClangFormatStyleOptions.html).
7978

8079
### Diagnostics
@@ -114,7 +113,7 @@ I personally use the [One Dark Pro](https://marketplace.visualstudio.com/items?i
114113

115114
### Generating the language library definitions
116115

117-
Replace `server/resources/nwscript.nss` by its new version and execute `yarn run generate-lib-defs` in the server root directory.
116+
Replace `server/scripts/nwscript.nss` by its new version and execute `yarn run generate-lib-defs` in the server root directory.
118117

119118
## Issues
120119

client/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
},
1313
"include": ["src"],
1414
"exclude": ["node_modules"]
15-
}
15+
}

client/webpack.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
const withDefaults = require('../shared.webpack.config');
4+
const path = require('path');
5+
6+
module.exports = withDefaults({
7+
context: path.join(__dirname),
8+
entry: {
9+
extension: './src/extension.ts',
10+
},
11+
resolve: {
12+
symlinks: false
13+
},
14+
output: {
15+
filename: 'extension.js',
16+
path: path.join(__dirname, 'out')
17+
}
18+
});

package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/PhilippeChab/nwscript-ee-language-server"
99
},
1010
"license": "MIT",
11-
"version": "1.4.3",
11+
"version": "1.5.0",
1212
"author": {
1313
"name": "Philippe Chabot"
1414
},
@@ -134,20 +134,29 @@
134134
}
135135
},
136136
"scripts": {
137-
"vscode:prepublish": "yarn package",
137+
"vscode:prepublish": "yarn webpack",
138+
"webpack": "yarn clean && webpack --mode production --config ./client/webpack.config.js && webpack --mode production --config ./server/webpack.config.js",
139+
"webpack:dev": "yarn clean && webpack --mode none --config ./client/webpack.config.js && webpack --mode none --config ./server/webpack.config.js",
138140
"compile": "tsc -b",
141+
"compile:client": "tsc -b ./client/tsconfig.json",
142+
"compile:server": "tsc -b ./server/tsconfig.json",
139143
"watch": "tsc -b -w",
140-
"package": "yarn compile",
141144
"lint": "eslint ./client/src ./server/src --ext .ts",
142145
"postinstall": "cd client && yarn install && cd ../server && yarn install && cd ..",
143-
"test": "cd server && yarn test"
146+
"test": "cd server && yarn test && cd ..",
147+
"clean": "rimraf client/out && rimraf server/out"
144148
},
145149
"devDependencies": {
146150
"@types/node": "14.x",
147151
"@typescript-eslint/eslint-plugin": "^5.21.0",
148152
"@typescript-eslint/parser": "^5.21.0",
149153
"eslint": "^8.14.0",
154+
"merge-options": "^3.0.4",
150155
"prettier": "^2.6.2",
151-
"typescript": "^4.6.4"
156+
"rimraf": "^3.0.2",
157+
"ts-loader": "^9.3.1",
158+
"typescript": "^4.6.4",
159+
"webpack": "^5.74.0",
160+
"webpack-cli": "^4.10.0"
152161
}
153162
}

server/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,14 @@
2727
"vscode-languageserver": "^7.0.0",
2828
"vscode-languageserver-textdocument": "^1.0.4",
2929
"vscode-oniguruma": "^1.6.1",
30-
"vscode-textmate": "^7.0.1",
31-
"zeromq": "6.0.0-beta.6"
30+
"vscode-textmate": "^7.0.1"
3231
},
3332
"devDependencies": {
3433
"@types/chai": "^4.3.3",
3534
"@types/glob": "^7.2.0",
3635
"@types/mocha": "^9.1.1",
3736
"@types/node": "^17.0.35",
3837
"@types/sax": "^1.2.4",
39-
"@types/zeromq": "^5.2.1",
4038
"chai": "^4.3.6",
4139
"mocha": "^10.0.0",
4240
"ts-node": "^10.7.0"

0 commit comments

Comments
 (0)