@signageos/cli 2.6.1 → 2.7.1
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 +15 -19
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +15 -19
- package/dist/CustomScript/customScriptCommand.d.ts +27 -9
- package/dist/CustomScript/customScriptCommand.js +9 -7
- 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 +23 -18
- 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 +14 -13
- 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 +3 -2
|
@@ -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;
|
|
@@ -59,22 +59,27 @@ const fileSystem_1 = require("../Lib/fileSystem");
|
|
|
59
59
|
const runtimeFileSystem_1 = require("@signageos/sdk/dist/Development/runtimeFileSystem");
|
|
60
60
|
const customScriptFacade_1 = require("../CustomScript/customScriptFacade");
|
|
61
61
|
const PLUGIN_BUILDS_DIRNAME = 'plugin_builds';
|
|
62
|
-
function ensureRunnerVersion(restApi, config, schema) {
|
|
62
|
+
function ensureRunnerVersion(restApi, config, schema, skipConfirmation) {
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const runner = yield ensureRunner(restApi, config);
|
|
64
|
+
const runner = yield ensureRunner(restApi, config, skipConfirmation);
|
|
65
65
|
const runnerVersion = yield restApi.runner.version.get({ runnerUid: runner.uid, version: config.version });
|
|
66
66
|
if (runnerVersion) {
|
|
67
67
|
return runnerVersion;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
if (skipConfirmation) {
|
|
70
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner version ${config.version}`));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const response = yield (0, prompts_1.default)({
|
|
74
|
+
type: 'confirm',
|
|
75
|
+
name: 'newVersion',
|
|
76
|
+
message: `Do you want to create new runner version ${config.version}?`,
|
|
77
|
+
});
|
|
78
|
+
if (!response.newVersion) {
|
|
79
|
+
throw new Error('Runner version creation was canceled.');
|
|
80
|
+
}
|
|
81
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner version ${config.version}`));
|
|
76
82
|
}
|
|
77
|
-
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner version ${config.version}`));
|
|
78
83
|
return yield restApi.runner.version.create({
|
|
79
84
|
runnerUid: runner.uid,
|
|
80
85
|
version: config.version,
|
|
@@ -86,7 +91,7 @@ function ensureRunnerVersion(restApi, config, schema) {
|
|
|
86
91
|
});
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
|
-
function ensureRunner(restApi, config) {
|
|
94
|
+
function ensureRunner(restApi, config, skipConfirmation) {
|
|
90
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
96
|
if (config.uid) {
|
|
92
97
|
const runner = yield restApi.runner.get(config.uid);
|
|
@@ -100,15 +105,20 @@ function ensureRunner(restApi, config) {
|
|
|
100
105
|
}
|
|
101
106
|
throw new Error(`Runner with uid "${config.uid}" not found`);
|
|
102
107
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
if (skipConfirmation) {
|
|
109
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner "${config.name}"`));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const response = yield (0, prompts_1.default)({
|
|
113
|
+
type: 'confirm',
|
|
114
|
+
name: 'create',
|
|
115
|
+
message: `Runner "${config.name}" does not exist. Do you want to create it?`,
|
|
116
|
+
});
|
|
117
|
+
if (!response.create) {
|
|
118
|
+
throw new Error('Runner upload was canceled.');
|
|
119
|
+
}
|
|
120
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner "${config.name}"`));
|
|
110
121
|
}
|
|
111
|
-
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner "${config.name}"`));
|
|
112
122
|
const createdRunner = yield restApi.runner.create({
|
|
113
123
|
name: config.name,
|
|
114
124
|
title: config.name,
|
|
@@ -17,7 +17,7 @@ declare const OPTION_LIST: readonly [{
|
|
|
17
17
|
* to a specific device. Timing configurations define when and how content
|
|
18
18
|
* (applets) should be displayed on devices, including scheduling and duration settings.
|
|
19
19
|
*
|
|
20
|
-
* @group Management:
|
|
20
|
+
* @group Management:31
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```bash
|
|
@@ -26,7 +26,7 @@ const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organi
|
|
|
26
26
|
* to a specific device. Timing configurations define when and how content
|
|
27
27
|
* (applets) should be displayed on devices, including scheduling and duration settings.
|
|
28
28
|
*
|
|
29
|
-
* @group Management:
|
|
29
|
+
* @group Management:31
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* ```bash
|
|
@@ -17,7 +17,7 @@ const timingListCommand_1 = require("./List/timingListCommand");
|
|
|
17
17
|
* applets are displayed on signageOS devices. Timing configurations define the
|
|
18
18
|
* relationship between devices, applets, and scheduling parameters.
|
|
19
19
|
*
|
|
20
|
-
* @group Management:
|
|
20
|
+
* @group Management:202
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```bash
|
package/dist/index.js
CHANGED
|
@@ -59,5 +59,6 @@ const index = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
59
59
|
// Initialize autocomplete with root command reference using dependency injection
|
|
60
60
|
(0, autocompleteCommand_1.initializeAutocomplete)(index);
|
|
61
61
|
(0, commandProcessor_1.processCommand)(index).catch((err) => {
|
|
62
|
-
|
|
62
|
+
console.error(err.message || err);
|
|
63
|
+
process.exit(1);
|
|
63
64
|
});
|
package/docs/applet/index.md
CHANGED