openfin-cli 4.0.0 → 5.42.2
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/LICENSE.md +3 -1
- package/README.md +102 -15
- package/npm.README.md +15 -0
- package/{dist → out}/cli.js +72 -74
- package/{dist → out}/index.js +209 -201
- package/{dist → out}/logger.js +50 -50
- package/{dist → out}/report-usage.js +50 -50
- package/{dist → out}/utils.js +28 -28
- package/out/validateManifest.js +31 -0
- package/package.json +38 -24
- package/dist/validateManifest.js +0 -23
- package/dist/version.js +0 -1
package/LICENSE.md
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
Learn more about OpenFin licensing at the links listed below or email us at support@openfin.co with questions.
|
|
2
|
+
|
|
3
|
+
- [Developer agreement](https://openfin.co/developer-agreement/)
|
package/README.md
CHANGED
|
@@ -1,15 +1,102 @@
|
|
|
1
|
-
# OpenFin CLI
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
# OpenFin CLI
|
|
2
|
+
|
|
3
|
+
[](https://github.com/openfin/openfin-cli/actions/workflows/ci.yml)  
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Repo for OpenFin’s [CLI tool](https://www.npmjs.com/package/openfin-cli).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
### Node
|
|
12
|
+
|
|
13
|
+
Node LTS can be downloaded [here](https://nodejs.org/en/download/).
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Run the following command to install the required dependencies:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Development
|
|
24
|
+
|
|
25
|
+
Build and run the CLI by running:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
$ npm start
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This will display the default help text. To pass CLI arguments an extra double dash is required. For example, to launch the OpenFin runtime with the `--config` flag, you would run:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
$ npm start -- --config
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This is because the first set of options gets passed to npm, the second to the actual command that is being invoked `npm run start <NPM OPTIONS> -- <CLI OPTIONS>`. By way of another example, to launch Process Manager you would run:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
$ npm start -- --launch --config https://cdn.openfin.co/release/apps/openfin/processmanager/app.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Versioning & Releasing
|
|
44
|
+
|
|
45
|
+
The release process does the following:
|
|
46
|
+
|
|
47
|
+
- The package and published to [NPM](https://www.npmjs.com/package/openfin-cli).
|
|
48
|
+
|
|
49
|
+
To run a new release, follow this process:
|
|
50
|
+
|
|
51
|
+
### 1. Create a release branch
|
|
52
|
+
|
|
53
|
+
Note the new release version and create a new branch from main:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
# Fetch and merge latest main branch
|
|
57
|
+
$ git checkout main && git pull
|
|
58
|
+
|
|
59
|
+
# Create new release branch
|
|
60
|
+
$ git checkout -b release/v<new-version-number>
|
|
61
|
+
|
|
62
|
+
# Commit new API version
|
|
63
|
+
$ npm version <new-version-number>
|
|
64
|
+
|
|
65
|
+
# Push release branch remotely
|
|
66
|
+
$ git push -u origin release/v<new-version-number>
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 3. Create a pull request
|
|
71
|
+
|
|
72
|
+
You should now be able to open a pull request with release/<new-version-number> against main. Get that approved and merged.
|
|
73
|
+
|
|
74
|
+
### 4. Create a new release on GitHub
|
|
75
|
+
|
|
76
|
+
Once your release branch is merged into main, you should now create a release through GitHub:
|
|
77
|
+
|
|
78
|
+
- Click Create a New Release
|
|
79
|
+
- Enter `v<new-version-number>` (e.g. v2.1.0) as both the tag and the release title. Enter release notes in the description field.
|
|
80
|
+
- If the release is a pre-release, check the pre-release box.
|
|
81
|
+
- Click "Publish release"
|
|
82
|
+
|
|
83
|
+
Once the release is published, the production release workflow is triggered which will:
|
|
84
|
+
|
|
85
|
+
- Build the CLI tool and create the NPM package
|
|
86
|
+
- Publish the NPM package
|
|
87
|
+
- Attach the NPM package to the GitHub release
|
|
88
|
+
|
|
89
|
+
### Pre-releases
|
|
90
|
+
|
|
91
|
+
For pre-releases, follow the save process as above, but check the pre-release box when creating the release on GitHub.
|
|
92
|
+
|
|
93
|
+
Similarly, pre-releases should be versioned with a pre-release tag (e.g. 2.1.0-beta.1). This will ensure that the pre-release is published to NPM as a pre-release.
|
|
94
|
+
|
|
95
|
+
## VS Code Extensions
|
|
96
|
+
|
|
97
|
+
The following VS Code extensions are used with this project:
|
|
98
|
+
|
|
99
|
+
- [Code Spell Checker](https://open-vsx.org/vscode/item?streetsidesoftware.code-spell-checker)
|
|
100
|
+
- [Debugger for Chrome](https://open-vsx.org/vscode/item?itemName=msjsdiag.debugger-for-chrome)
|
|
101
|
+
- [ESLint](https://open-vsx.org/vscode/item?itemName=dbaeumer.vscode-eslint)
|
|
102
|
+
- [Prettier - Code formatter](https://open-vsx.org/vscode/item?itemName=esbenp.prettier-vscode)
|
package/npm.README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# OpenFin CLI
|
|
2
|
+
|
|
3
|
+
The OpenFin CLI tool will allow you to launch the OpenFin runtime given a url or a configuration file, it will also allow you to create configuration files by giving only name and url.
|
|
4
|
+
|
|
5
|
+
For more information please refer to the [developer guide](https://developers.openfin.co/of-docs/docs/openfin-cli-tool).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
With npm:
|
|
10
|
+
|
|
11
|
+
> npm i -g openfin-cli
|
|
12
|
+
|
|
13
|
+
With yarn:
|
|
14
|
+
|
|
15
|
+
> yarn global add openfin-cli
|
package/{dist → out}/cli.js
RENAMED
|
@@ -1,74 +1,72 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { hideBin } from 'yargs/helpers';
|
|
3
|
-
import yargs from 'yargs/yargs';
|
|
4
|
-
import { openfinCli } from './index.js';
|
|
5
|
-
import { Logger } from './logger.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.version(API_VERSION);
|
|
74
|
-
yargsParser.parse();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { hideBin } from 'yargs/helpers';
|
|
3
|
+
import yargs from 'yargs/yargs';
|
|
4
|
+
import { openfinCli } from './index.js';
|
|
5
|
+
import { Logger } from './logger.js';
|
|
6
|
+
global.logger = new Logger();
|
|
7
|
+
const yargsParser = yargs(hideBin(process.argv))
|
|
8
|
+
.scriptName('OpenFin Runtime CLI tool')
|
|
9
|
+
.option('config', {
|
|
10
|
+
alias: 'c',
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'path to config file'
|
|
13
|
+
})
|
|
14
|
+
.option('url', {
|
|
15
|
+
alias: 'u',
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'application url or comma separated list of urls'
|
|
18
|
+
})
|
|
19
|
+
.option('launch', {
|
|
20
|
+
alias: 'l',
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
description: 'launch this configuration'
|
|
23
|
+
})
|
|
24
|
+
.option('devtools-port', {
|
|
25
|
+
alias: 'p',
|
|
26
|
+
type: 'number',
|
|
27
|
+
description: 'devtools port number',
|
|
28
|
+
defaultDescription: '9090'
|
|
29
|
+
})
|
|
30
|
+
.option('runtime-version', {
|
|
31
|
+
alias: 'r',
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'runtime version',
|
|
34
|
+
defaultDescription: 'stable'
|
|
35
|
+
})
|
|
36
|
+
.option('platform', {
|
|
37
|
+
alias: 't',
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: false,
|
|
40
|
+
description: 'launch as a platform window with multiple URLs'
|
|
41
|
+
})
|
|
42
|
+
.option('save', {
|
|
43
|
+
alias: 's',
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'save the manifest to the current directory <manifest name>'
|
|
46
|
+
})
|
|
47
|
+
.option('log-level', {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Run with custom log level',
|
|
50
|
+
choices: ['DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'],
|
|
51
|
+
default: 'INFO'
|
|
52
|
+
})
|
|
53
|
+
.check((argv) => {
|
|
54
|
+
if (argv.config && argv.url) {
|
|
55
|
+
throw new Error('Cannot use both config and url options at the same time');
|
|
56
|
+
}
|
|
57
|
+
// These options have no effect when using the config option
|
|
58
|
+
if (argv.config && (argv.platform || argv['devtools-port'] || argv['runtime-version'] || argv.save)) {
|
|
59
|
+
throw new Error('While using the config option, you cannot use the platform, devtools-port, runtime-version, or save options.');
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
})
|
|
63
|
+
.command('*', 'OpenFin CLI', () => ({}), (v) => {
|
|
64
|
+
// TODO: Validate commands + show help
|
|
65
|
+
if (!v.url && !v.launch) {
|
|
66
|
+
yargsParser.showHelp();
|
|
67
|
+
}
|
|
68
|
+
global.logger.setLogLevelString(v.logLevel);
|
|
69
|
+
openfinCli(v);
|
|
70
|
+
})
|
|
71
|
+
.example('openfin --launch --config https://cdn.openfin.co/release/apps/openfin/processmanager/app.json', "Launches OpenFin's Process Manager app hosted on the OpenFin CDN");
|
|
72
|
+
yargsParser.parse();
|
package/{dist → out}/index.js
RENAMED
|
@@ -1,201 +1,209 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import os from 'os';
|
|
15
|
-
import path from 'path';
|
|
16
|
-
import { reportUsage } from './report-usage.js';
|
|
17
|
-
import { fetch, formatTimeFromMs, isURL } from './utils.js';
|
|
18
|
-
import { manifestSchema } from './validateManifest.js';
|
|
19
|
-
if (typeof dns.setDefaultResultOrder === 'function') {
|
|
20
|
-
dns.setDefaultResultOrder('ipv4first');
|
|
21
|
-
}
|
|
22
|
-
let launchTime;
|
|
23
|
-
export const openfinCli = (cli) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
const { config, url, launch, devtoolsPort = 9090, runtimeVersion = 'stable', save, platform } = cli;
|
|
25
|
-
let manifestUrl = config;
|
|
26
|
-
let buildConfig;
|
|
27
|
-
let configObject;
|
|
28
|
-
try {
|
|
29
|
-
if (url) {
|
|
30
|
-
buildConfig = true;
|
|
31
|
-
const manifestInfo = yield writeManifest(url.split(','), platform, devtoolsPort, runtimeVersion, save);
|
|
32
|
-
manifestUrl = manifestInfo.filepath;
|
|
33
|
-
configObject = manifestInfo.manifest;
|
|
34
|
-
}
|
|
35
|
-
if (launch) {
|
|
36
|
-
if (!buildConfig && manifestUrl) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
global.logger.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
manifest
|
|
199
|
-
filepath,
|
|
200
|
-
|
|
201
|
-
}
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { connect, launch as launchOpenFinFromAdapter } from '@openfin/node-adapter';
|
|
11
|
+
import crypto from 'crypto';
|
|
12
|
+
import dns from 'dns';
|
|
13
|
+
import fs from 'fs/promises';
|
|
14
|
+
import os from 'os';
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import { reportUsage } from './report-usage.js';
|
|
17
|
+
import { fetch, formatTimeFromMs, isURL } from './utils.js';
|
|
18
|
+
import { manifestSchema } from './validateManifest.js';
|
|
19
|
+
if (typeof dns.setDefaultResultOrder === 'function') {
|
|
20
|
+
dns.setDefaultResultOrder('ipv4first');
|
|
21
|
+
}
|
|
22
|
+
let launchTime;
|
|
23
|
+
export const openfinCli = (cli) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const { config, url, launch, devtoolsPort = 9090, runtimeVersion = 'stable', save, platform } = cli;
|
|
25
|
+
let manifestUrl = config;
|
|
26
|
+
let buildConfig;
|
|
27
|
+
let configObject;
|
|
28
|
+
try {
|
|
29
|
+
if (url) {
|
|
30
|
+
buildConfig = true;
|
|
31
|
+
const manifestInfo = yield writeManifest(url.split(','), platform, devtoolsPort, runtimeVersion, save);
|
|
32
|
+
manifestUrl = manifestInfo.filepath;
|
|
33
|
+
configObject = manifestInfo.manifest;
|
|
34
|
+
}
|
|
35
|
+
if (launch) {
|
|
36
|
+
if (!buildConfig && manifestUrl) {
|
|
37
|
+
let fetchedManifest;
|
|
38
|
+
if (manifestUrl && isURL(manifestUrl)) {
|
|
39
|
+
try {
|
|
40
|
+
global.logger.debug(`Fetching manifest from: ${manifestUrl}`);
|
|
41
|
+
fetchedManifest = yield fetch(manifestUrl);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error instanceof Error) {
|
|
45
|
+
global.logger.error(`Failed to fetch manifest from ${manifestUrl} with error: ${error.message}`);
|
|
46
|
+
global.logger.debug(JSON.stringify(error));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
manifestUrl = path.resolve(manifestUrl);
|
|
56
|
+
try {
|
|
57
|
+
global.logger.debug(`Reading manifest from: ${manifestUrl}`);
|
|
58
|
+
const configBuffer = yield fs.readFile(manifestUrl);
|
|
59
|
+
fetchedManifest = JSON.parse(configBuffer.toString());
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error instanceof Error) {
|
|
63
|
+
global.logger.error(`Failed to get manifest from ${manifestUrl} with error: ${error.message}`);
|
|
64
|
+
global.logger.debug(JSON.stringify(error));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
global.logger.debug('Manifest', JSON.stringify(config));
|
|
73
|
+
global.logger.debug('Validating manifest');
|
|
74
|
+
const parsedManifest = manifestSchema.safeParse(fetchedManifest);
|
|
75
|
+
if (!parsedManifest.success) {
|
|
76
|
+
global.logger.error(`Failed to validate manifest with error: ${parsedManifest.error.message}`);
|
|
77
|
+
global.logger.debug(JSON.stringify(parsedManifest.error));
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
configObject = parsedManifest.data;
|
|
81
|
+
global.logger.debug('Manifest validated');
|
|
82
|
+
}
|
|
83
|
+
if (!configObject) {
|
|
84
|
+
throw new Error('No config object found');
|
|
85
|
+
}
|
|
86
|
+
if (!manifestUrl) {
|
|
87
|
+
throw new Error('No manifest url found');
|
|
88
|
+
}
|
|
89
|
+
reportUsage('START', manifestUrl, configObject);
|
|
90
|
+
launchOpenfin(manifestUrl, config, configObject);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
globalThis.logger.error('Failed:', JSON.stringify(error));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const launchOpenfin = (manifestUrl, config, configObject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
try {
|
|
99
|
+
global.logger.info(`Launching OpenFin with manifest: ${manifestUrl}`);
|
|
100
|
+
launchTime = Date.now();
|
|
101
|
+
const port = yield launchOpenFinFromAdapter({ manifestUrl });
|
|
102
|
+
global.logger.debug('Application Launched');
|
|
103
|
+
global.logger.debug(`Connecting to devtool port: ${port}`);
|
|
104
|
+
const fin = yield connect({
|
|
105
|
+
uuid: `adapter-connection-${crypto.randomUUID()}`,
|
|
106
|
+
address: `ws://localhost:${port}`,
|
|
107
|
+
nonPersistent: true
|
|
108
|
+
});
|
|
109
|
+
global.logger.debug(`Connected to devtool port: ${port}`);
|
|
110
|
+
fin.once('disconnected', () => {
|
|
111
|
+
global.logger.info(`Disconnected from application, exiting after ${formatTimeFromMs(Date.now() - launchTime)}`);
|
|
112
|
+
process.exit();
|
|
113
|
+
});
|
|
114
|
+
global.logger.debug('Disconnect Listener Added');
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const err = error instanceof Error || error instanceof String ? error.toString() : JSON.stringify(error);
|
|
118
|
+
reportUsage(err.toString(), config, configObject);
|
|
119
|
+
// Maybe check what the error is and decide log level on that
|
|
120
|
+
// Sometimes errors are thrown when they shouldn't be
|
|
121
|
+
global.logger.warn('Error thrown launching/connecting to application instance', JSON.stringify(err));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const writeManifest = (urls, isPlatform, devtoolsPort, runtime, manifestName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
const uuid = `app-${crypto.randomUUID()}`;
|
|
126
|
+
const version = runtime;
|
|
127
|
+
let manifest;
|
|
128
|
+
const generateViewObjWithUrl = (url) => ({
|
|
129
|
+
type: 'component',
|
|
130
|
+
componentName: 'view',
|
|
131
|
+
componentState: {
|
|
132
|
+
name: `view-${crypto.randomUUID()}`,
|
|
133
|
+
url
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const buildContent = () => {
|
|
137
|
+
const content = [];
|
|
138
|
+
urls.forEach((url) => {
|
|
139
|
+
content.push(generateViewObjWithUrl(url));
|
|
140
|
+
});
|
|
141
|
+
return content;
|
|
142
|
+
};
|
|
143
|
+
if (isPlatform) {
|
|
144
|
+
const content = buildContent();
|
|
145
|
+
manifest = {
|
|
146
|
+
runtime: {
|
|
147
|
+
version
|
|
148
|
+
},
|
|
149
|
+
platform: {
|
|
150
|
+
uuid,
|
|
151
|
+
autoShow: false
|
|
152
|
+
},
|
|
153
|
+
snapshot: {
|
|
154
|
+
windows: [
|
|
155
|
+
{
|
|
156
|
+
saveWindowState: false,
|
|
157
|
+
backgroundThrottling: true,
|
|
158
|
+
layout: {
|
|
159
|
+
content: [
|
|
160
|
+
{
|
|
161
|
+
type: 'row',
|
|
162
|
+
id: 'no-drop-target',
|
|
163
|
+
content
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
manifest = {
|
|
174
|
+
devtools_port: devtoolsPort,
|
|
175
|
+
startup_app: {
|
|
176
|
+
name: uuid,
|
|
177
|
+
url: urls[0],
|
|
178
|
+
uuid,
|
|
179
|
+
saveWindowState: false,
|
|
180
|
+
autoShow: true
|
|
181
|
+
},
|
|
182
|
+
runtime: {
|
|
183
|
+
version
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
global.logger.debug('Stringifying manifest');
|
|
188
|
+
const manifestJson = JSON.stringify(manifest, null, 4);
|
|
189
|
+
global.logger.debug(`Manifest stringified successfully ${manifestJson}`);
|
|
190
|
+
let filepath;
|
|
191
|
+
if (manifestName) {
|
|
192
|
+
filepath = path.join(process.cwd(), manifestName);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
filepath = path.join(os.tmpdir(), `${uuid}.json`);
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
global.logger.debug(`Writing manifest to: ${path.resolve(filepath)}`);
|
|
199
|
+
yield fs.writeFile(filepath, manifestJson);
|
|
200
|
+
global.logger.info(`Manifest written to: ${path.resolve(filepath)}`);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
global.logger.error(`Failed to write manifest ${JSON.stringify(error)}`);
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
manifest,
|
|
207
|
+
filepath
|
|
208
|
+
};
|
|
209
|
+
});
|
package/{dist → out}/logger.js
RENAMED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
export class Logger {
|
|
2
|
-
constructor(logLevel = 1 /* LogLevel.INFO */) {
|
|
3
|
-
this._logLevel = logLevel;
|
|
4
|
-
}
|
|
5
|
-
setLogLevel(logLevel) {
|
|
6
|
-
this._logLevel = logLevel;
|
|
7
|
-
}
|
|
8
|
-
setLogLevelString(logLevel) {
|
|
9
|
-
switch (logLevel.toLowerCase()) {
|
|
10
|
-
case 'debug':
|
|
11
|
-
this._logLevel = 0 /* LogLevel.DEBUG */;
|
|
12
|
-
break;
|
|
13
|
-
case 'info':
|
|
14
|
-
this._logLevel = 1 /* LogLevel.INFO */;
|
|
15
|
-
break;
|
|
16
|
-
case 'warn':
|
|
17
|
-
this._logLevel = 2 /* LogLevel.WARN */;
|
|
18
|
-
break;
|
|
19
|
-
case 'error':
|
|
20
|
-
this._logLevel = 3 /* LogLevel.ERROR */;
|
|
21
|
-
break;
|
|
22
|
-
case 'none':
|
|
23
|
-
this._logLevel = 4 /* LogLevel.NONE */;
|
|
24
|
-
break;
|
|
25
|
-
default:
|
|
26
|
-
this._logLevel = 1 /* LogLevel.INFO */;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
debug(message, ...args) {
|
|
31
|
-
if (this._logLevel <= 0 /* LogLevel.DEBUG */) {
|
|
32
|
-
console.log(`[DEBUG] ${message}`, ...args);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
info(message, ...args) {
|
|
36
|
-
if (this._logLevel <= 1 /* LogLevel.INFO */) {
|
|
37
|
-
console.log(`[INFO] ${message}`, ...args);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
warn(message, ...args) {
|
|
41
|
-
if (this._logLevel <= 2 /* LogLevel.WARN */) {
|
|
42
|
-
console.log(`[WARN] ${message}`, ...args);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
error(message, ...args) {
|
|
46
|
-
if (this._logLevel <= 3 /* LogLevel.ERROR */) {
|
|
47
|
-
console.log(`[ERROR] ${message}`, ...args);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
1
|
+
export class Logger {
|
|
2
|
+
constructor(logLevel = 1 /* LogLevel.INFO */) {
|
|
3
|
+
this._logLevel = logLevel;
|
|
4
|
+
}
|
|
5
|
+
setLogLevel(logLevel) {
|
|
6
|
+
this._logLevel = logLevel;
|
|
7
|
+
}
|
|
8
|
+
setLogLevelString(logLevel) {
|
|
9
|
+
switch (logLevel.toLowerCase()) {
|
|
10
|
+
case 'debug':
|
|
11
|
+
this._logLevel = 0 /* LogLevel.DEBUG */;
|
|
12
|
+
break;
|
|
13
|
+
case 'info':
|
|
14
|
+
this._logLevel = 1 /* LogLevel.INFO */;
|
|
15
|
+
break;
|
|
16
|
+
case 'warn':
|
|
17
|
+
this._logLevel = 2 /* LogLevel.WARN */;
|
|
18
|
+
break;
|
|
19
|
+
case 'error':
|
|
20
|
+
this._logLevel = 3 /* LogLevel.ERROR */;
|
|
21
|
+
break;
|
|
22
|
+
case 'none':
|
|
23
|
+
this._logLevel = 4 /* LogLevel.NONE */;
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
this._logLevel = 1 /* LogLevel.INFO */;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
debug(message, ...args) {
|
|
31
|
+
if (this._logLevel <= 0 /* LogLevel.DEBUG */) {
|
|
32
|
+
console.log(`[DEBUG] ${message}`, ...args);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
info(message, ...args) {
|
|
36
|
+
if (this._logLevel <= 1 /* LogLevel.INFO */) {
|
|
37
|
+
console.log(`[INFO] ${message}`, ...args);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
warn(message, ...args) {
|
|
41
|
+
if (this._logLevel <= 2 /* LogLevel.WARN */) {
|
|
42
|
+
console.log(`[WARN] ${message}`, ...args);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
error(message, ...args) {
|
|
46
|
+
if (this._logLevel <= 3 /* LogLevel.ERROR */) {
|
|
47
|
+
console.log(`[ERROR] ${message}`, ...args);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import axios from 'axios';
|
|
11
|
-
import machineId from 'node-machine-id';
|
|
12
|
-
import os from 'os';
|
|
13
|
-
const getAppName = (configObject) => {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
15
|
-
return ((_h = (_f = (_d = (_b = (_a = configObject.startup_app) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = configObject.startup_app) === null || _c === void 0 ? void 0 : _c.uuid) !== null && _d !== void 0 ? _d : (_e = configObject.platform) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : (_g = configObject.platform) === null || _g === void 0 ? void 0 : _g.uuid) !== null && _h !== void 0 ? _h : 'no-app-name-or-uuid');
|
|
16
|
-
};
|
|
17
|
-
export const reportUsage = (status, config, configObject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
var _a, _b, _c;
|
|
19
|
-
if (process.platform === 'win32')
|
|
20
|
-
return;
|
|
21
|
-
const reportUrl = new URL('https://install.openfin.co/installer-usage?');
|
|
22
|
-
const reportUrlParams = new URLSearchParams({
|
|
23
|
-
appName: getAppName(configObject),
|
|
24
|
-
appLocation: typeof __dirname !== 'undefined' ? __dirname : 'unknown',
|
|
25
|
-
version: (_b = (_a = configObject === null || configObject === void 0 ? void 0 : configObject.runtime) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : 'undefined',
|
|
26
|
-
machineId: yield machineId.machineId(true),
|
|
27
|
-
manifestUrl: config !== null && config !== void 0 ? config : 'undefined',
|
|
28
|
-
platform: `${os.platform()}-${os.release()})`,
|
|
29
|
-
licenseKey: (_c = configObject === null || configObject === void 0 ? void 0 : configObject.licenseKey) !== null && _c !== void 0 ? _c : 'contract_identifier',
|
|
30
|
-
launchMethod: 'openfin-cli',
|
|
31
|
-
launchStatus: status || 'SUCCESS'
|
|
32
|
-
});
|
|
33
|
-
reportUrl.search = reportUrlParams.toString();
|
|
34
|
-
try {
|
|
35
|
-
const reportUrlString = reportUrl.toString();
|
|
36
|
-
global.logger.debug(`OpenFin Reporting Usage Data: ${reportUrlString}`);
|
|
37
|
-
const response = yield axios.get(reportUrlString);
|
|
38
|
-
if (response.status !== 200) {
|
|
39
|
-
global.logger.error('OpenFin Report Usage Data Failed');
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
global.logger.debug(`OpenFin Report Usage Data: Status: ${response.status}`);
|
|
43
|
-
global.logger.debug(`OpenFin Report Usage Data: Response: ${response.data.toString()}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
const err = error instanceof Error || error instanceof String ? error.toString() : JSON.stringify(error);
|
|
48
|
-
global.logger.warn('OpenFin Report Usage Data Failed:', err);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import machineId from 'node-machine-id';
|
|
12
|
+
import os from 'os';
|
|
13
|
+
const getAppName = (configObject) => {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
15
|
+
return ((_h = (_f = (_d = (_b = (_a = configObject.startup_app) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = configObject.startup_app) === null || _c === void 0 ? void 0 : _c.uuid) !== null && _d !== void 0 ? _d : (_e = configObject.platform) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : (_g = configObject.platform) === null || _g === void 0 ? void 0 : _g.uuid) !== null && _h !== void 0 ? _h : 'no-app-name-or-uuid');
|
|
16
|
+
};
|
|
17
|
+
export const reportUsage = (status, config, configObject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (process.platform === 'win32')
|
|
20
|
+
return;
|
|
21
|
+
const reportUrl = new URL('https://install.openfin.co/installer-usage?');
|
|
22
|
+
const reportUrlParams = new URLSearchParams({
|
|
23
|
+
appName: getAppName(configObject),
|
|
24
|
+
appLocation: typeof __dirname !== 'undefined' ? __dirname : 'unknown',
|
|
25
|
+
version: (_b = (_a = configObject === null || configObject === void 0 ? void 0 : configObject.runtime) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : 'undefined',
|
|
26
|
+
machineId: yield machineId.machineId(true),
|
|
27
|
+
manifestUrl: config !== null && config !== void 0 ? config : 'undefined',
|
|
28
|
+
platform: `${os.platform()}-${os.release()})`,
|
|
29
|
+
licenseKey: (_c = configObject === null || configObject === void 0 ? void 0 : configObject.licenseKey) !== null && _c !== void 0 ? _c : 'contract_identifier',
|
|
30
|
+
launchMethod: 'openfin-cli',
|
|
31
|
+
launchStatus: status || 'SUCCESS'
|
|
32
|
+
});
|
|
33
|
+
reportUrl.search = reportUrlParams.toString();
|
|
34
|
+
try {
|
|
35
|
+
const reportUrlString = reportUrl.toString();
|
|
36
|
+
global.logger.debug(`OpenFin Reporting Usage Data: ${reportUrlString}`);
|
|
37
|
+
const response = yield axios.get(reportUrlString);
|
|
38
|
+
if (response.status !== 200) {
|
|
39
|
+
global.logger.error('OpenFin Report Usage Data Failed');
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
global.logger.debug(`OpenFin Report Usage Data: Status: ${response.status}`);
|
|
43
|
+
global.logger.debug(`OpenFin Report Usage Data: Response: ${response.data.toString()}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const err = error instanceof Error || error instanceof String ? error.toString() : JSON.stringify(error);
|
|
48
|
+
global.logger.warn('OpenFin Report Usage Data Failed:', err);
|
|
49
|
+
}
|
|
50
|
+
});
|
package/{dist → out}/utils.js
RENAMED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import axios from 'axios';
|
|
11
|
-
export const fetch = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
-
const response = yield axios.get(url);
|
|
13
|
-
if (response.status < 200 || response.status > 399) {
|
|
14
|
-
throw new Error(`Failed to load url: ${url}, status code:${response.status}`);
|
|
15
|
-
}
|
|
16
|
-
return response.data;
|
|
17
|
-
});
|
|
18
|
-
export const isURL = (str) => {
|
|
19
|
-
return str.lastIndexOf('http') >= 0;
|
|
20
|
-
};
|
|
21
|
-
export const formatTimeFromMs = (ms) => {
|
|
22
|
-
const seconds = Math.floor(ms / 1000);
|
|
23
|
-
const minutes = Math.floor(seconds / 60);
|
|
24
|
-
const hours = Math.floor(minutes / 60);
|
|
25
|
-
const secondsRemainder = seconds % 60;
|
|
26
|
-
const minutesRemainder = minutes % 60;
|
|
27
|
-
return `${hours ? `${hours}h ` : ''}${minutesRemainder ? `${minutesRemainder}m ` : ''}${secondsRemainder ? `${secondsRemainder}s` : ''}`;
|
|
28
|
-
};
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
export const fetch = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const response = yield axios.get(url);
|
|
13
|
+
if (response.status < 200 || response.status > 399) {
|
|
14
|
+
throw new Error(`Failed to load url: ${url}, status code:${response.status}`);
|
|
15
|
+
}
|
|
16
|
+
return response.data;
|
|
17
|
+
});
|
|
18
|
+
export const isURL = (str) => {
|
|
19
|
+
return str.lastIndexOf('http') >= 0;
|
|
20
|
+
};
|
|
21
|
+
export const formatTimeFromMs = (ms) => {
|
|
22
|
+
const seconds = Math.floor(ms / 1000);
|
|
23
|
+
const minutes = Math.floor(seconds / 60);
|
|
24
|
+
const hours = Math.floor(minutes / 60);
|
|
25
|
+
const secondsRemainder = seconds % 60;
|
|
26
|
+
const minutesRemainder = minutes % 60;
|
|
27
|
+
return `${hours ? `${hours}h ` : ''}${minutesRemainder ? `${minutesRemainder}m ` : ''}${secondsRemainder ? `${secondsRemainder}s` : ''}`;
|
|
28
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
// TODO: Maybe add all manifest options, then add a CLI feature to
|
|
3
|
+
// verify the manifest against the schema.
|
|
4
|
+
export const manifestSchema = z.object({
|
|
5
|
+
startup_app: z
|
|
6
|
+
.optional(z.object({
|
|
7
|
+
name: z.optional(z.string()).nullable(),
|
|
8
|
+
uuid: z.optional(z.string()).nullable(),
|
|
9
|
+
url: z.optional(z.string()).nullable(),
|
|
10
|
+
saveWindowState: z.optional(z.boolean()).nullable(),
|
|
11
|
+
autoShow: z.optional(z.boolean()).nullable()
|
|
12
|
+
}))
|
|
13
|
+
.nullable(),
|
|
14
|
+
platform: z
|
|
15
|
+
.optional(z.object({
|
|
16
|
+
uuid: z.optional(z.string()).nullable(),
|
|
17
|
+
name: z.optional(z.string()).nullable(),
|
|
18
|
+
autoShow: z.optional(z.boolean()).nullable()
|
|
19
|
+
}))
|
|
20
|
+
.nullable(),
|
|
21
|
+
runtime: z
|
|
22
|
+
.optional(z
|
|
23
|
+
.object({
|
|
24
|
+
version: z.optional(z.string()).nullable()
|
|
25
|
+
})
|
|
26
|
+
.nullable())
|
|
27
|
+
.nullable(),
|
|
28
|
+
snapshot: z.optional(z.any()).nullable(),
|
|
29
|
+
licenseKey: z.optional(z.string()).nullable(),
|
|
30
|
+
devtools_port: z.optional(z.number()).nullable()
|
|
31
|
+
});
|
package/package.json
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
"name": "openfin-cli",
|
|
3
|
+
"version": "5.42.2",
|
|
4
|
+
"description": "Supports command line development in the OpenFin environment.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"homepage": "http://www.here.io",
|
|
7
|
+
"author": "Here™️",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20"
|
|
10
|
+
},
|
|
11
|
+
"license": "SEE LICENSE IN LICENSE.MD",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "npm run clean && npx tsc",
|
|
14
|
+
"clean": "rimraf ./dist",
|
|
15
|
+
"ci:prepublish": "of-npm prepublish",
|
|
16
|
+
"ci:postpublish": "of-npm postpublish",
|
|
17
|
+
"ci:publish": "npm publish",
|
|
18
|
+
"version:update": "of-npm version --bump patch '$MAJOR.$RMAJOR.$PATCH'"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"out/**/*",
|
|
22
|
+
"LICENSE.md",
|
|
23
|
+
"README.md",
|
|
24
|
+
"npm.README.md"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"openfin",
|
|
28
|
+
"cli",
|
|
29
|
+
"Here™️"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"axios": "1.7.2",
|
|
33
|
+
"node-machine-id": "1.1.12",
|
|
34
|
+
"yargs": "17.7.2",
|
|
35
|
+
"zod": "3.24.1"
|
|
36
|
+
},
|
|
37
|
+
"bin": {
|
|
38
|
+
"openfin": "./out/cli.js"
|
|
39
|
+
}
|
|
26
40
|
}
|
package/dist/validateManifest.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
// TODO: Maybe add all manifest options, then add a CLI feature to
|
|
3
|
-
// verify the manifest against the schema.
|
|
4
|
-
export const manifestSchema = z.object({
|
|
5
|
-
startup_app: z.optional(z.object({
|
|
6
|
-
name: z.optional(z.string()),
|
|
7
|
-
uuid: z.optional(z.string()),
|
|
8
|
-
url: z.optional(z.string()),
|
|
9
|
-
saveWindowState: z.optional(z.boolean()),
|
|
10
|
-
autoShow: z.optional(z.boolean()),
|
|
11
|
-
})),
|
|
12
|
-
platform: z.optional(z.object({
|
|
13
|
-
uuid: z.optional(z.string()),
|
|
14
|
-
name: z.optional(z.string()),
|
|
15
|
-
autoShow: z.optional(z.boolean()),
|
|
16
|
-
})),
|
|
17
|
-
runtime: z.optional(z.object({
|
|
18
|
-
version: z.optional(z.string()),
|
|
19
|
-
})),
|
|
20
|
-
snapshot: z.optional(z.any()),
|
|
21
|
-
licenseKey: z.optional(z.string()),
|
|
22
|
-
devtools_port: z.optional(z.number()),
|
|
23
|
-
});
|
package/dist/version.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const API_VERSION = '4.0.0';
|