Skip to content

Commit

Permalink
migration
Browse files Browse the repository at this point in the history
Issue #303
  • Loading branch information
rsoika committed Dec 13, 2023
1 parent 2700bc7 commit d14cb57
Show file tree
Hide file tree
Showing 28 changed files with 1,485 additions and 706 deletions.
21 changes: 8 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,30 @@
"args": [
"--port",
"5007"
],
"vmArgs": [
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
],
"console": "internalConsole",
"internalConsoleOptions": "openOnSessionStart"
]
},
{
"type": "node",
"runtimeVersion": "18.11.0",
"request": "launch",
"name": "Launch Workflow Theia Backend (External GLSP Server)",
"name": "Launch Theia Frontentd (External GLSP Server)",
"program": "${workspaceRoot}/open-bpmn.glsp-client/open-bpmn-app/src-gen/backend/main.js",
"args": [
"--loglevel=debug",
"--hostname=localhost",
"--GLSP_PORT=5007",
"--port=3000",
"--no-cluster",
"--WF_GLSP=5007",
"--loglevel=debug",
"--debug",
"--app-project-path=${workspaceRoot}/open-bpmn.glsp-client/open-bpmn-app",
"--root-dir=${workspaceRoot}/open-bpmn.glsp-client/workspace"
"--root-dir=${workspaceRoot}/open-bpmn.glsp-client/workspace",
"--app-project-path=${workspaceRoot}/open-bpmn.glsp-client/open-bpmn-app"
],
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/open-bpmn.glsp-client/node_modules/@theia/*/lib/**/*.js",
"${workspaceRoot}/open-bpmn.glsp-client/node_modules/@eclipse-glsp/*/lib/**/*.js",
"${workspaceRoot}/open-bpmn.glsp-client/open-bpmn-app/lib/**/*.js",
"${workspaceRoot}/open-bpmn.glsp-client/open-bpmn-theia/lib/**/*.js",
"${workspaceRoot}/open-bpmn.glsp-client/open-bpmn-glsp/lib/**/*.js",
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ You will find more details in the [Client Section](./open-bpmn.glsp-client/READM

### NodeJS

We use nodejs on Linux Debian during development. To manage version of nodejs in debian see: https://phoenixnap.com/kb/update-node-js-version
For development the JavaScript tools [Node.js](https://nodejs.org/en/about) and [yarn](https://yarnpkg.com/) need to be installed in the correct version.
Using the Node Version Manager (NVM) you can easily manage multiple versions of Node.js on a single machine. It’s an essential tool for development with Node.js as it allows you to switch between different versions of Node.js without having to go through the hassle of installing or uninstalling Node.js manually each time.
To use nvm in Debian 12 run:

For development with Eclipse Theia the expected version is ">=10.11.0 <17". For that reason we tested with following version 16.11.0. You can list all current versions [here](https://nodejs.org/en/download/releases/).
$ sudo apt install build-essential libssl-dev
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

In case you have install npm you can install a specific nodejs version with:
Now you can install a specific version of Node.js using the nvm install command, followed by the version number. For example, to install Node.js 18, you would type:

$ sudo n 16.11.0
$ nvm install 18

To install typescript run:
You can list all available version with:

$ nvm ls-remote

We currently are using 18.17.1 for development.

$ sudo npm install -g typescript
21 changes: 20 additions & 1 deletion open-bpmn.glsp-client/open-bpmn-app/gen-webpack.node.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const ignoredResources = new Set();

if (process.platform !== 'win32') {
ignoredResources.add('@vscode/windows-ca-certs');
ignoredResources.add('@vscode/windows-ca-certs/build/Release/crypt32.node');
}

const nativePlugin = new NativeWebpackPlugin({
Expand Down Expand Up @@ -98,7 +99,7 @@ const config = {
]
},
plugins: [
// Some native dependencies (bindings, @vscode/ripgrep) need special code replacements
// Some native dependencies need special handling
nativePlugin,
// Optional node dependencies can be safely ignored
new webpack.IgnorePlugin({
Expand All @@ -118,6 +119,24 @@ const config = {
})
]
},
ignoreWarnings: [
// Some packages do not have source maps, that's ok
/Failed to parse source map/,
// Some packages use dynamic requires, we can safely ignore them (they are handled by the native webpack plugin)
/require function is used in a way in which dependencies cannot be statically extracted/, {
module: /yargs/
}, {
module: /node-pty/
}, {
module: /require-main-filename/
}, {
module: /ws/
}, {
module: /express/
}, {
module: /cross-spawn/
}
]
};

module.exports = {
Expand Down
24 changes: 12 additions & 12 deletions open-bpmn.glsp-client/open-bpmn-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
},
"dependencies": {
"@open-bpmn/open-bpmn-theia": "1.2.0",
"@theia/core": "1.39.0",
"@theia/editor": "1.39.0",
"@theia/filesystem": "1.39.0",
"@theia/markers": "1.39.0",
"@theia/messages": "1.39.0",
"@theia/monaco": "1.39.0",
"@theia/navigator": "1.39.0",
"@theia/preferences": "1.39.0",
"@theia/process": "1.39.0",
"@theia/terminal": "1.39.0",
"@theia/workspace": "1.39.0"
"@theia/core": "1.43.1",
"@theia/editor": "1.43.1",
"@theia/filesystem": "1.43.1",
"@theia/markers": "1.43.1",
"@theia/messages": "1.43.1",
"@theia/monaco": "1.43.1",
"@theia/navigator": "1.43.1",
"@theia/preferences": "1.43.1",
"@theia/process": "1.43.1",
"@theia/terminal": "1.43.1",
"@theia/workspace": "1.43.1"
},
"devDependencies": {
"@theia/cli": "1.39.0"
"@theia/cli": "1.43.1"
},
"theia": {
"target": "browser"
Expand Down
4 changes: 2 additions & 2 deletions open-bpmn.glsp-client/open-bpmn-app/src-gen/backend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ BackendApplicationConfigProvider.set({
const serverModule = require('./server');
const serverAddress = main.start(serverModule());

serverAddress.then(({ port, address }) => {
serverAddress.then(({ port, address, family }) => {
if (process && process.send) {
process.send({ port, address });
process.send({ port, address, family });
}
});

Expand Down
42 changes: 22 additions & 20 deletions open-bpmn.glsp-client/open-bpmn-app/src-gen/backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,37 @@ function defaultServeStatic(app) {
}

function load(raw) {
return Promise.resolve(raw.default).then(
module => container.load(module)
return Promise.resolve(raw).then(
module => container.load(module.default)
);
}

function start(port, host, argv = process.argv) {
async function start(port, host, argv = process.argv) {
if (!container.isBound(BackendApplicationServer)) {
container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic });
}
return container.get(CliManager).initializeCli(argv).then(() => {
return container.get(BackendApplication).start(port, host);
});
await container.get(CliManager).initializeCli(argv);
return container.get(BackendApplication).start(port, host);
}

module.exports = (port, host, argv) => Promise.resolve()
.then(function () { return Promise.resolve(require('@theia/core/lib/node/i18n/i18n-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/core/lib/node/hosting/backend-hosting-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/core/lib/node/request/backend-request-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/filesystem/lib/node/filesystem-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/filesystem/lib/node/download/file-download-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/workspace/lib/node/workspace-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@eclipse-glsp/theia-integration/lib/node/theia-integration-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@open-bpmn/open-bpmn-theia/lib/node/bpmn-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/process/lib/common/process-common-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/process/lib/node/process-backend-module')).then(load) })
.then(function () { return Promise.resolve(require('@theia/terminal/lib/node/terminal-backend-module')).then(load) })
.then(() => start(port, host, argv)).catch(error => {
module.exports = async (port, host, argv) => {
try {
await load(require('@theia/core/lib/node/i18n/i18n-backend-module'));
await load(require('@theia/core/lib/node/hosting/backend-hosting-module'));
await load(require('@theia/core/lib/node/request/backend-request-module'));
await load(require('@theia/filesystem/lib/node/filesystem-backend-module'));
await load(require('@theia/filesystem/lib/node/download/file-download-backend-module'));
await load(require('@theia/workspace/lib/node/workspace-backend-module'));
await load(require('@eclipse-glsp/theia-integration/lib/node/theia-integration-backend-module'));
await load(require('@open-bpmn/open-bpmn-theia/lib/node/bpmn-backend-module'));
await load(require('@theia/process/lib/common/process-common-module'));
await load(require('@theia/process/lib/node/process-backend-module'));
await load(require('@theia/terminal/lib/node/terminal-backend-module'));
return await start(port, host, argv);
} catch (error) {
console.error('Failed to start the backend application:');
console.error(error);
process.exitCode = 1;
throw error;
});
}
}
100 changes: 58 additions & 42 deletions open-bpmn.glsp-client/open-bpmn-app/src-gen/frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ FrontendApplicationConfigProvider.set({
},
"defaultIconTheme": "theia-file-icons",
"electron": {
"windowOptions": {}
"windowOptions": {},
"showWindowEarly": true
},
"defaultLocale": "",
"validatePreferencesSchema": true
Expand All @@ -26,57 +27,72 @@ self.MonacoEnvironment = {
}
}

const preloader = require('@theia/core/lib/browser/preloader');
function load(container, jsModule) {
return Promise.resolve(jsModule)
.then(containerModule => container.load(containerModule.default));
}

// We need to fetch some data from the backend before the frontend starts (nls, os)
module.exports = preloader.preload().then(() => {
const { FrontendApplication } = require('@theia/core/lib/browser');
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
async function preload(parent) {
const container = new Container();
container.parent = parent;
try {
await load(container, import('@theia/core/lib/browser/preload/preload-module'));
const { Preloader } = require('@theia/core/lib/browser/preload/preloader');
const preloader = container.get(Preloader);
await preloader.initialize();
} catch (reason) {
console.error('Failed to run preload scripts.');
if (reason) {
console.error(reason);
}
}
}

module.exports = (async () => {
const { messagingFrontendModule } = require('@theia/core/lib/browser/messaging/messaging-frontend-module');
const container = new Container();
container.load(messagingFrontendModule);
await preload(container);
const { FrontendApplication } = require('@theia/core/lib/browser');
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
const { loggerFrontendModule } = require('@theia/core/lib/browser/logger-frontend-module');

const container = new Container();
container.load(frontendApplicationModule);
container.load(messagingFrontendModule);
container.load(loggerFrontendModule);

return Promise.resolve()
.then(function () { return import('@theia/core/lib/browser/i18n/i18n-frontend-module').then(load) })
.then(function () { return import('@theia/core/lib/browser/menu/browser-menu-module').then(load) })
.then(function () { return import('@theia/core/lib/browser/window/browser-window-module').then(load) })
.then(function () { return import('@theia/core/lib/browser/keyboard/browser-keyboard-module').then(load) })
.then(function () { return import('@theia/core/lib/browser/request/browser-request-module').then(load) })
.then(function () { return import('@theia/filesystem/lib/browser/filesystem-frontend-module').then(load) })
.then(function () { return import('@theia/filesystem/lib/browser/download/file-download-frontend-module').then(load) })
.then(function () { return import('@theia/filesystem/lib/browser/file-dialog/file-dialog-module').then(load) })
.then(function () { return import('@theia/messages/lib/browser/messages-frontend-module').then(load) })
.then(function () { return import('@theia/variable-resolver/lib/browser/variable-resolver-frontend-module').then(load) })
.then(function () { return import('@theia/editor/lib/browser/editor-frontend-module').then(load) })
.then(function () { return import('@theia/workspace/lib/browser/workspace-frontend-module').then(load) })
.then(function () { return import('@theia/markers/lib/browser/problem/problem-frontend-module').then(load) })
.then(function () { return import('@theia/outline-view/lib/browser/outline-view-frontend-module').then(load) })
.then(function () { return import('@theia/monaco/lib/browser/monaco-frontend-module').then(load) })
.then(function () { return import('@eclipse-glsp/theia-integration/lib/browser/theia-integration-frontend-module').then(load) })
.then(function () { return import('@open-bpmn/open-bpmn-theia/lib/browser/bpmn-frontend-module').then(load) })
.then(function () { return import('@theia/navigator/lib/browser/navigator-frontend-module').then(load) })
.then(function () { return import('@theia/userstorage/lib/browser/user-storage-frontend-module').then(load) })
.then(function () { return import('@theia/preferences/lib/browser/preference-frontend-module').then(load) })
.then(function () { return import('@theia/process/lib/common/process-common-module').then(load) })
.then(function () { return import('@theia/terminal/lib/browser/terminal-frontend-module').then(load) })
.then(start).catch(reason => {
console.error('Failed to start the frontend application.');
if (reason) {
console.error(reason);
}
});

function load(jsModule) {
return Promise.resolve(jsModule.default)
.then(containerModule => container.load(containerModule));
try {
await load(container, import('@theia/core/lib/browser/i18n/i18n-frontend-module'));
await load(container, import('@theia/core/lib/browser/menu/browser-menu-module'));
await load(container, import('@theia/core/lib/browser/window/browser-window-module'));
await load(container, import('@theia/core/lib/browser/keyboard/browser-keyboard-module'));
await load(container, import('@theia/core/lib/browser/request/browser-request-module'));
await load(container, import('@theia/filesystem/lib/browser/filesystem-frontend-module'));
await load(container, import('@theia/filesystem/lib/browser/download/file-download-frontend-module'));
await load(container, import('@theia/filesystem/lib/browser/file-dialog/file-dialog-module'));
await load(container, import('@theia/messages/lib/browser/messages-frontend-module'));
await load(container, import('@theia/variable-resolver/lib/browser/variable-resolver-frontend-module'));
await load(container, import('@theia/editor/lib/browser/editor-frontend-module'));
await load(container, import('@theia/workspace/lib/browser/workspace-frontend-module'));
await load(container, import('@theia/markers/lib/browser/problem/problem-frontend-module'));
await load(container, import('@theia/outline-view/lib/browser/outline-view-frontend-module'));
await load(container, import('@theia/monaco/lib/browser/monaco-frontend-module'));
await load(container, import('@eclipse-glsp/theia-integration/lib/browser/theia-integration-frontend-module'));
await load(container, import('@open-bpmn/open-bpmn-theia/lib/browser/bpmn-frontend-module'));
await load(container, import('@theia/navigator/lib/browser/navigator-frontend-module'));
await load(container, import('@theia/userstorage/lib/browser/user-storage-frontend-module'));
await load(container, import('@theia/preferences/lib/browser/preference-frontend-module'));
await load(container, import('@theia/process/lib/common/process-common-module'));
await load(container, import('@theia/terminal/lib/browser/terminal-frontend-module'));
await start();
} catch (reason) {
console.error('Failed to start the frontend application.');
if (reason) {
console.error(reason);
}
}

function start() {
(window['theia'] = window['theia'] || {}).container = container;
return container.get(FrontendApplication).start();
}
});
})();
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
require('reflect-metadata');
const { Container } = require('inversify');

const preloader = require('@theia/core/lib/browser/preloader');

module.exports = Promise.resolve().then(() => {
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
const container = new Container();
container.load(frontendApplicationModule);

container.load(require('@theia/terminal/lib/browser/terminal-frontend-module').default);
});
Loading

0 comments on commit d14cb57

Please sign in to comment.