Skip to content

Commit 51b8e06

Browse files
committed
Merge branch 'mr/1622-fix-packaging-vscode-extension' into 'master'
Fix packaging for VS Code extension See merge request eng/ide/ada_language_server!2073
2 parents 60b113e + 0774c58 commit 51b8e06

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

integration/vscode/ada/.vscodeignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.vscode-test/
44
advanced/
55
node_modules/
6-
out/test/
6+
out/
77
src/
88
test/
99
.eslintrc.json
@@ -19,4 +19,7 @@ vscode-test-win-workaround.py
1919
convert-mocha-junit-report.py
2020
unresolve.js
2121
!node_modules/@vscode/codicons/dist/codicon.css
22-
!node_modules/@vscode/codicons/dist/codicon.ttf
22+
!node_modules/@vscode/codicons/dist/codicon.ttf
23+
!out/src/visualizing/AppMain.js
24+
!out/src/extension.js
25+
!out/src/extension.js.map

integration/vscode/ada/CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ cd integration/vscode/ada; npm install
1414
And then use the task `npm: compile` for compilation and the launch
1515
configuration `Launch Extension` for local testing and debugging.
1616

17+
## Packaging
18+
19+
The extension is packaged using vsce.
20+
21+
When packaging, the npm script `vscode:prepublish` is called first which will in turn call scripts to bundle the code base.
22+
23+
The project is composed of two different bundles:
24+
25+
- The script `esbuild-base` will generate the bundle `extension.js` that contains all the extension itself. This script uses esbuild which will take the Typescript sources, compile them and bundle them into a single file.
26+
- The script `compile` will generate the bundle `AppMain.js` which serves as the entry point for the webViews generated by the extension. This script first compiles the Typescript sources using `tsc` separately and then uses `webpack` to bundle the resulting Javascript and CSS files.
27+
28+
The two bundles need to stay separated as the second one needs to have a clear path different from the first one to be able to generate the HTML of the webViews of the extension.
29+
30+
Finally, the two bundles are filtered in the `.vscodeignore` so that they are the only files added into the final package.
31+
1732
### macOS on Apple M1/M2 processors
1833

1934
On macOS with Apple M1/M2 processors, using a native arm64 `node`/`npm` will
@@ -76,4 +91,4 @@ Furthermore, classifications within `repository` should be kept in alphabetical
7691

7792
## Final Notes
7893

79-
Do not hesitate to ask for advice or help. *Any* working contributions are greatly appreciated.
94+
Do not hesitate to ask for advice or help. _Any_ working contributions are greatly appreciated.

integration/vscode/ada/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,9 +1507,10 @@
15071507
},
15081508
"scripts": {
15091509
"check-licenses": "npx license-checker-rseidelsohn --summary --onlyAllow \"0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;BlueOak-1.0.0;CC0-1.0;GPL-3.0;GPL-3.0-or-later;ISC;MIT;Python-2.0;Zlib;EPL-2.0\" --excludePackages \"@vscode/vsce-sign-linux-x64;@vscode/vsce-sign-win32-x64;@vscode/vsce-sign\"",
1510-
"vscode:prepublish": "npm run esbuild-base -- --minify --sourcemap",
1510+
"vscode:prepublish": "npm run compile && npm run esbuild-base -- --minify --sourcemap",
15111511
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/src/extension.js --external:vscode --format=cjs --platform=node",
1512-
"compile": "npm run copy && node ./node_modules/typescript/bin/tsc && webpack",
1512+
"compile": "node ./node_modules/typescript/bin/tsc && npm run compile-webview",
1513+
"compile-webview": "npm run copy && webpack",
15131514
"watch": "npm run copy && node ./node_modules/typescript/bin/tsc -watch",
15141515
"copy": "node -e \"fs.mkdirSync('out/src/visualizing', {recursive: true}); fs.copyFileSync('src/visualizing/visualizerStyleSheet.css','out/src/visualizing/visualizerStyleSheet.css')\"",
15151516
"pretest": "npm run compile",

0 commit comments

Comments
 (0)