From 9287bf4decef96540927423b1b00606753e3012a Mon Sep 17 00:00:00 2001 From: kruplm <73655443+kruplm@users.noreply.github.com> Date: Tue, 21 Feb 2023 14:53:31 +0100 Subject: [PATCH 1/3] composeui-cli --- .../Shell/Node-launcher/Lib/README.md | 48 +++++++++++++++++++ .../Shell/Node-launcher/Lib/cli/cli.js | 14 ++++++ .../Shell/Node-launcher/Lib/package.json | 3 ++ Tryouts/Prototypes/Shell/Shell.csproj | 5 ++ Tryouts/package-lock.json | 7 +++ 5 files changed, 77 insertions(+) create mode 100644 Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md create mode 100644 Tryouts/Prototypes/Shell/Node-launcher/Lib/cli/cli.js diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md b/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md new file mode 100644 index 000000000..03e737a4f --- /dev/null +++ b/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md @@ -0,0 +1,48 @@ + + +# @morgan-stanley/ompose-node-launcher + +## Library + +The library enables you to dynmically set properties for your window in your javascript code. + +``` +function windowOpenExample() { + const window = new BrowserWindow( + { + url: "https://github.com/morganstanley/composeui", + title: "My Web App", + width: 1600, + height: 800 + }); + + window.open(); +} + + +windowOpenExample(); +``` + +Or with loadUrl + +``` +function loadUrlExample() { + const window = new BrowserWindow( + { + width: 1600, + height: 800 + }); + + window.loadUrl("https://github.com/morganstanley/composeui"); +} + +loadUrlExample(); +``` + +## CLI + +The CLI enables you to execute your app with compose by executing the following command: + +``` +composeui-cli myapp.js +``` diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Lib/cli/cli.js b/Tryouts/Prototypes/Shell/Node-launcher/Lib/cli/cli.js new file mode 100644 index 000000000..5e74c803f --- /dev/null +++ b/Tryouts/Prototypes/Shell/Node-launcher/Lib/cli/cli.js @@ -0,0 +1,14 @@ +#!/usr/bin/env node + +import { execFile } from 'child_process'; +import { resolve } from 'path'; + +let filename = process.argv.slice(2)[0]; +let filePath= resolve(filename); + +const child = execFile("node", [filePath], (error, stdout, stderr) => { + console.log(stdout); + if (error) { + throw error; + } +}); diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json b/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json index c51dda605..ab7373883 100644 --- a/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json +++ b/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json @@ -9,6 +9,9 @@ "clean": "rimraf output", "build": "npm run clean && tsc && rollup -c" }, + "bin": { + "composeui-cli": "./cli/cli.js" + }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-typescript": "11.0.0", diff --git a/Tryouts/Prototypes/Shell/Shell.csproj b/Tryouts/Prototypes/Shell/Shell.csproj index 101a349db..0ea2de881 100644 --- a/Tryouts/Prototypes/Shell/Shell.csproj +++ b/Tryouts/Prototypes/Shell/Shell.csproj @@ -11,9 +11,14 @@ + + + + + diff --git a/Tryouts/package-lock.json b/Tryouts/package-lock.json index 32bab62b6..9050685e4 100644 --- a/Tryouts/package-lock.json +++ b/Tryouts/package-lock.json @@ -23,7 +23,9 @@ "rxjs": "^7.8.0" }, "devDependencies": { + "@jest/expect-utils": "^29.4.1", "@types/jest": "^29.4.0", + "expect": "^29.4.1", "jest": "^29.4.2", "jest-extended": "^3.2.3", "rimraf": "^4.1.1", @@ -21115,6 +21117,9 @@ "Prototypes/Shell/Node-launcher/Lib": { "name": "@morgan-stanley/compose-node-launcher", "version": "0.1.0", + "bin": { + "composeui-cli": "bin/cli.js" + }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-typescript": "11.0.0", @@ -25114,8 +25119,10 @@ "@morgan-stanley/compose-messaging-client": { "version": "file:Messaging-JS", "requires": { + "@jest/expect-utils": "^29.4.1", "@types/jest": "^29.4.0", "@types/node": "^18.11.18", + "expect": "^29.4.1", "jest": "^29.4.2", "jest-extended": "^3.2.3", "rimraf": "^4.1.1", From ca3bf5d9860fbd406b97735843ab24ce3ea1a44e Mon Sep 17 00:00:00 2001 From: kruplm <73655443+kruplm@users.noreply.github.com> Date: Tue, 21 Feb 2023 16:16:18 +0100 Subject: [PATCH 2/3] fix csproj file --- Tryouts/Prototypes/Shell/Shell.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Tryouts/Prototypes/Shell/Shell.csproj b/Tryouts/Prototypes/Shell/Shell.csproj index 3b72a37fa..2f07c1144 100644 --- a/Tryouts/Prototypes/Shell/Shell.csproj +++ b/Tryouts/Prototypes/Shell/Shell.csproj @@ -10,14 +10,9 @@ - - - - - From 69ef6d32aa12700cd0926f742513b26b8febed5c Mon Sep 17 00:00:00 2001 From: kruplm <73655443+kruplm@users.noreply.github.com> Date: Tue, 21 Feb 2023 16:58:16 +0100 Subject: [PATCH 3/3] Renaming package and command --- .../Shell/Node-launcher/Demo/example.js | 5 +- .../Shell/Node-launcher/Demo/package.json | 6 +- .../Shell/Node-launcher/Lib/README.md | 4 +- .../Shell/Node-launcher/Lib/package.json | 4 +- Tryouts/package-lock.json | 134 +++++++++--------- 5 files changed, 76 insertions(+), 77 deletions(-) diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Demo/example.js b/Tryouts/Prototypes/Shell/Node-launcher/Demo/example.js index 2b9fe3959..11048f71b 100644 --- a/Tryouts/Prototypes/Shell/Node-launcher/Demo/example.js +++ b/Tryouts/Prototypes/Shell/Node-launcher/Demo/example.js @@ -1,4 +1,4 @@ -import { BrowserWindow } from '@morgan-stanley/compose-node-launcher'; +import { BrowserWindow } from '@morgan-stanley/composeui-node-launcher'; function windowOpenExample() { const window = new BrowserWindow( @@ -12,8 +12,6 @@ function windowOpenExample() { window.open(); } -windowOpenExample(); - function loadUrlExample() { const window = new BrowserWindow( { @@ -24,4 +22,5 @@ function loadUrlExample() { window.loadUrl("https://github.com/morganstanley/fdc3-dotnet"); } +windowOpenExample(); loadUrlExample(); \ No newline at end of file diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Demo/package.json b/Tryouts/Prototypes/Shell/Node-launcher/Demo/package.json index 18fd9ec41..8f2ed2195 100644 --- a/Tryouts/Prototypes/Shell/Node-launcher/Demo/package.json +++ b/Tryouts/Prototypes/Shell/Node-launcher/Demo/package.json @@ -1,7 +1,7 @@ { - "name": "@morgan-stanley/compose-node-launcher-example", + "name": "@morgan-stanley/composeui-node-launcher-example", "version": "0.1.0", - "description": "", + "description": "Example usage of @morgan-stanley/composeui-node-launcher-example", "main": "example.js", "module": "example.js", "type": "module", @@ -10,7 +10,7 @@ "build": "npm run clean && rollup -c" }, "dependencies": { - "@morgan-stanley/compose-node-launcher": "*" + "@morgan-stanley/composeui-node-launcher": "*" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md b/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md index 03e737a4f..3064f93e7 100644 --- a/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md +++ b/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md @@ -1,6 +1,6 @@ -# @morgan-stanley/ompose-node-launcher +# @morgan-stanley/composeui-node-launcher ## Library @@ -44,5 +44,5 @@ loadUrlExample(); The CLI enables you to execute your app with compose by executing the following command: ``` -composeui-cli myapp.js +composeui myapp.js ``` diff --git a/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json b/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json index ab7373883..3f8d9d5b1 100644 --- a/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json +++ b/Tryouts/Prototypes/Shell/Node-launcher/Lib/package.json @@ -1,5 +1,5 @@ { - "name": "@morgan-stanley/compose-node-launcher", + "name": "@morgan-stanley/composeui-node-launcher", "version": "0.1.0", "description": "Package to launch Compose from Node.js", "main": "output/index.js", @@ -10,7 +10,7 @@ "build": "npm run clean && tsc && rollup -c" }, "bin": { - "composeui-cli": "./cli/cli.js" + "composeui": "./cli/cli.js" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", diff --git a/Tryouts/package-lock.json b/Tryouts/package-lock.json index 52219f7fd..0f2d5b9fc 100644 --- a/Tryouts/package-lock.json +++ b/Tryouts/package-lock.json @@ -5422,16 +5422,16 @@ "resolved": "Messaging-JS", "link": true }, - "node_modules/@morgan-stanley/compose-node-launcher": { - "resolved": "Prototypes/Shell/Node-launcher/Lib", + "node_modules/@morgan-stanley/compose-process-explorer-frontend": { + "resolved": "Plugins/ApplicationPlugins/process explorer", "link": true }, - "node_modules/@morgan-stanley/compose-node-launcher-example": { - "resolved": "Prototypes/Shell/Node-launcher/Demo", + "node_modules/@morgan-stanley/composeui-node-launcher": { + "resolved": "Prototypes/Shell/Node-launcher/Lib", "link": true }, - "node_modules/@morgan-stanley/compose-process-explorer-frontend": { - "resolved": "Plugins/ApplicationPlugins/process explorer", + "node_modules/@morgan-stanley/composeui-node-launcher-example": { + "resolved": "Prototypes/Shell/Node-launcher/Demo", "link": true }, "node_modules/@ngtools/webpack": { @@ -20687,10 +20687,10 @@ "dev": true }, "Prototypes/Shell/Node-launcher/Demo": { - "name": "@morgan-stanley/compose-node-launcher-example", + "name": "@morgan-stanley/composeui-node-launcher-example", "version": "0.1.0", "dependencies": { - "@morgan-stanley/compose-node-launcher": "*" + "@morgan-stanley/composeui-node-launcher": "*" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", @@ -20731,10 +20731,10 @@ } }, "Prototypes/Shell/Node-launcher/Lib": { - "name": "@morgan-stanley/compose-node-launcher", + "name": "@morgan-stanley/composeui-node-launcher", "version": "0.1.0", "bin": { - "composeui-cli": "bin/cli.js" + "composeui": "cli/cli.js" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", @@ -24755,63 +24755,6 @@ } } }, - "@morgan-stanley/compose-node-launcher": { - "version": "file:Prototypes/Shell/Node-launcher/Lib", - "requires": { - "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-typescript": "11.0.0", - "@types/node": "^18.11.18", - "rimraf": "4.1.2", - "rollup": "^2.76.0", - "tslib": "^2.4.0", - "typescript": "^4.7.4" - }, - "dependencies": { - "rimraf": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", - "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", - "dev": true - }, - "rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, - "requires": { - "fsevents": "~2.3.2" - } - } - } - }, - "@morgan-stanley/compose-node-launcher-example": { - "version": "file:Prototypes/Shell/Node-launcher/Demo", - "requires": { - "@morgan-stanley/compose-node-launcher": "*", - "@rollup/plugin-node-resolve": "^15.0.1", - "rimraf": "4.1.2", - "rollup": "^2.76.0", - "tslib": "^2.4.0", - "typescript": "^4.7.4" - }, - "dependencies": { - "rimraf": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", - "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", - "dev": true - }, - "rollup": { - "version": "2.79.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", - "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, - "requires": { - "fsevents": "~2.3.2" - } - } - } - }, "@morgan-stanley/compose-process-explorer-frontend": { "version": "file:Plugins/ApplicationPlugins/process explorer", "requires": { @@ -24878,6 +24821,63 @@ } } }, + "@morgan-stanley/composeui-node-launcher": { + "version": "file:Prototypes/Shell/Node-launcher/Lib", + "requires": { + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-typescript": "11.0.0", + "@types/node": "^18.11.18", + "rimraf": "4.1.2", + "rollup": "^2.76.0", + "tslib": "^2.4.0", + "typescript": "^4.7.4" + }, + "dependencies": { + "rimraf": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", + "dev": true + }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + } + } + }, + "@morgan-stanley/composeui-node-launcher-example": { + "version": "file:Prototypes/Shell/Node-launcher/Demo", + "requires": { + "@morgan-stanley/composeui-node-launcher": "*", + "@rollup/plugin-node-resolve": "^15.0.1", + "rimraf": "4.1.2", + "rollup": "^2.76.0", + "tslib": "^2.4.0", + "typescript": "^4.7.4" + }, + "dependencies": { + "rimraf": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", + "dev": true + }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + } + } + }, "@ngtools/webpack": { "version": "15.1.4", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-15.1.4.tgz",