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 new file mode 100644 index 000000000..3064f93e7 --- /dev/null +++ b/Tryouts/Prototypes/Shell/Node-launcher/Lib/README.md @@ -0,0 +1,48 @@ + + +# @morgan-stanley/composeui-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 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..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", @@ -9,6 +9,9 @@ "clean": "rimraf output", "build": "npm run clean && tsc && rollup -c" }, + "bin": { + "composeui": "./cli/cli.js" + }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-typescript": "11.0.0", diff --git a/Tryouts/package-lock.json b/Tryouts/package-lock.json index 3d9a4d4ed..cbac4dfe5 100644 --- a/Tryouts/package-lock.json +++ b/Tryouts/package-lock.json @@ -6281,16 +6281,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": { @@ -21627,10 +21627,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", @@ -21671,8 +21671,11 @@ } }, "Prototypes/Shell/Node-launcher/Lib": { - "name": "@morgan-stanley/compose-node-launcher", + "name": "@morgan-stanley/composeui-node-launcher", "version": "0.1.0", + "bin": { + "composeui": "cli/cli.js" + }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-typescript": "11.0.0", @@ -26579,63 +26582,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": { @@ -26702,6 +26648,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",