Skip to content

Commit 16e4d36

Browse files
authored
GH-1294: Fix packaging for node-json-vscode template (#211)
-Ensure that server bundle is copied to the extension dist on webpack build - Fix server module path resolution in `tasklist-extension` - Ensure that main entry of package.json points to dist entry file -Fix eslint setup - Update readme - Update launch configuration to fix sourcemaps resolving Fixes eclipse-glsp/glsp#1294
1 parent 1a4484f commit 16e4d36

11 files changed

Lines changed: 575 additions & 52 deletions

File tree

project-templates/node-json-vscode/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
lib
44
out
55
dist
6+
*.vsix

project-templates/node-json-vscode/.vscode/launch.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
"--extensionDevelopmentPath=${workspaceFolder}/tasklist-vscode/extension"
1515
],
1616
"outFiles": [
17-
"${workspaceFolder}/tasklist-vscode/extension/lib/*.js",
18-
"${workspaceFolder}/node_modules/@eclipse-glsp/*/lib/**/*.js",
19-
"${workspaceFolder}/node_modules/@eclipse-glsp/*/lib/*.js"
17+
"${workspaceFolder}/tasklist-vscode/extension/dist/*.js",
18+
"${workspaceFolder}/node_modules/@eclipse-glsp/**/*.js"
2019
],
21-
"sourceMaps": true
20+
"sourceMaps": true,
21+
"sourceMapPathOverrides": {
22+
"webpack://tasklist-vscode/(.+)": "${workspaceFolder}/tasklist-vscode/extension/$1"
23+
}
2224
},
2325
{
2426
"name": "Launch TaskList Diagram Extension (External GLSP Server)",
@@ -30,10 +32,13 @@
3032
"--extensionDevelopmentPath=${workspaceFolder}/tasklist-vscode/extension"
3133
],
3234
"outFiles": [
33-
"${workspaceFolder}/tasklist-vscode/extension/lib/*.js",
34-
"${workspaceFolder}/node_modules/@eclipse-glsp/*/lib/**/*.js"
35+
"${workspaceFolder}/tasklist-vscode/extension/dist/*.js",
36+
"${workspaceFolder}/node_modules/@eclipse-glsp/**/*.js"
3537
],
3638
"sourceMaps": true,
39+
"sourceMapPathOverrides": {
40+
"webpack://tasklist-vscode/(.+)": "${workspaceFolder}/tasklist-vscode/extension/$1"
41+
},
3742
"env": {
3843
"TASKLIST_SERVER_DEBUG": "true",
3944
"TASKLIST_SERVER_PORT": "5007"

project-templates/node-json-vscode/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,13 @@ Alternatively, you can also open the `Extension View` (Ctrl + Shift + X) and typ
4343

4444
## Building the example
4545

46-
The server component and the client component have to be built using `yarn`.
47-
A convenience script to build both is provided.
48-
To build all components execute the following in the directory containing this README:
46+
To build and bundle all components execute the following in the directory containing this README:
4947

5048
```bash
51-
yarn build
49+
yarn
5250
```
5351

54-
## Running the examples
52+
## Running the example
5553

5654
To start the example open the directory containing this README in VS Code and then navigate to the `Run and Debug` view (Ctrl + Shift + D).
5755
Here you can choose between four different launch configurations:
@@ -72,6 +70,16 @@ Here you can choose between four different launch configurations:
7270
`Tasklist GLSP server` process.
7371
Enables debugging of both the `glsp-client` and `glsp-server`code simultaneously.
7472

73+
## Packaging the example
74+
75+
To package the example extension as `*.vsix` execute the following in the directory containing this README:
76+
77+
```bash
78+
yarn package
79+
```
80+
81+
This will create a `tasklist-vscode-*.vsix` file (located in the [extension directory](./tasklist-vscode/extension/)) that can be installed in VS Code.
82+
7583
## Next steps
7684

7785
Once you are up and running with this project template, we recommend to refer to the [Getting Started](https://www.eclipse.org/glsp/documentation) to learn how to

project-templates/node-json-vscode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"clean": "lerna run clean",
3232
"lint": "lerna run lint",
3333
"lint:ci": "lerna run lint:ci",
34+
"package": "yarn --cwd tasklist-vscode/extension package",
3435
"prepare": "lerna run prepare",
3536
"watch": "lerna run --parallel watch"
3637
},

project-templates/node-json-vscode/tasklist-glsp-server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"devDependencies": {
4646
"@eclipse-glsp/server": "2.0.0",
4747
"inversify": "6.0.1",
48+
"reflect-metadata": "0.1.13",
4849
"source-map-loader": "^4.0.1",
4950
"webpack": "^5.88.2",
5051
"webpack-cli": "^5.1.4"

project-templates/node-json-vscode/tasklist-vscode/extension/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tasklist-vscode",
33
"displayName": "Tasklist GLSP Diagram Editor",
4-
"version": "1.0.0",
4+
"version": "2.0.0",
55
"private": "true",
66
"description": "Extension for Tasklist GLSP diagrams",
77
"categories": [
@@ -24,7 +24,7 @@
2424
}
2525
],
2626
"publisher": "Eclipse-GLSP",
27-
"main": "./lib/index",
27+
"main": "dist/tasklist-extension.js",
2828
"files": [
2929
"lib",
3030
"server",
@@ -163,6 +163,7 @@
163163
"@eclipse-glsp/vscode-integration": "2.0.0",
164164
"@types/node": "16.x",
165165
"@types/vscode": "^1.54.0",
166+
"@vscode/vsce": "^2.24.0",
166167
"copy-webpack-plugin": "^11.0.0",
167168
"path": "^0.12.7",
168169
"reflect-metadata": "^0.1.13",

project-templates/node-json-vscode/tasklist-vscode/extension/src/index.ts

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

project-templates/node-json-vscode/tasklist-vscode/extension/src/tasklist-extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*
1515
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR MIT
1616
********************************************************************************/
17+
import 'reflect-metadata';
18+
1719
import {
1820
configureDefaultCommands,
1921
GlspSocketServerLauncher,
@@ -22,10 +24,8 @@ import {
2224
} from '@eclipse-glsp/vscode-integration/node';
2325
import * as path from 'path';
2426
import * as process from 'process';
25-
import 'reflect-metadata';
2627
import * as vscode from 'vscode';
2728
import TaskListEditorProvider from './tasklist-editor-provider';
28-
const MODULE_PATH = require.resolve('tasklist-glsp-server');
2929
export const LOG_DIR = path.join(__dirname, '..', '..', 'logs');
3030

3131
const DEFAULT_SERVER_PORT = '0';
@@ -35,8 +35,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
3535
let serverProcess: GlspSocketServerLauncher | undefined;
3636

3737
if (process.env.TASKLIST_SERVER_DEBUG !== 'true') {
38+
const modulePath = vscode.Uri.joinPath(context.extensionUri, 'dist', 'tasklist-glsp-server.js').fsPath;
3839
serverProcess = new GlspSocketServerLauncher({
39-
executable: MODULE_PATH,
40+
executable: modulePath,
4041
socketConnectionOptions: { port: JSON.parse(process.env.TASKLIST_SERVER_PORT || DEFAULT_SERVER_PORT) },
4142
additionalArgs: ['--no-consoleLog', '--fileLog', '--logDir', LOG_DIR],
4243
logging: true

project-templates/node-json-vscode/tasklist-vscode/extension/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const config = {
3939
patterns: [
4040
{
4141
from: path.resolve(__dirname, '..', 'webview', 'dist')
42+
},
43+
{
44+
from: path.resolve(__dirname, '..', '..', 'tasklist-glsp-server', 'dist')
4245
}
4346
]
4447
})

project-templates/node-json-vscode/tsconfig.eslint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"noEmit": true
66
},
77
"exclude": ["**/node_modules", "**/.eslintrc.js"],
8-
"include": ["tasklist-glsp/src", "tasklist-vscode/*/src"]
8+
"include": ["tasklist-glsp-client/src", "tasklist-glsp-server/src", "tasklist-vscode/*/src"]
99
}

0 commit comments

Comments
 (0)