@signageos/cli 2.6.0 → 2.7.0
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 +54 -0
- package/dist/Applet/Build/appletBuildCommand.d.ts +1 -2
- package/dist/Applet/Build/appletBuildCommand.js +1 -2
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +1 -1
- package/dist/Applet/Generate/appletGenerateCommand.js +6 -6
- package/dist/Applet/Start/appletStartCommand.d.ts +1 -1
- package/dist/Applet/Start/appletStartCommand.js +1 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.d.ts +1 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +1 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.d.ts +1 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +1 -1
- package/dist/Applet/Test/appletTestCommand.d.ts +1 -1
- package/dist/Applet/Test/appletTestCommand.js +1 -1
- package/dist/Applet/Upload/appletUploadCommand.d.ts +1 -1
- package/dist/Applet/Upload/appletUploadCommand.js +1 -1
- package/dist/Applet/appletCommand.d.ts +1 -1
- package/dist/Applet/appletCommand.js +1 -1
- package/dist/Applet/appletFacade.d.ts +2 -2
- package/dist/Applet/appletFacade.js +22 -14
- package/dist/Auth/loginCommand.d.ts +3 -10
- package/dist/Auth/loginCommand.js +10 -22
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +1 -1
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +1 -1
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +1 -1
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +1 -1
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +1 -1
- package/dist/Command/Autocomplete/autocompleteCommand.d.ts +1 -1
- package/dist/Command/Autocomplete/autocompleteCommand.js +1 -1
- package/dist/Command/commandProcessor.d.ts +1 -0
- package/dist/Command/commandProcessor.js +78 -0
- package/dist/Command/globalArgs.d.ts +0 -2
- package/dist/Command/globalArgs.js +0 -2
- package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +32 -8
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -9
- package/dist/CustomScript/Generate/customScriptGenerateFacade.d.ts +7 -5
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +81 -32
- package/dist/CustomScript/Generate/customScriptGenerateOptions.d.ts +17 -0
- package/dist/CustomScript/Generate/customScriptGenerateOptions.js +13 -0
- package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +23 -16
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +26 -18
- package/dist/CustomScript/customScriptCommand.d.ts +31 -9
- package/dist/CustomScript/customScriptCommand.js +9 -7
- package/dist/CustomScript/customScriptFacade.d.ts +1 -1
- package/dist/CustomScript/customScriptFacade.js +29 -19
- package/dist/Device/Connect/connectCommand.d.ts +1 -1
- package/dist/Device/Connect/connectCommand.js +1 -1
- package/dist/Device/Content/setContentCommand.d.ts +16 -6
- package/dist/Device/Content/setContentCommand.js +23 -10
- package/dist/Device/PowerAction/powerActionCommand.d.ts +1 -1
- package/dist/Device/PowerAction/powerActionCommand.js +1 -1
- package/dist/Device/deviceCommand.d.ts +9 -1
- package/dist/Device/deviceCommand.js +1 -1
- package/dist/Device/deviceFacade.d.ts +1 -1
- package/dist/Device/deviceFacade.js +22 -17
- package/dist/Organization/Get/organizationGetCommand.d.ts +1 -1
- package/dist/Organization/Get/organizationGetCommand.js +1 -1
- package/dist/Organization/List/organizationListCommand.d.ts +1 -1
- package/dist/Organization/List/organizationListCommand.js +1 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.d.ts +1 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +1 -1
- package/dist/Organization/organizationCommand.d.ts +1 -1
- package/dist/Organization/organizationCommand.js +1 -1
- package/dist/Plugin/Generate/pluginGenerateCommand.d.ts +36 -2
- package/dist/Plugin/Generate/pluginGenerateCommand.js +25 -3
- package/dist/Plugin/Generate/pluginGenerateFacade.d.ts +7 -5
- package/dist/Plugin/Generate/pluginGenerateFacade.js +38 -16
- package/dist/Plugin/Generate/pluginGenerateOptions.d.ts +13 -0
- package/dist/Plugin/Generate/pluginGenerateOptions.js +20 -0
- package/dist/Plugin/Upload/pluginUploadCommand.d.ts +28 -0
- package/dist/Plugin/Upload/pluginUploadCommand.js +31 -2
- package/dist/Plugin/pluginCommand.d.ts +49 -2
- package/dist/Plugin/pluginCommand.js +31 -0
- package/dist/Plugin/pluginFacade.d.ts +1 -1
- package/dist/Plugin/pluginFacade.js +29 -19
- package/dist/Runner/Generate/runnerGenerateCommand.d.ts +36 -2
- package/dist/Runner/Generate/runnerGenerateCommand.js +25 -3
- package/dist/Runner/Generate/runnerGenerateFacade.d.ts +7 -5
- package/dist/Runner/Generate/runnerGenerateFacade.js +38 -16
- package/dist/Runner/Generate/runnerGenerateOptions.d.ts +13 -0
- package/dist/Runner/Generate/runnerGenerateOptions.js +20 -0
- package/dist/Runner/Upload/runnerUploadCommand.d.ts +28 -0
- package/dist/Runner/Upload/runnerUploadCommand.js +31 -2
- package/dist/Runner/runnerCommand.d.ts +41 -2
- package/dist/Runner/runnerCommand.js +23 -0
- package/dist/Runner/runnerFacede.d.ts +1 -1
- package/dist/Runner/runnerFacede.js +29 -19
- package/dist/Timing/List/timingListCommand.d.ts +1 -1
- package/dist/Timing/List/timingListCommand.js +1 -1
- package/dist/Timing/timingCommand.d.ts +1 -1
- package/dist/Timing/timingCommand.js +1 -1
- package/dist/index.js +2 -1
- package/docs/applet/build/index.md +1 -1
- package/docs/applet/generate/index.md +1 -1
- package/docs/applet/index.md +1 -1
- package/docs/applet/start/index.md +1 -1
- package/docs/applet/test/index.md +1 -1
- package/docs/applet/test/run/index.md +1 -1
- package/docs/applet/test/upload/index.md +1 -1
- package/docs/applet/upload/index.md +1 -1
- package/docs/autocomplete/index.md +1 -1
- package/docs/autocomplete/install/index.md +1 -1
- package/docs/autocomplete/uninstall/index.md +1 -1
- package/docs/custom-script/generate/index.md +20 -6
- package/docs/custom-script/index.md +9 -7
- package/docs/custom-script/upload/index.md +19 -14
- package/docs/device/connect/index.md +1 -1
- package/docs/device/index.md +1 -1
- package/docs/device/power-action/index.md +1 -1
- package/docs/device/set-content/index.md +12 -8
- package/docs/index.md +20 -4
- package/docs/login/index.md +2 -2
- package/docs/organization/get/index.md +1 -1
- package/docs/organization/index.md +1 -1
- package/docs/organization/list/index.md +1 -1
- package/docs/organization/set-default/index.md +1 -1
- package/docs/plugin/generate/index.md +31 -1
- package/docs/plugin/index.md +34 -1
- package/docs/plugin/upload/index.md +28 -5
- package/docs/runner/generate/index.md +31 -1
- package/docs/runner/index.md +26 -1
- package/docs/runner/upload/index.md +28 -5
- package/docs/timing/index.md +1 -1
- package/docs/timing/list/index.md +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin management operations for developing and deploying signageOS plugins.
|
|
3
|
+
*
|
|
4
|
+
* Plugins extend native signageOS features and integrate with system policies.
|
|
5
|
+
* They run periodically to ensure configuration is consistently enforced on devices.
|
|
6
|
+
*
|
|
7
|
+
* Plugins must implement `set` and `get` methods.
|
|
8
|
+
* Upload reads `.sosconfig.json` for configuration.
|
|
9
|
+
*
|
|
10
|
+
* @group Development:102
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```bash
|
|
14
|
+
* # Generate a new plugin project interactively
|
|
15
|
+
* sos plugin generate
|
|
16
|
+
*
|
|
17
|
+
* # Generate plugin with all parameters (non-interactive, suitable for CI/CD)
|
|
18
|
+
* sos plugin generate --name my-plugin --description "Custom functionality" --yes
|
|
19
|
+
*
|
|
20
|
+
* # Upload plugin to signageOS platform
|
|
21
|
+
* sos plugin upload
|
|
22
|
+
*
|
|
23
|
+
* # Upload plugin non-interactively (for CI/CD pipelines)
|
|
24
|
+
* sos plugin upload --yes
|
|
25
|
+
*
|
|
26
|
+
* # Upload with specific organization
|
|
27
|
+
* sos plugin upload --organization-uid abc123def456
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @since 2.6.0
|
|
31
|
+
*/
|
|
1
32
|
export declare const plugin: {
|
|
2
33
|
name: "plugin";
|
|
3
34
|
description: string;
|
|
@@ -5,9 +36,21 @@ export declare const plugin: {
|
|
|
5
36
|
commands: ({
|
|
6
37
|
name: "generate";
|
|
7
38
|
description: string;
|
|
8
|
-
optionList:
|
|
39
|
+
optionList: readonly [{
|
|
40
|
+
readonly name: "name";
|
|
41
|
+
readonly type: StringConstructor;
|
|
42
|
+
readonly description: "Plugin name";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "description";
|
|
45
|
+
readonly type: StringConstructor;
|
|
46
|
+
readonly description: "Plugin description";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "yes";
|
|
49
|
+
readonly type: BooleanConstructor;
|
|
50
|
+
readonly description: "Skip confirmation prompts and use provided values";
|
|
51
|
+
}];
|
|
9
52
|
commands: never[];
|
|
10
|
-
run(): Promise<void>;
|
|
53
|
+
run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Generate/pluginGenerateOptions").OPTION_LIST>): Promise<void>;
|
|
11
54
|
} | {
|
|
12
55
|
name: "upload";
|
|
13
56
|
description: string;
|
|
@@ -19,6 +62,10 @@ export declare const plugin: {
|
|
|
19
62
|
readonly name: "organization-uid";
|
|
20
63
|
readonly type: StringConstructor;
|
|
21
64
|
readonly description: "Organization UID";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "yes";
|
|
67
|
+
readonly type: BooleanConstructor;
|
|
68
|
+
readonly description: "Skip confirmation prompts for plugin or version creation";
|
|
22
69
|
}];
|
|
23
70
|
commands: never[];
|
|
24
71
|
run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Upload/pluginUploadCommand").OPTION_LIST>): Promise<void>;
|
|
@@ -13,6 +13,37 @@ exports.plugin = void 0;
|
|
|
13
13
|
const commandDefinition_1 = require("../Command/commandDefinition");
|
|
14
14
|
const pluginGenerateCommand_1 = require("./Generate/pluginGenerateCommand");
|
|
15
15
|
const pluginUploadCommand_1 = require("./Upload/pluginUploadCommand");
|
|
16
|
+
/**
|
|
17
|
+
* Plugin management operations for developing and deploying signageOS plugins.
|
|
18
|
+
*
|
|
19
|
+
* Plugins extend native signageOS features and integrate with system policies.
|
|
20
|
+
* They run periodically to ensure configuration is consistently enforced on devices.
|
|
21
|
+
*
|
|
22
|
+
* Plugins must implement `set` and `get` methods.
|
|
23
|
+
* Upload reads `.sosconfig.json` for configuration.
|
|
24
|
+
*
|
|
25
|
+
* @group Development:102
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```bash
|
|
29
|
+
* # Generate a new plugin project interactively
|
|
30
|
+
* sos plugin generate
|
|
31
|
+
*
|
|
32
|
+
* # Generate plugin with all parameters (non-interactive, suitable for CI/CD)
|
|
33
|
+
* sos plugin generate --name my-plugin --description "Custom functionality" --yes
|
|
34
|
+
*
|
|
35
|
+
* # Upload plugin to signageOS platform
|
|
36
|
+
* sos plugin upload
|
|
37
|
+
*
|
|
38
|
+
* # Upload plugin non-interactively (for CI/CD pipelines)
|
|
39
|
+
* sos plugin upload --yes
|
|
40
|
+
*
|
|
41
|
+
* # Upload with specific organization
|
|
42
|
+
* sos plugin upload --organization-uid abc123def456
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @since 2.6.0
|
|
46
|
+
*/
|
|
16
47
|
exports.plugin = (0, commandDefinition_1.createCommandDefinition)({
|
|
17
48
|
name: 'plugin',
|
|
18
49
|
description: 'Plugin management',
|
|
@@ -2,7 +2,7 @@ import z from 'zod';
|
|
|
2
2
|
import RestApi from '@signageos/sdk/dist/RestApi/RestApi';
|
|
3
3
|
import { IPluginVersion } from '@signageos/sdk/dist/RestApi/Plugin/Version/IPluginVersion';
|
|
4
4
|
import { PlatformConfig } from '../CustomScript/customScriptFacade';
|
|
5
|
-
export declare function ensurePluginVersion(restApi: RestApi, config: PluginConfig, schema: any): Promise<import("@signageos/sdk/dist/RestApi/Plugin/Version/PluginVersion").PluginVersion>;
|
|
5
|
+
export declare function ensurePluginVersion(restApi: RestApi, config: PluginConfig, schema: any, skipConfirmation?: boolean): Promise<import("@signageos/sdk/dist/RestApi/Plugin/Version/PluginVersion").PluginVersion>;
|
|
6
6
|
export declare function uploadCode({ restApi, workDir, platform, config, pluginVersion, }: {
|
|
7
7
|
restApi: RestApi;
|
|
8
8
|
workDir: string;
|
|
@@ -61,9 +61,9 @@ const fileSystem_1 = require("../Lib/fileSystem");
|
|
|
61
61
|
const runtimeFileSystem_1 = require("@signageos/sdk/dist/Development/runtimeFileSystem");
|
|
62
62
|
const customScriptFacade_1 = require("../CustomScript/customScriptFacade");
|
|
63
63
|
const PLUGIN_BUILDS_DIRNAME = 'plugin_builds';
|
|
64
|
-
function ensurePluginVersion(restApi, config, schema) {
|
|
64
|
+
function ensurePluginVersion(restApi, config, schema, skipConfirmation) {
|
|
65
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const plugin = yield ensurePlugin(restApi, config);
|
|
66
|
+
const plugin = yield ensurePlugin(restApi, config, skipConfirmation);
|
|
67
67
|
const pluginVersion = yield restApi.plugin.version.get({
|
|
68
68
|
pluginUid: plugin.uid,
|
|
69
69
|
version: config.version,
|
|
@@ -71,15 +71,20 @@ function ensurePluginVersion(restApi, config, schema) {
|
|
|
71
71
|
if (pluginVersion) {
|
|
72
72
|
return pluginVersion;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
if (skipConfirmation) {
|
|
75
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Plugin version ${config.version}`));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const response = yield (0, prompts_1.default)({
|
|
79
|
+
type: 'confirm',
|
|
80
|
+
name: 'newVersion',
|
|
81
|
+
message: `Do you want to create new plugin version ${config.version}?`,
|
|
82
|
+
});
|
|
83
|
+
if (!response.newVersion) {
|
|
84
|
+
throw new Error('Plugin version creation was canceled.');
|
|
85
|
+
}
|
|
86
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Plugin version ${config.version}`));
|
|
81
87
|
}
|
|
82
|
-
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Plugin version ${config.version}`));
|
|
83
88
|
return yield restApi.plugin.version.create({
|
|
84
89
|
pluginUid: plugin.uid,
|
|
85
90
|
version: config.version,
|
|
@@ -89,7 +94,7 @@ function ensurePluginVersion(restApi, config, schema) {
|
|
|
89
94
|
});
|
|
90
95
|
});
|
|
91
96
|
}
|
|
92
|
-
function ensurePlugin(restApi, config) {
|
|
97
|
+
function ensurePlugin(restApi, config, skipConfirmation) {
|
|
93
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
99
|
if (config.uid) {
|
|
95
100
|
const plugin = yield restApi.plugin.get(config.uid);
|
|
@@ -103,15 +108,20 @@ function ensurePlugin(restApi, config) {
|
|
|
103
108
|
}
|
|
104
109
|
throw new Error(`Plugin with uid "${config.uid}" not found`);
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
if (skipConfirmation) {
|
|
112
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Plugin "${config.name}"`));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const response = yield (0, prompts_1.default)({
|
|
116
|
+
type: 'confirm',
|
|
117
|
+
name: 'create',
|
|
118
|
+
message: `Plugin "${config.name}" does not exist. Do you want to create it?`,
|
|
119
|
+
});
|
|
120
|
+
if (!response.create) {
|
|
121
|
+
throw new Error('Plugin upload was canceled.');
|
|
122
|
+
}
|
|
123
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Plugin "${config.name}"`));
|
|
113
124
|
}
|
|
114
|
-
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Plugin "${config.name}"`));
|
|
115
125
|
const createdPlugin = yield restApi.plugin.create({
|
|
116
126
|
name: config.name,
|
|
117
127
|
title: config.name,
|
|
@@ -1,7 +1,41 @@
|
|
|
1
|
+
import { CommandLineOptions } from '../../Command/commandDefinition';
|
|
2
|
+
import { OPTION_LIST } from './runnerGenerateOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a local repository for developing a Runner with boilerplate code and configuration files.
|
|
5
|
+
* Sets up complete development environment with necessary dependencies and project structure.
|
|
6
|
+
*
|
|
7
|
+
* Runs interactively by default or non-interactively with `--yes` option.
|
|
8
|
+
* Requires Git to be installed and accessible.
|
|
9
|
+
*
|
|
10
|
+
* @group Development:41
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```bash
|
|
14
|
+
* # Generate runner project interactively
|
|
15
|
+
* sos runner generate
|
|
16
|
+
*
|
|
17
|
+
* # Generate non-interactively (suitable for CI/CD)
|
|
18
|
+
* sos runner generate --name my-runner --description "My custom runner" --yes
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @since 2.6.0
|
|
22
|
+
*/
|
|
1
23
|
export declare const runnerGenerate: {
|
|
2
24
|
name: "generate";
|
|
3
25
|
description: string;
|
|
4
|
-
optionList:
|
|
26
|
+
optionList: readonly [{
|
|
27
|
+
readonly name: "name";
|
|
28
|
+
readonly type: StringConstructor;
|
|
29
|
+
readonly description: "Runner name";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "description";
|
|
32
|
+
readonly type: StringConstructor;
|
|
33
|
+
readonly description: "Runner description";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "yes";
|
|
36
|
+
readonly type: BooleanConstructor;
|
|
37
|
+
readonly description: "Skip confirmation prompts and use provided values";
|
|
38
|
+
}];
|
|
5
39
|
commands: never[];
|
|
6
|
-
run(): Promise<void>;
|
|
40
|
+
run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
|
|
7
41
|
};
|
|
@@ -19,15 +19,37 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
|
19
19
|
const git_1 = require("../../Lib/git");
|
|
20
20
|
const customScriptFacade_1 = require("../../CustomScript/customScriptFacade");
|
|
21
21
|
const runnerGenerateFacade_1 = require("./runnerGenerateFacade");
|
|
22
|
+
const runnerGenerateOptions_1 = require("./runnerGenerateOptions");
|
|
23
|
+
/**
|
|
24
|
+
* Generates a local repository for developing a Runner with boilerplate code and configuration files.
|
|
25
|
+
* Sets up complete development environment with necessary dependencies and project structure.
|
|
26
|
+
*
|
|
27
|
+
* Runs interactively by default or non-interactively with `--yes` option.
|
|
28
|
+
* Requires Git to be installed and accessible.
|
|
29
|
+
*
|
|
30
|
+
* @group Development:41
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```bash
|
|
34
|
+
* # Generate runner project interactively
|
|
35
|
+
* sos runner generate
|
|
36
|
+
*
|
|
37
|
+
* # Generate non-interactively (suitable for CI/CD)
|
|
38
|
+
* sos runner generate --name my-runner --description "My custom runner" --yes
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @since 2.6.0
|
|
42
|
+
*/
|
|
22
43
|
exports.runnerGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
23
44
|
name: 'generate',
|
|
24
45
|
description: 'Generates a local repository for developing a Runner',
|
|
25
|
-
optionList:
|
|
46
|
+
optionList: runnerGenerateOptions_1.OPTION_LIST,
|
|
26
47
|
commands: [],
|
|
27
|
-
run() {
|
|
48
|
+
run(options) {
|
|
28
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
50
|
yield (0, git_1.throwErrorIfGitNotInstalled)();
|
|
30
|
-
const
|
|
51
|
+
const skipConfirmation = !!options.yes;
|
|
52
|
+
const { targetDir, name, description } = yield (0, runnerGenerateFacade_1.askForParameters)(options, skipConfirmation);
|
|
31
53
|
yield (0, runnerGenerateFacade_1.downloadBoilerplateCode)(targetDir);
|
|
32
54
|
yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description });
|
|
33
55
|
(0, log_1.log)('info', `Runner ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { CommandLineOptions } from '../../Command/commandDefinition';
|
|
2
|
+
import { OPTION_LIST } from './runnerGenerateOptions';
|
|
1
3
|
/**
|
|
2
|
-
* Prompts the user for the parameters needed to generate a
|
|
4
|
+
* Prompts the user for the parameters needed to generate a custom script.
|
|
3
5
|
*/
|
|
4
|
-
export declare function askForParameters(): Promise<{
|
|
5
|
-
targetDir:
|
|
6
|
-
name:
|
|
7
|
-
description:
|
|
6
|
+
export declare function askForParameters(options?: CommandLineOptions<typeof OPTION_LIST>, skipConfirmation?: boolean): Promise<{
|
|
7
|
+
targetDir: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
8
10
|
}>;
|
|
9
11
|
/**
|
|
10
12
|
* Downloads the latest version of the boilerplate code from the GitHub repository.
|
|
@@ -54,39 +54,61 @@ const fs = __importStar(require("fs-extra"));
|
|
|
54
54
|
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
55
55
|
const git_1 = require("../../Lib/git");
|
|
56
56
|
/**
|
|
57
|
-
* Prompts the user for the parameters needed to generate a
|
|
57
|
+
* Prompts the user for the parameters needed to generate a custom script.
|
|
58
58
|
*/
|
|
59
|
-
function askForParameters() {
|
|
60
|
-
return __awaiter(this,
|
|
59
|
+
function askForParameters(options_1) {
|
|
60
|
+
return __awaiter(this, arguments, void 0, function* (options, skipConfirmation = false) {
|
|
61
61
|
const throwCanceledError = () => {
|
|
62
62
|
throw new Error('Runner generation was canceled.');
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
// Get values from CLI options if provided
|
|
65
|
+
const nameFromOptions = options === null || options === void 0 ? void 0 : options.name;
|
|
66
|
+
const descriptionFromOptions = options === null || options === void 0 ? void 0 : options.description;
|
|
67
|
+
// Determine which prompts are needed
|
|
68
|
+
const promisesToAsk = [];
|
|
69
|
+
if (!nameFromOptions) {
|
|
70
|
+
promisesToAsk.push({
|
|
66
71
|
type: 'text',
|
|
67
72
|
name: 'name',
|
|
68
73
|
message: 'Type name',
|
|
69
74
|
min: 1,
|
|
70
|
-
}
|
|
71
|
-
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (!descriptionFromOptions) {
|
|
78
|
+
promisesToAsk.push({
|
|
72
79
|
type: 'text',
|
|
73
80
|
name: 'description',
|
|
74
81
|
message: 'Type description',
|
|
75
82
|
min: 1,
|
|
76
|
-
}
|
|
77
|
-
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Only prompt if we need values
|
|
86
|
+
let promptResults = {};
|
|
87
|
+
if (promisesToAsk.length > 0) {
|
|
88
|
+
if (skipConfirmation && (nameFromOptions || descriptionFromOptions)) {
|
|
89
|
+
// If in non-interactive mode but missing required parameters, throw error
|
|
90
|
+
throw new Error('Missing required parameters. In non-interactive mode (--yes), you must provide --name and --description options.');
|
|
91
|
+
}
|
|
92
|
+
promptResults = yield (0, prompts_1.default)(promisesToAsk, { onCancel: throwCanceledError });
|
|
93
|
+
}
|
|
94
|
+
// Use CLI options or prompt results
|
|
95
|
+
const name = nameFromOptions || promptResults.name;
|
|
96
|
+
const description = descriptionFromOptions || promptResults.description;
|
|
78
97
|
const targetDir = name;
|
|
79
98
|
(0, log_1.log)('info', `Generating Runner with these parameters:\n` +
|
|
80
99
|
` - Directory: ${chalk_1.default.green(targetDir)}\n` +
|
|
81
100
|
` - Name: ${chalk_1.default.green(name)}\n` +
|
|
82
101
|
` - Description: ${chalk_1.default.green(description)}\n`);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
102
|
+
// Skip confirmation if in non-interactive mode
|
|
103
|
+
if (!skipConfirmation) {
|
|
104
|
+
const { confirm } = yield (0, prompts_1.default)({
|
|
105
|
+
type: 'confirm',
|
|
106
|
+
name: 'confirm',
|
|
107
|
+
message: 'Confirm',
|
|
108
|
+
});
|
|
109
|
+
if (!confirm) {
|
|
110
|
+
throwCanceledError();
|
|
111
|
+
}
|
|
90
112
|
}
|
|
91
113
|
return {
|
|
92
114
|
targetDir,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const OPTION_LIST: readonly [{
|
|
2
|
+
readonly name: "name";
|
|
3
|
+
readonly type: StringConstructor;
|
|
4
|
+
readonly description: "Runner name";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "description";
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly description: "Runner description";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "yes";
|
|
11
|
+
readonly type: BooleanConstructor;
|
|
12
|
+
readonly description: "Skip confirmation prompts and use provided values";
|
|
13
|
+
}];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPTION_LIST = void 0;
|
|
4
|
+
exports.OPTION_LIST = [
|
|
5
|
+
{
|
|
6
|
+
name: 'name',
|
|
7
|
+
type: String,
|
|
8
|
+
description: 'Runner name',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'description',
|
|
12
|
+
type: String,
|
|
13
|
+
description: 'Runner description',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'yes',
|
|
17
|
+
type: Boolean,
|
|
18
|
+
description: 'Skip confirmation prompts and use provided values',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
@@ -7,7 +7,31 @@ export declare const OPTION_LIST: readonly [{
|
|
|
7
7
|
readonly name: "organization-uid";
|
|
8
8
|
readonly type: StringConstructor;
|
|
9
9
|
readonly description: "Organization UID";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "yes";
|
|
12
|
+
readonly type: BooleanConstructor;
|
|
13
|
+
readonly description: "Skip confirmation prompts for runner or version creation";
|
|
10
14
|
}];
|
|
15
|
+
/**
|
|
16
|
+
* Uploads current runner version to the signageOS platform based on configuration
|
|
17
|
+
* and schema files in the current directory. Handles runner and version management automatically.
|
|
18
|
+
*
|
|
19
|
+
* May prompt for confirmation when creating new runners or versions.
|
|
20
|
+
* Use `--yes` to skip confirmation prompts for automated deployments.
|
|
21
|
+
*
|
|
22
|
+
* @group Development:42
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```bash
|
|
26
|
+
* # Upload runner from current directory
|
|
27
|
+
* sos runner upload
|
|
28
|
+
*
|
|
29
|
+
* # Upload with specific organization, skip prompts
|
|
30
|
+
* sos runner upload --organization-uid abc123def456 --yes
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @since 2.6.0
|
|
34
|
+
*/
|
|
11
35
|
export declare const runnerUpload: {
|
|
12
36
|
name: "upload";
|
|
13
37
|
description: string;
|
|
@@ -19,6 +43,10 @@ export declare const runnerUpload: {
|
|
|
19
43
|
readonly name: "organization-uid";
|
|
20
44
|
readonly type: StringConstructor;
|
|
21
45
|
readonly description: "Organization UID";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "yes";
|
|
48
|
+
readonly type: BooleanConstructor;
|
|
49
|
+
readonly description: "Skip confirmation prompts for runner or version creation";
|
|
22
50
|
}];
|
|
23
51
|
commands: never[];
|
|
24
52
|
run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
|
|
@@ -23,7 +23,35 @@ const organizationFacade_1 = require("../../Organization/organizationFacade");
|
|
|
23
23
|
const runnerFacede_1 = require("../runnerFacede");
|
|
24
24
|
const customScriptFacade_1 = require("../../CustomScript/customScriptFacade");
|
|
25
25
|
const Debug = (0, debug_1.default)('@signageos/cli:Runner:Upload:Command');
|
|
26
|
-
exports.OPTION_LIST = [
|
|
26
|
+
exports.OPTION_LIST = [
|
|
27
|
+
organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
|
|
28
|
+
organizationFacade_1.ORGANIZATION_UID_OPTION,
|
|
29
|
+
{
|
|
30
|
+
name: 'yes',
|
|
31
|
+
type: Boolean,
|
|
32
|
+
description: 'Skip confirmation prompts for runner or version creation',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Uploads current runner version to the signageOS platform based on configuration
|
|
37
|
+
* and schema files in the current directory. Handles runner and version management automatically.
|
|
38
|
+
*
|
|
39
|
+
* May prompt for confirmation when creating new runners or versions.
|
|
40
|
+
* Use `--yes` to skip confirmation prompts for automated deployments.
|
|
41
|
+
*
|
|
42
|
+
* @group Development:42
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```bash
|
|
46
|
+
* # Upload runner from current directory
|
|
47
|
+
* sos runner upload
|
|
48
|
+
*
|
|
49
|
+
* # Upload with specific organization, skip prompts
|
|
50
|
+
* sos runner upload --organization-uid abc123def456 --yes
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @since 2.6.0
|
|
54
|
+
*/
|
|
27
55
|
exports.runnerUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
28
56
|
name: 'upload',
|
|
29
57
|
description: 'Uploads current runner version',
|
|
@@ -37,7 +65,8 @@ exports.runnerUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
37
65
|
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
38
66
|
const config = yield (0, customScriptFacade_1.getConfig)(currentDirectory);
|
|
39
67
|
const schema = yield (0, runnerFacede_1.loadSchemas)(currentDirectory);
|
|
40
|
-
const
|
|
68
|
+
const skipConfirmation = !!options.yes;
|
|
69
|
+
const runnerVersion = yield (0, runnerFacede_1.ensureRunnerVersion)(restApi, config, schema, skipConfirmation);
|
|
41
70
|
for (const platform of Object.keys(config.platforms)) {
|
|
42
71
|
const platformConfig = config.platforms[platform];
|
|
43
72
|
if (!platformConfig) {
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner management operations for developing and deploying signageOS runners.
|
|
3
|
+
*
|
|
4
|
+
* Runners are designed for continuous execution as background processes on devices.
|
|
5
|
+
* Once activated, they run indefinitely with active health monitoring and automatic
|
|
6
|
+
* restart capabilities for stability.
|
|
7
|
+
*
|
|
8
|
+
* Runners must implement `run`, `set`, and `get` methods.
|
|
9
|
+
* Upload reads `.sosconfig.json` for configuration.
|
|
10
|
+
*
|
|
11
|
+
* @group Development:103
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```bash
|
|
15
|
+
* # Generate new runner project
|
|
16
|
+
* sos runner generate --name my-runner --description "Background service" --yes
|
|
17
|
+
*
|
|
18
|
+
* # Upload runner to platform
|
|
19
|
+
* sos runner upload --yes
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @since 2.6.0
|
|
23
|
+
*/
|
|
1
24
|
export declare const runner: {
|
|
2
25
|
name: "runner";
|
|
3
26
|
description: string;
|
|
@@ -5,9 +28,21 @@ export declare const runner: {
|
|
|
5
28
|
commands: ({
|
|
6
29
|
name: "generate";
|
|
7
30
|
description: string;
|
|
8
|
-
optionList:
|
|
31
|
+
optionList: readonly [{
|
|
32
|
+
readonly name: "name";
|
|
33
|
+
readonly type: StringConstructor;
|
|
34
|
+
readonly description: "Runner name";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "description";
|
|
37
|
+
readonly type: StringConstructor;
|
|
38
|
+
readonly description: "Runner description";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "yes";
|
|
41
|
+
readonly type: BooleanConstructor;
|
|
42
|
+
readonly description: "Skip confirmation prompts and use provided values";
|
|
43
|
+
}];
|
|
9
44
|
commands: never[];
|
|
10
|
-
run(): Promise<void>;
|
|
45
|
+
run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Generate/runnerGenerateOptions").OPTION_LIST>): Promise<void>;
|
|
11
46
|
} | {
|
|
12
47
|
name: "upload";
|
|
13
48
|
description: string;
|
|
@@ -19,6 +54,10 @@ export declare const runner: {
|
|
|
19
54
|
readonly name: "organization-uid";
|
|
20
55
|
readonly type: StringConstructor;
|
|
21
56
|
readonly description: "Organization UID";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "yes";
|
|
59
|
+
readonly type: BooleanConstructor;
|
|
60
|
+
readonly description: "Skip confirmation prompts for runner or version creation";
|
|
22
61
|
}];
|
|
23
62
|
commands: never[];
|
|
24
63
|
run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Upload/runnerUploadCommand").OPTION_LIST>): Promise<void>;
|
|
@@ -13,6 +13,29 @@ exports.runner = void 0;
|
|
|
13
13
|
const commandDefinition_1 = require("../Command/commandDefinition");
|
|
14
14
|
const runnerGenerateCommand_1 = require("./Generate/runnerGenerateCommand");
|
|
15
15
|
const runnerUploadCommand_1 = require("./Upload/runnerUploadCommand");
|
|
16
|
+
/**
|
|
17
|
+
* Runner management operations for developing and deploying signageOS runners.
|
|
18
|
+
*
|
|
19
|
+
* Runners are designed for continuous execution as background processes on devices.
|
|
20
|
+
* Once activated, they run indefinitely with active health monitoring and automatic
|
|
21
|
+
* restart capabilities for stability.
|
|
22
|
+
*
|
|
23
|
+
* Runners must implement `run`, `set`, and `get` methods.
|
|
24
|
+
* Upload reads `.sosconfig.json` for configuration.
|
|
25
|
+
*
|
|
26
|
+
* @group Development:103
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```bash
|
|
30
|
+
* # Generate new runner project
|
|
31
|
+
* sos runner generate --name my-runner --description "Background service" --yes
|
|
32
|
+
*
|
|
33
|
+
* # Upload runner to platform
|
|
34
|
+
* sos runner upload --yes
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @since 2.6.0
|
|
38
|
+
*/
|
|
16
39
|
exports.runner = (0, commandDefinition_1.createCommandDefinition)({
|
|
17
40
|
name: 'runner',
|
|
18
41
|
description: 'Runner management',
|
|
@@ -3,7 +3,7 @@ import { PlatformConfig } from '../CustomScript/customScriptFacade';
|
|
|
3
3
|
import { IRunnerVersion } from '@signageos/sdk/dist/RestApi/Runner/Version/IRunnerVersion';
|
|
4
4
|
import z from 'zod';
|
|
5
5
|
import { ConfigSchema } from '../Plugin/pluginFacade';
|
|
6
|
-
export declare function ensureRunnerVersion(restApi: RestApi, config: RunnerConfig, schema: any): Promise<IRunnerVersion>;
|
|
6
|
+
export declare function ensureRunnerVersion(restApi: RestApi, config: RunnerConfig, schema: any, skipConfirmation?: boolean): Promise<IRunnerVersion>;
|
|
7
7
|
export declare function uploadCode({ restApi, workDir, platform, config, runnerVersion, }: {
|
|
8
8
|
restApi: RestApi;
|
|
9
9
|
workDir: string;
|