Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dependency management through npm #5

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"--loglevel=debug",
"--hostname=localhost",
"--no-cluster",
"--root-dir=${workspaceRoot}/examples/workspace",
"--app-project-path=${workspaceFolder}/applications/electron-app",
"--remote-debugging-port=9222",
"--no-app-auto-install",
Expand All @@ -49,6 +50,45 @@
"outputCapture": "std",
"stopOnEntry": true
},
{
"type": "node",
"request": "launch",
"name": "Launch CrossModel Browser Backend",
"program": "${workspaceRoot}/applications/browser-app/src-gen/backend/main.js",
"cwd": "${workspaceFolder}/applications/browser-app",
"protocol": "inspector",
"args": [
"${workspaceFolder}/applications/browser-app",
"--debug",
"--loglevel=debug",
"--hostname=localhost",
"--no-cluster",
"--root-dir=${workspaceRoot}/examples/workspace",
"--app-project-path=${workspaceFolder}/applications/browser-app",
"--no-app-auto-install",
"--plugins=local-dir:${workspaceFolder}/applications/browser-app/plugins"
],
"env": {
"NODE_ENV": "development",
"NODE_OPTIONS": "--enable-source-maps"
},
"sourceMaps": true,
"skipFiles": ["<node_internals>/**"],
"outFiles": [
"${workspaceFolder}/applications/electron-app/lib/**/*.js",
"${workspaceFolder}/applications/electron-app/src-gen/frontend/electron-main.js",
"${workspaceFolder}/applications/electron-app/src-gen/backend/server.js",
"${workspaceFolder}/applications/electron-app/src-gen/backend/main.js",
"${workspaceFolder}/extensions/*/out/**/*.js",
"${workspaceFolder}/packages/*/lib/**/*.js",
"${workspaceFolder}/node_modules/langium/lib/**/*.js",
"${workspaceFolder}/node_modules/@eclipse-glsp/*/lib/**/*.js"
],
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std",
"stopOnEntry": false
},
{
"name": "Run CrossModel Language in VS Code",
"type": "extensionHost",
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,24 @@ To package the application use

Depending on the platform, this will produce an executable or an installer for the application under `applications/electron-app/dist`.
Details about the packaging can be configured in `applications/electron-app/electron-builder.yml`.

## Example Workspace

Under `examples/workspace` we provide an example workspace with some demo packages containing entities, relationships and system diagrams.
Each package represents a dedicated system or library and may depend on other packages.

Using a known package structure - npm in our case - we can re-use large parts of the package management to download dependencies that are not locally available from an external package registry.
In order to test this behavior, we use verdaccio as a local npm registry that provides some models that are needed by our workspace packages.
You can start verdaccio using

yarn start:verdaccio

The local npm registry will be available under `http://localhost:4873/` where we already provide four packages by default.

After opening the workspace, you can install the necessary dependencies in the example workspace by opening a terminal in `examples/workspace` and execute

npm install

This should download all dependencies into dedicated `node_modules` directories within the workspace.

Currently there is still an issue where new files are not recognized automatically, so you need to reload your workspace once for all the dependencies to be properly recognized.
37 changes: 21 additions & 16 deletions applications/browser-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"scripts": {
"clean": "theia clean && rimraf lib && rimraf src-gen",
"prepare": "theia build --mode development",
"download:plugins": "theia download:plugins",
"prepare": "theia build --mode development && yarn download:plugins",
"rebuild": "theia rebuild:browser --cacheRoot ../..",
"start": "yarn rebuild && theia start --plugins=local-dir:plugins",
"watch": "theia build --watch --mode development"
Expand All @@ -25,22 +26,22 @@
"@crossbreeze/form-client": "0.0.0",
"@crossbreeze/glsp-client": "0.0.0",
"@crossbreeze/product": "0.0.0",
"@theia/core": "^1.34.2",
"@theia/editor": "^1.34.2",
"@theia/filesystem": "^1.34.2",
"@theia/markers": "^1.34.2",
"@theia/messages": "^1.34.2",
"@theia/monaco": "^1.34.2",
"@theia/navigator": "^1.34.2",
"@theia/plugin-ext": "^1.34.2",
"@theia/plugin-ext-vscode": "^1.34.2",
"@theia/preferences": "^1.34.2",
"@theia/process": "^1.34.2",
"@theia/terminal": "^1.34.2",
"@theia/workspace": "^1.34.2"
"@theia/core": "^1.34.4",
"@theia/editor": "^1.34.4",
"@theia/filesystem": "^1.34.4",
"@theia/markers": "^1.34.4",
"@theia/messages": "^1.34.4",
"@theia/monaco": "^1.34.4",
"@theia/navigator": "^1.34.4",
"@theia/plugin-ext": "^1.34.4",
"@theia/plugin-ext-vscode": "^1.34.4",
"@theia/preferences": "^1.34.4",
"@theia/process": "^1.34.4",
"@theia/terminal": "^1.34.4",
"@theia/workspace": "^1.34.4"
},
"devDependencies": {
"@theia/cli": "^1.34.2"
"@theia/cli": "^1.34.4"
},
"productName": "CrossModel Community Edition",
"theia": {
Expand All @@ -59,6 +60,10 @@
}
}
},
"theiaPlugins": {},
"theiaPlugins": {
"vscode.json-1.66.2": "https://open-vsx.org/api/vscode/json/1.66.2/file/vscode.json-1.66.2.vsix",
"vscode.json-language-features-1.66.2": "https://open-vsx.org/api/vscode/json-language-features/1.66.2/file/vscode.json-language-features-1.66.2.vsix",
"vscode.npm-1.66.2": "https://open-vsx.org/api/vscode/npm/1.66.2/file/vscode.npm-1.66.2.vsix"
},
"theiaPluginsDir": "plugins"
}
36 changes: 20 additions & 16 deletions applications/electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
"@crossbreeze/form-client": "0.0.0",
"@crossbreeze/glsp-client": "0.0.0",
"@crossbreeze/product": "0.0.0",
"@theia/core": "^1.34.2",
"@theia/editor": "^1.34.2",
"@theia/electron": "^1.34.2",
"@theia/filesystem": "^1.34.2",
"@theia/markers": "^1.34.2",
"@theia/messages": "^1.34.2",
"@theia/monaco": "^1.34.2",
"@theia/navigator": "^1.34.2",
"@theia/plugin-ext": "^1.34.2",
"@theia/plugin-ext-vscode": "^1.34.2",
"@theia/preferences": "^1.34.2",
"@theia/process": "^1.34.2",
"@theia/terminal": "^1.34.2",
"@theia/workspace": "^1.34.2"
"@theia/core": "^1.34.4",
"@theia/editor": "^1.34.4",
"@theia/electron": "^1.34.4",
"@theia/filesystem": "^1.34.4",
"@theia/markers": "^1.34.4",
"@theia/messages": "^1.34.4",
"@theia/monaco": "^1.34.4",
"@theia/navigator": "^1.34.4",
"@theia/plugin-ext": "^1.34.4",
"@theia/plugin-ext-vscode": "^1.34.4",
"@theia/preferences": "^1.34.4",
"@theia/process": "^1.34.4",
"@theia/terminal": "^1.34.4",
"@theia/workspace": "^1.34.4"
},
"devDependencies": {
"@theia/cli": "^1.34.2",
"@theia/cli": "^1.34.4",
"electron": "^15.3.5",
"electron-builder": "^23.6.0"
},
Expand All @@ -70,6 +70,10 @@
}
}
},
"theiaPlugins": {},
"theiaPlugins": {
"vscode.json-1.66.2": "https://open-vsx.org/api/vscode/json/1.66.2/file/vscode.json-1.66.2.vsix",
"vscode.json-language-features-1.66.2": "https://open-vsx.org/api/vscode/json-language-features/1.66.2/file/vscode.json-language-features-1.66.2.vsix",
"vscode.npm-1.66.2": "https://open-vsx.org/api/vscode/npm/1.66.2/file/vscode.npm-1.66.2.vsix"
},
"theiaPluginsDir": "plugins"
}
11 changes: 0 additions & 11 deletions examples/examples.theia-workspace

This file was deleted.

3 changes: 3 additions & 0 deletions examples/libraries/entities/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=http://localhost:4873/
//localhost:4873/:_authToken="fooBar"
always-auth=true
5 changes: 5 additions & 0 deletions examples/libraries/entities/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@crossbreeze/entities",
"version": "1.0.0",
"alias": "entities"
}
3 changes: 3 additions & 0 deletions examples/libraries/example-library/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=http://localhost:4873/
//localhost:4873/:_authToken="fooBar"
always-auth=true
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
entity C {
entity B {
description := "hello";
}
7 changes: 7 additions & 0 deletions examples/libraries/example-library/entities/entityC.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
entity C {
description := "hello";
attributes {
name := 'A';
}
}

5 changes: 5 additions & 0 deletions examples/libraries/example-library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@crossbreeze/example-library",
"version": "1.0.0",
"alias": "exampleLibrary"
}
24 changes: 24 additions & 0 deletions examples/libraries/example-library/views/system.diagram.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diagram {
node nodeA for A {
x := 10;
y := 10;
width := 76;
height := 32;
};
node nodeB for B {
x := 122;
y := 8;
width := 70;
height := 37;
};
node nodeD for D {
x := 222;
y := 11;
width := 77;
height := 33;
};
edge aToB for aToB {
source := nodeA;
target := nodeB;
};
}
3 changes: 3 additions & 0 deletions examples/libraries/relationships/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=http://localhost:4873/
//localhost:4873/:_authToken="fooBar"
always-auth=true
8 changes: 8 additions & 0 deletions examples/libraries/relationships/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@crossbreeze/relationships",
"version": "1.0.0",
"dependencies": {
"@crossbreeze/entities": "1.0.0"
},
"alias": "relationships"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
relationship aToB {
source := entities/A;
target := entities/B;
type := 1:1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
relationship cToD {
source := entities/C with entities/C.name;
target := entities/D;
type := 1:n;
}
3 changes: 3 additions & 0 deletions examples/libraries/system/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=http://localhost:4873/
//localhost:4873/:_authToken="fooBar"
always-auth=true
3 changes: 3 additions & 0 deletions examples/libraries/system/entities/entityE.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
entity E {
description := "hello";
}
8 changes: 8 additions & 0 deletions examples/libraries/system/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@crossbreeze/system",
"version": "1.0.0",
"dependencies": {
"@crossbreeze/relationships": "1.0.0"
},
"alias": "system"
}
24 changes: 24 additions & 0 deletions examples/libraries/system/views/system.diagram.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diagram {
node nodeA for entities/A {
x := 10;
y := 10;
width := 76;
height := 32;
};
node nodeB for entities/B {
x := 122;
y := 8;
width := 70;
height := 37;
};
node nodeD for E {
x := 222;
y := 11;
width := 77;
height := 33;
};
edge aToB for relationships/aToB {
source := nodeA;
target := nodeB;
};
}
1 change: 1 addition & 0 deletions examples/registry/.verdaccio-db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"list":["@crossbreeze/entities","@crossbreeze/system","@crossbreeze/relationships","@crossbreeze/example-library"],"secret":"60c39cc34e5c891842c84a74f177baa1cc229cc7a7d8594242f9ec131f7573ba"}
Binary file not shown.
40 changes: 40 additions & 0 deletions examples/registry/@crossbreeze/entities/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@crossbreeze/entities",
"versions": {
"1.0.0": {
"name": "@crossbreeze/entities",
"version": "1.0.0",
"alias": "entities",
"gitHead": "4e8796028c3ef56b5ecc5132b6cce37ac4bdb065",
"_id": "@crossbreeze/[email protected]",
"_nodeVersion": "16.19.1",
"_npmVersion": "8.19.3",
"dist": {
"integrity": "sha512-j3sLE+Pzupdmy93zYJk+XIrtetf+kdNG7/jFeUeM69CC1/HxizSn6N4uGNNhlkGsZCvkZ255mk5ZUSn0HJsqsQ==",
"shasum": "f7354a4bb2cd5d733f300cb74f8680f20ecd784f",
"tarball": "http://localhost:4873/@crossbreeze/entities/-/@crossbreeze/entities-1.0.0.tgz"
},
"contributors": []
}
},
"time": {
"modified": "2023-03-31T08:35:24.612Z",
"created": "2023-03-31T08:35:24.612Z",
"1.0.0": "2023-03-31T08:35:24.612Z"
},
"users": {},
"dist-tags": {
"latest": "1.0.0"
},
"_uplinks": {},
"_distfiles": {},
"_attachments": {
"entities-1.0.0.tgz": {
"shasum": "f7354a4bb2cd5d733f300cb74f8680f20ecd784f",
"version": "1.0.0"
}
},
"_rev": "3-4257dde6c56f0e26",
"_id": "@crossbreeze/entities",
"readme": "ERROR: No README data found!"
}
Binary file not shown.
Loading