Skip to content

Commit

Permalink
Add common Disposable API (#222)
Browse files Browse the repository at this point in the history
* Update to glsp dev package

+ Autoformat package.json files

* Add common Disposable API

Provide a reusable Disposable API similar to what Theia/VS Code uses
Fixes eclipse-glsp/glsp#867

* Update packages/protocol/src/utils/disposable.ts

Co-authored-by: Martin Fleck <mfleck@eclipsesource.com>
  • Loading branch information
tortmayr and martin-fleck-at committed Jan 24, 2023
1 parent 91b3a87 commit ee71b2a
Show file tree
Hide file tree
Showing 12 changed files with 477 additions and 131 deletions.
44 changes: 22 additions & 22 deletions examples/workflow-glsp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,53 @@
"name": "@eclipse-glsp-examples/workflow-glsp",
"version": "1.1.0-next",
"description": "GLSP diagrams for the Workflow DSL",
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"keywords": [
"glsp",
"workflow",
"diagram",
"example"
],
"author": {
"name": "Eclipse GLSP"
},
"homepage": "https://www.eclipse.org/glsp/",
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-glsp/glsp-client.git"
},
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"author": {
"name": "Eclipse GLSP"
},
"contributors": [
{
"name": "Eclipse GLSP Project",
"email": "glsp-dev@eclipse.org",
"url": "https://projects.eclipse.org/projects/ecd.glsp"
}
],
"dependencies": {
"@eclipse-glsp/client": "1.1.0-next",
"balloon-css": "^0.5.0"
},
"devDependencies": {
"mvn-artifact-download": "5.1.0"
},
"scripts": {
"clean": "rimraf tsconfig.tsbuildinfo lib",
"build": "tsc -b",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build ",
"watch": "tsc -w"
},
"main": "lib/index",
"types": "lib/index",
"files": [
"lib",
"src",
"build",
"css",
"scripts"
],
"main": "lib/index",
"types": "lib/index",
"scripts": {
"build": "tsc -b",
"clean": "rimraf tsconfig.tsbuildinfo lib",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build ",
"watch": "tsc -w"
},
"dependencies": {
"@eclipse-glsp/client": "1.1.0-next",
"balloon-css": "^0.5.0"
},
"devDependencies": {
"mvn-artifact-download": "5.1.0"
},
"publishConfig": {
"access": "public"
}
Expand Down
32 changes: 16 additions & 16 deletions examples/workflow-standalone/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
{
"private": true,
"name": "workflow-standalone",
"version": "1.1.0-next",
"private": true,
"description": "Standalone browser-app for the Workflow example",
"author": {
"name": "Eclipse GLSP"
},
"homepage": "https://www.eclipse.org/glsp/",
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-glsp/glsp-client.git"
},
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"author": {
"name": "Eclipse GLSP"
},
"contributors": [
{
"name": "Eclipse GLSP Project",
"email": "glsp-dev@eclipse.org",
"url": "https://projects.eclipse.org/projects/ecd.glsp"
}
],
"main": "lib",
"types": "lib",
"scripts": {
"build": "tsc -b && webpack",
"clean": "rimraf lib tsconfig.tsbuildinfo app/bundle.js app/bundle.js.map app/css",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build",
"watch": "tsc -w -p ./tsconfig.json"
},
"dependencies": {
"@eclipse-glsp-examples/workflow-glsp": "1.1.0-next",
"@eclipse-glsp/client": "1.1.0-next"
Expand All @@ -34,15 +44,5 @@
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc -b && webpack",
"clean": "rimraf lib tsconfig.tsbuildinfo app/bundle.js app/bundle.js.map app/css",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build",
"watch": "tsc -w -p ./tsconfig.json"
},
"types": "lib",
"main": "lib"
}
}
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"private": true,
"name": "parent",
"version": "1.0.0",
"engines": {
"yarn": ">=1.7.0 <2.x.x",
"node": ">=16.11.0"
},
"private": true,
"workspaces": [
"packages/*",
"examples/*"
],
"scripts": {
"all": "yarn install && yarn lint && yarn test",
"build": "lerna run build",
"check:headers": "glsp checkHeaders . -t lastCommit",
"check:pr": "yarn all && yarn check:headers",
"clean": "lerna run clean && rimraf coverage .nyc_output",
"download:exampleServer": "ts-node examples/workflow-glsp/scripts/download.ts",
"lint": "lerna run lint",
"lint:ci": "lerna run lint:ci",
"prepare": "lerna run prepare",
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
"publish:latest": "lerna publish from-git --no-git-reset --no-git-tag-version --no-verify-access --no-push",
"publish:next": "SHA=$(git rev-parse --short HEAD) && lerna publish preminor --exact --canary --preid next.${SHA} --dist-tag next --no-git-reset --no-git-tag-version --no-push --ignore-scripts --yes --no-verify-access",
"upgrade:next": "yarn upgrade -p \"@eclipse-glsp.*|sprotty.*\" --next ",
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
"test": "lerna run test",
"test:ci": "lerna run test:ci",
"test:coverage": "lerna run test:coverage",
"test:coverage:ci": "yarn glsp coverageReport .",
"upgrade:next": "yarn upgrade -p \"@eclipse-glsp.*|sprotty.*\" --next ",
"watch": "lerna run --parallel watch"
},
"devDependencies": {
"@eclipse-glsp/config": "1.1.0-next.e31f2e5.119",
"@eclipse-glsp/config-test": "1.1.0-next.e31f2e5.119",
"@eclipse-glsp/cli": "1.1.0-next.e31f2e5.119",
"@eclipse-glsp/dev": "1.1.0-next.164cf99.124",
"@types/node": "16.x"
},
"workspaces": [
"packages/*",
"examples/*"
]
"engines": {
"node": ">=16.11.0",
"yarn": ">=1.7.0 <2.x.x"
}
}
32 changes: 16 additions & 16 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@eclipse-glsp/client",
"version": "1.1.0-next",
"description": "A sprotty-based client for GLSP",
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"keywords": [
"eclipse",
"graphics",
Expand All @@ -12,35 +11,30 @@
"glsp",
"diagram editor"
],
"author": {
"name": "Eclipse GLSP"
},
"homepage": "https://www.eclipse.org/glsp/",
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-glsp/glsp-client.git"
},
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"author": {
"name": "Eclipse GLSP"
},
"contributors": [
{
"name": "Eclipse GLSP Project",
"email": "glsp-dev@eclipse.org",
"url": "https://projects.eclipse.org/projects/ecd.glsp"
}
],
"main": "lib/index",
"types": "lib/index",
"files": [
"lib",
"src",
"css"
],
"dependencies": {
"@eclipse-glsp/protocol": "1.1.0-next",
"autocompleter": "5.1.0",
"sprotty": "0.13.0-next.f4445dd.342"
},
"devDependencies": {
"@vscode/codicons": "^0.0.25"
},
"scripts": {
"build": "tsc -b",
"clean": "rimraf lib tsconfig.tsbuildinfo coverage .nyc_output",
Expand All @@ -52,9 +46,15 @@
"test:coverage": "nyc yarn test",
"watch": "tsc -w"
},
"dependencies": {
"@eclipse-glsp/protocol": "1.1.0-next",
"autocompleter": "5.1.0",
"sprotty": "0.13.0-next.f4445dd.342"
},
"devDependencies": {
"@vscode/codicons": "^0.0.25"
},
"publishConfig": {
"access": "public"
},
"main": "lib/index",
"types": "lib/index"
}
}
36 changes: 18 additions & 18 deletions packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@eclipse-glsp/protocol",
"version": "1.1.0-next",
"description": "The protocol definition for client-server communication in GLSP",
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"keywords": [
"eclipse",
"graphics",
Expand All @@ -12,48 +11,49 @@
"glsp",
"diagram editor"
],
"author": {
"name": "Eclipse GLSP"
},
"homepage": "https://www.eclipse.org/glsp/",
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"repository": {
"type": "git",
"url": "https://github.com/eclipse-glsp/glsp-client.git"
},
"bugs": "https://github.com/eclipse-glsp/glsp/issues",
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
"author": {
"name": "Eclipse GLSP"
},
"contributors": [
{
"name": "Eclipse GLSP Project",
"email": "glsp-dev@eclipse.org",
"url": "https://projects.eclipse.org/projects/ecd.glsp"
}
],
"main": "lib/index",
"types": "lib/index",
"files": [
"lib",
"src"
],
"dependencies": {
"sprotty-protocol": "0.13.0-next.f4445dd.342",
"vscode-ws-jsonrpc": "^2.0.1",
"uuid": "7.0.3"
},
"devDependencies": {
"@types/uuid": "3.4.5"
},
"scripts": {
"clean": "rimraf lib tsconfig.tsbuildinfo coverage .nyc_output ",
"build": "tsc -b",
"clean": "rimraf lib tsconfig.tsbuildinfo coverage .nyc_output ",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build",
"test": "mocha --config ../../.mocharc \"./src/**/*.spec.?(ts|tsx)\"",
"test:ci": "export JUNIT_REPORT_PATH=./report.xml && yarn test --reporter mocha-jenkins-reporter",
"test:coverage": "nyc yarn test",
"prepare": "yarn clean && yarn build",
"watch": "tsc -w"
},
"dependencies": {
"sprotty-protocol": "0.13.0-next.f4445dd.342",
"uuid": "7.0.3",
"vscode-ws-jsonrpc": "^2.0.1"
},
"devDependencies": {
"@types/uuid": "3.4.5"
},
"publishConfig": {
"access": "public"
},
"main": "lib/index",
"types": "lib/index"
}
}
3 changes: 2 additions & 1 deletion packages/protocol/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2020-2022 EclipseSource and others.
* Copyright (c) 2020-2023 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -53,5 +53,6 @@ export * from './jsonrpc/glsp-jsonrpc-client';
export * from './model/default-types';
export * from './model/model-schema';
export * from './utils/array-util';
export * from './utils/disposable';
export * from './utils/type-util';
export { SetBoundsAction, SetViewportAction };
4 changes: 2 additions & 2 deletions packages/protocol/src/jsonrpc/glsp-jsonrpc-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2020-2022 EclipseSource and others.
* Copyright (c) 2020-2023 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -22,8 +22,8 @@ import {
InitializeParameters,
InitializeResult
} from '../glsp-client';
import { MaybePromise } from '../utils/type-util';

export type MaybePromise<T> = T | Promise<T> | PromiseLike<T>;
export type ConnectionProvider = MessageConnection | (() => MaybePromise<MessageConnection>);

export namespace JsonrpcGLSPClient {
Expand Down
Loading

0 comments on commit ee71b2a

Please sign in to comment.