Skip to content

Commit

Permalink
#65 Provide standalone modelserver-client
Browse files Browse the repository at this point in the history
- Move packages into dedicated `packages` dir
- Move downloading of theia plugins from root `package.json` to browser-app
- Introduce  root script for upgrading the fluent theia dependencies (`yarn ugprade:theia`)
- Upgrade effective Theia version  to 1.19.0 and swapt to ES2017 as default target.
Add mocha dependencies and add config

- Restructure repo and move packages and examples in dedicated directories
- Extract ModelServerClient from modelserver-theia into separate package
 Rework ModelServerClient API so that 
-- The API is iinline with the current Java API
-- The API returns concrete data objects instead of low level responses
-- Overrides are provided to retrieve typed results where suitable (#22)
-- The default impl uses  the well established axios  library for rest calls instead of a custom solution
-- The implementation is isomorph and can be used in both web  frontends and node backends.
-- Rework can clean up Subscriptions  API

- Provide generic mocha test setup
-  Add simple request tests for the modelserver client (using moxios)

Contributed on behalf of ST Microelectronics
  • Loading branch information
tortmayr committed Jan 5, 2022
1 parent bfd82e2 commit 245b1b2
Show file tree
Hide file tree
Showing 78 changed files with 6,416 additions and 8,026 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ node_modules
.browser_modules
lib
*.log
example/*-app/*
!example/*-app/package.json
examples/*-app/*
!examples/*-app/package.json

example/coffee-theia/build/*\.jar
examples/coffee-theia/build/*\.jar

plugins

.temp
38 changes: 32 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"type": "node",
"request": "launch",
"name": "Start Browser Backend",
"program": "${workspaceRoot}/example/browser-app/src-gen/backend/main.js",
"program": "${workspaceRoot}/examples/browser-app/src-gen/backend/main.js",
"args": [
"--loglevel=debug",
"--port=3000",
"--no-cluster",
"--root-dir=${workspaceRoot}/example/workspace",
"--app-project-path=${workspaceRoot}/example/browser-app",
"--root-dir=${workspaceRoot}/examples/workspace",
"--app-project-path=${workspaceRoot}/examples/browser-app",
"--plugins=local-dir:${workspaceRoot}/plugins"
],
"env": {
Expand All @@ -23,9 +23,9 @@
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/node_modules/@theia/*/lib/**/*.js",
"${workspaceRoot}/example/browser-app/lib/**/*.js",
"${workspaceRoot}/example/browser-app/src-gen/**/*.js",
"${workspaceRoot}/example/dev-example/lib/**/*.js",
"${workspaceRoot}/examples/browser-app/lib/**/*.js",
"${workspaceRoot}/examples/browser-app/src-gen/**/*.js",
"${workspaceRoot}/examples/dev-examples/lib/**/*.js",
"${workspaceRoot}/modelserver-theia/lib/**/*.js"
],
"smartStep": true,
Expand All @@ -39,6 +39,32 @@
"url": "http://localhost:3000/",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"type": "node",
"request": "launch",
"name": "Run current test",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": ["--config", "${workspaceFolder}/configs/.mocharc.json", "${file}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
},
{
"type": "node",
"request": "launch",
"name": "Run all tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--config",
"${workspaceFolder}/configs/.mocharc.json",
"--no-timeouts",
"${workspaceFolder}/packages/*/src/**/*.spec.ts"
],
"env": {
"TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.json"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
"label": "Start Theia Browser Backend",
"type": "shell",
"command": "cd example/browser-app && yarn start",
"command": "yarn start",
"presentation": {
"reveal": "always",
"panel": "new"
Expand Down Expand Up @@ -50,4 +50,4 @@
"problemMatcher": []
}
]
}
}
14 changes: 14 additions & 0 deletions configs/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/mocharc",
"require": [
"ts-node/register",
"reflect-metadata/Reflect"
],
"reporter": "spec",
"color": true,
"watch-files": [
"*.ts",
"*.tsx"
],
"timeout": 2000
}
1 change: 1 addition & 0 deletions configs/base.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@typescript-eslint",
"header",
"import",
"chai-friendly",
"no-null"
],
"extends": [
Expand Down
4 changes: 2 additions & 2 deletions configs/base.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"downlevelIteration": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"target": "ES2017",
"jsx": "react",
"lib": [
"es6",
"ES2017",
"dom"
],
"sourceMap": true
Expand Down
16 changes: 8 additions & 8 deletions configs/errors.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"no-caller": "error",
"no-eval": "error",
"no-redeclare": [
"error",
"off",
{
"builtinGlobals": false
}
Expand All @@ -28,12 +28,13 @@
],
"no-sequences": "error",
"no-throw-literal": "error",
"no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
"no-no-unused-expressions":"off",
"chai-friendly/no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
// Variables
"no-unused-vars": "off", // typescript-eslint rule activated instead
Expand Down Expand Up @@ -81,7 +82,6 @@
}
],
// @typescript-eslint/eslint-plugin
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-new": "error",
Expand Down
3 changes: 2 additions & 1 deletion configs/warnings.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"1tbs"
],
"comma-dangle": "warn",
"indent": [
"indent":"off",
"@typescript-eslint/indent": [
"warn",
4,
{
Expand Down
15 changes: 0 additions & 15 deletions example/coffee-theia/.eslintrc.js

This file was deleted.

15 changes: 0 additions & 15 deletions example/dev-example/.eslintrc.js

This file was deleted.

71 changes: 0 additions & 71 deletions example/dev-example/src/node/model-server-client.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,27 @@
"@modelserver/dev-example": "0.7.0"
},
"devDependencies": {
"@theia/cli": "latest"
"@theia/cli": "^1.0.0"
},
"scripts": {
"prepare": "yarn run clean && yarn build",
"prepare": "yarn clean && yarn build && yarn download:plugins",
"clean": "theia clean",
"build": "theia build --mode development",
"start": "theia start --plugins=local-dir:../../plugins --root-dir=../example/workspace",
"watch": "theia build --watch --mode development"
"start": "theia start --plugins=local-dir:./plugins --root-dir=../workspace",
"watch": "theia build --watch --mode development",
"download:plugins": "theia download:plugins"
},
"theia": {
"frontend": {
"config": {
"applicationName": "modelserver-theia Browser Example"
}
}
},
"theiaPluginsDir": "plugins",
"theiaPlugins": {
"vscode-builtin-json": "https://open-vsx.org/api/vscode/json/1.46.1/file/vscode.json-1.46.1.vsix",
"vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix",
"vscode-builtin-xml": "https://open-vsx.org/api/vscode/xml/1.44.2/file/vscode.xml-1.44.2.vsix"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"clean": "rimraf lib",
"build": "tsc && yarn run lint",
"download:server": "cd ./scripts && ./download-server.sh",
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src",
"lint": "eslint -c ../../.eslintrc.js --ext .ts ./src",
"watch": "tsc -w"
},
"theiaExtensions": [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR MIT
********************************************************************************/
import { LaunchOptions } from '@eclipse-emfcloud/modelserver-theia';
import { LaunchOptions } from '@eclipse-emfcloud/modelserver-theia/lib/node';
import { ContainerModule, injectable } from 'inversify';
import { join, resolve } from 'path';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prepare": "yarn run clean && yarn run build",
"clean": "rimraf lib",
"build": "tsc && yarn run lint",
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src",
"lint": "eslint -c ../../.eslintrc.js --ext .ts ./src",
"watch": "tsc -w"
},
"theiaExtensions": [
Expand Down
Loading

0 comments on commit 245b1b2

Please sign in to comment.