@morgan-stanley/composeui-node-launcher 0.1.0-alpha.4 → 0.1.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/output/browserWindow.d.ts +8 -0
- package/output/browserWindow.js +16 -0
- package/output/cli/cli.d.ts +2 -0
- package/output/cli/cli.js +10 -0
- package/output/cli/executeScriptFile.d.ts +1 -0
- package/output/cli/executeScriptFile.js +12 -0
- package/output/index.d.ts +5 -0
- package/output/index.js +4 -0
- package/output/launcher.d.ts +7 -0
- package/output/launcher.js +29 -0
- package/output/windowConfig.d.ts +7 -0
- package/output/windowConfig.js +1 -0
- package/package.json +7 -7
- package/src/cli/install.js +1 -2
- package/src/launcher.ts +1 -1
- /package/{jest.config.ts → jest.config.js} +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
## Pre-requisites
|
|
6
6
|
|
|
7
7
|
### For the shell:
|
|
8
|
-
* [.Net Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-
|
|
8
|
+
* [.Net Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-8.0.12-windows-x64-installer)
|
|
9
9
|
* [Edge WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section)
|
|
10
10
|
|
|
11
11
|
## Library
|
|
@@ -110,5 +110,5 @@ COMPOSEUI_CDN_URL='http://127.0.0.1:8080'
|
|
|
110
110
|
To achieve this you can set the `COMPOSEUI_BINARY_FILE_PATH` variable to point to the exe compiled by Visual Studio:
|
|
111
111
|
|
|
112
112
|
```
|
|
113
|
-
COMPOSEUI_BINARY_FILE_PATH='path\to\your\project\folder\ComposeUI\src\shell\dotnet\Shell\bin\Debug\
|
|
113
|
+
COMPOSEUI_BINARY_FILE_PATH='path\to\your\project\folder\ComposeUI\src\shell\dotnet\Shell\bin\Debug\net8.0-windows\ComposeUI-Shell.exe'
|
|
114
114
|
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Launcher } from './launcher.js';
|
|
2
|
+
export class BrowserWindow {
|
|
3
|
+
config;
|
|
4
|
+
launcher;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
this.launcher = new Launcher();
|
|
8
|
+
}
|
|
9
|
+
open() {
|
|
10
|
+
this.launcher.launch(this.config);
|
|
11
|
+
}
|
|
12
|
+
loadUrl(url) {
|
|
13
|
+
this.config.url = url;
|
|
14
|
+
this.launcher.launch(this.config);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function executeScriptFile(fileName: string): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { fork } from 'child_process';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
"use strict";
|
|
4
|
+
export function executeScriptFile(fileName) {
|
|
5
|
+
if (fileName) {
|
|
6
|
+
let filePath = resolve(fileName);
|
|
7
|
+
const child = fork(filePath);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
throw new Error("Specify filename.");
|
|
11
|
+
}
|
|
12
|
+
}
|
package/output/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { execFile } from 'child_process';
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
export class Launcher {
|
|
4
|
+
composeuiBinaryFileName = process.platform === 'win32' ? 'MorganStanley.ComposeUI.Shell.exe' : 'MorganStanley.ComposeUI.Shell';
|
|
5
|
+
composeuiBinaryFilePath = process.env.npm_config_composeui_binary_file_path || process.env.COMPOSEUI_BINARY_FILE_PATH || fileURLToPath(new URL(`./../dist/${this.composeuiBinaryFileName}`, import.meta.url));
|
|
6
|
+
processArgs(config) {
|
|
7
|
+
let argsArray = [];
|
|
8
|
+
if (config) {
|
|
9
|
+
for (const [key, value] of Object.entries(config)) {
|
|
10
|
+
argsArray.push(`--${key}=${value}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return argsArray;
|
|
14
|
+
}
|
|
15
|
+
launch(config) {
|
|
16
|
+
let argsArray = this.processArgs(config);
|
|
17
|
+
if (!config?.url) {
|
|
18
|
+
throw new Error("At least the url must be specified!");
|
|
19
|
+
}
|
|
20
|
+
const child = execFile(this.composeuiBinaryFilePath, argsArray, (error, stdout, stderr) => {
|
|
21
|
+
console.log(stdout);
|
|
22
|
+
if (error) {
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
let exithandler = function () { process.exit(); };
|
|
27
|
+
child.on('close', exithandler);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morgan-stanley/composeui-node-launcher",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Package to launch ComposeUI from Node.js",
|
|
6
6
|
"main": "output/index.js",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"composeui": "./output/cli/cli.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"axios": "^1.
|
|
29
|
+
"axios": "^1.7.7",
|
|
30
30
|
"extract-zip": "^2.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/jest": "29.5.
|
|
34
|
-
"@types/node": "^
|
|
33
|
+
"@types/jest": "29.5.14",
|
|
34
|
+
"@types/node": "^22.0.2",
|
|
35
35
|
"jest": "29.7.0",
|
|
36
|
-
"rimraf": "^
|
|
37
|
-
"ts-jest": "29.
|
|
36
|
+
"rimraf": "^6.0.1",
|
|
37
|
+
"ts-jest": "29.2.5",
|
|
38
38
|
"ts-node": "10.9.2",
|
|
39
39
|
"tslib": "^2.4.0",
|
|
40
40
|
"typescript": "^5.3.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "5041acb1c335292bebbb55e991674a030d677321"
|
|
43
43
|
}
|
package/src/cli/install.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
"use strict";
|
|
4
3
|
|
|
5
4
|
import path from 'path';
|
|
6
5
|
import fs from 'fs';
|
|
@@ -12,7 +11,7 @@ import extract from 'extract-zip';
|
|
|
12
11
|
import * as stream from 'stream';
|
|
13
12
|
import { promisify } from 'util';
|
|
14
13
|
|
|
15
|
-
import pkg from './../../package.json'
|
|
14
|
+
import pkg from './../../package.json' with { type: "json" };
|
|
16
15
|
|
|
17
16
|
const DEFAULT_CDN_URL = 'https://github.com/morganstanley/ComposeUI/releases/download';
|
|
18
17
|
|
package/src/launcher.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { WindowConfig } from './windowConfig';
|
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
export class Launcher {
|
|
6
|
-
private composeuiBinaryFileName = process.platform === 'win32' ? 'ComposeUI
|
|
6
|
+
private composeuiBinaryFileName = process.platform === 'win32' ? 'MorganStanley.ComposeUI.Shell.exe' : 'MorganStanley.ComposeUI.Shell';
|
|
7
7
|
private composeuiBinaryFilePath = process.env.npm_config_composeui_binary_file_path || process.env.COMPOSEUI_BINARY_FILE_PATH || fileURLToPath(new URL(`./../dist/${this.composeuiBinaryFileName}`, import.meta.url));
|
|
8
8
|
|
|
9
9
|
private processArgs(config?: WindowConfig) {
|
|
File without changes
|