@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
|
@@ -26,7 +26,7 @@ const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organi
|
|
|
26
26
|
* This command provides remote device management capabilities for troubleshooting
|
|
27
27
|
* and maintenance operations.
|
|
28
28
|
*
|
|
29
|
-
* @group Management:
|
|
29
|
+
* @group Management:12
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* ```bash
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provides commands for managing signageOS devices, including connecting to devices
|
|
3
3
|
* for development, controlling device power states, and managing applet deployment.
|
|
4
4
|
*
|
|
5
|
-
* @group Management:
|
|
5
|
+
* @group Management:200
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```bash
|
|
@@ -41,6 +41,10 @@ export declare const device: {
|
|
|
41
41
|
readonly name: "device-uid";
|
|
42
42
|
readonly type: StringConstructor;
|
|
43
43
|
readonly description: "Device UID";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "yes";
|
|
46
|
+
readonly type: BooleanConstructor;
|
|
47
|
+
readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
|
|
44
48
|
}];
|
|
45
49
|
commands: never[];
|
|
46
50
|
run(options: import("../Command/commandDefinition").CommandLineOptions<readonly [{
|
|
@@ -59,6 +63,10 @@ export declare const device: {
|
|
|
59
63
|
readonly name: "device-uid";
|
|
60
64
|
readonly type: StringConstructor;
|
|
61
65
|
readonly description: "Device UID";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "yes";
|
|
68
|
+
readonly type: BooleanConstructor;
|
|
69
|
+
readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
|
|
62
70
|
}]>): Promise<void>;
|
|
63
71
|
} | {
|
|
64
72
|
name: "power-action";
|
|
@@ -18,7 +18,7 @@ const commandDefinition_1 = require("../Command/commandDefinition");
|
|
|
18
18
|
* Provides commands for managing signageOS devices, including connecting to devices
|
|
19
19
|
* for development, controlling device power states, and managing applet deployment.
|
|
20
20
|
*
|
|
21
|
-
* @group Management:
|
|
21
|
+
* @group Management:200
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```bash
|
|
@@ -17,6 +17,6 @@ export declare const POWER_ACTION_TYPE_OPTION: {
|
|
|
17
17
|
readonly type: StringConstructor;
|
|
18
18
|
readonly description: "Type of device power action";
|
|
19
19
|
};
|
|
20
|
-
export declare function getDeviceUid(restApi: RestApi, options: CommandLineOptions<[typeof DEVICE_UID_OPTION]
|
|
20
|
+
export declare function getDeviceUid(restApi: RestApi, options: CommandLineOptions<[typeof DEVICE_UID_OPTION]>, skipConfirmation?: boolean): Promise<string>;
|
|
21
21
|
export declare function getActionType(options: CommandLineOptions<[typeof POWER_ACTION_TYPE_OPTION]>): Promise<string>;
|
|
22
22
|
export declare function disconnectDevice(organization: IOrganization, deviceUid: string): Promise<any>;
|
|
@@ -26,7 +26,7 @@ const Debug = (0, debug_1.default)('@signageos/cli:Device:facade');
|
|
|
26
26
|
exports.typeMap = new Map([
|
|
27
27
|
['reboot', { name: 'Reboot Device', action: IPowerAction_1.DevicePowerAction.SystemReboot }],
|
|
28
28
|
['displayOn', { name: 'Display ON', action: IPowerAction_1.DevicePowerAction.DisplayPowerOn }],
|
|
29
|
-
['
|
|
29
|
+
['displayOff', { name: 'Display OFF', action: IPowerAction_1.DevicePowerAction.DisplayPowerOff }],
|
|
30
30
|
['restart', { name: 'Restart Device', action: IPowerAction_1.DevicePowerAction.AppRestart }],
|
|
31
31
|
['disable', { name: 'Applet Disable', action: IPowerAction_1.DevicePowerAction.AppletDisable }],
|
|
32
32
|
['enable', { name: 'Applet Enable', action: IPowerAction_1.DevicePowerAction.AppletEnable }],
|
|
@@ -35,25 +35,30 @@ exports.typeMap = new Map([
|
|
|
35
35
|
]);
|
|
36
36
|
exports.DEVICE_UID_OPTION = { name: 'device-uid', type: String, description: 'Device UID' };
|
|
37
37
|
exports.POWER_ACTION_TYPE_OPTION = { name: 'type', type: String, description: `Type of device power action` };
|
|
38
|
-
function getDeviceUid(
|
|
39
|
-
return __awaiter(this,
|
|
38
|
+
function getDeviceUid(restApi_1, options_1) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function* (restApi, options, skipConfirmation = false) {
|
|
40
40
|
let deviceUid = options['device-uid'];
|
|
41
41
|
if (!deviceUid) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
if (skipConfirmation) {
|
|
43
|
+
throw new Error('Device UID is required. Please specify --device-uid argument.');
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const devices = yield restApi.device.list();
|
|
47
|
+
const response = yield (0, prompts_1.default)({
|
|
48
|
+
type: 'autocomplete',
|
|
49
|
+
name: 'deviceUid',
|
|
50
|
+
message: `Select device to use`,
|
|
51
|
+
choices: devices.map((dev) => {
|
|
52
|
+
var _a;
|
|
53
|
+
return ({
|
|
54
|
+
title: `${(_a = dev.name) !== null && _a !== void 0 ? _a : `Unnamed device, created ${dev.createdAt.toString()}`} (${dev.uid})`,
|
|
55
|
+
value: dev.uid,
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
Debug('Device selected', response.deviceUid);
|
|
60
|
+
deviceUid = response.deviceUid;
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
if (!deviceUid) {
|
|
59
64
|
throw new Error('Missing argument --device-uid <string>');
|
|
@@ -13,7 +13,7 @@ declare const OPTION_LIST: readonly [{
|
|
|
13
13
|
* by its UID. If no organization UID is provided, uses the default organization
|
|
14
14
|
* or prompts for selection from available organizations.
|
|
15
15
|
*
|
|
16
|
-
* @group Management:
|
|
16
|
+
* @group Management:22
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```bash
|
|
@@ -24,7 +24,7 @@ const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organi
|
|
|
24
24
|
* by its UID. If no organization UID is provided, uses the default organization
|
|
25
25
|
* or prompts for selection from available organizations.
|
|
26
26
|
*
|
|
27
|
-
* @group Management:
|
|
27
|
+
* @group Management:22
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```bash
|
|
@@ -23,7 +23,7 @@ const Debug = (0, debug_1.default)('@signageos/cli:Organization:list');
|
|
|
23
23
|
* account has access to. This command helps users understand which organizations
|
|
24
24
|
* they can work with and select appropriate targets for other CLI operations.
|
|
25
25
|
*
|
|
26
|
-
* @group Management:
|
|
26
|
+
* @group Management:21
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```bash
|
|
@@ -9,7 +9,7 @@ declare const OPTION_LIST: readonly [{
|
|
|
9
9
|
* that require an organization context. This eliminates the need to specify the organization
|
|
10
10
|
* UID for each command. The default organization is stored in the ~/.sosrc configuration file.
|
|
11
11
|
*
|
|
12
|
-
* @group Management:
|
|
12
|
+
* @group Management:23
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```bash
|
|
@@ -26,7 +26,7 @@ const OPTION_LIST = [organizationFacade_1.ORGANIZATION_UID_OPTION];
|
|
|
26
26
|
* that require an organization context. This eliminates the need to specify the organization
|
|
27
27
|
* UID for each command. The default organization is stored in the ~/.sosrc configuration file.
|
|
28
28
|
*
|
|
29
|
-
* @group Management:
|
|
29
|
+
* @group Management:23
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* ```bash
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provides commands to manage signageOS organizations including listing available organizations,
|
|
3
3
|
* retrieving organization details, and setting default organization for CLI operations.
|
|
4
4
|
*
|
|
5
|
-
* @group Management:
|
|
5
|
+
* @group Management:201
|
|
6
6
|
*
|
|
7
7
|
* @subcommands
|
|
8
8
|
* - `list` - List all organizations accessible to the current user
|
|
@@ -18,7 +18,7 @@ const commandDefinition_1 = require("../Command/commandDefinition");
|
|
|
18
18
|
* Provides commands to manage signageOS organizations including listing available organizations,
|
|
19
19
|
* retrieving organization details, and setting default organization for CLI operations.
|
|
20
20
|
*
|
|
21
|
-
* @group Management:
|
|
21
|
+
* @group Management:201
|
|
22
22
|
*
|
|
23
23
|
* @subcommands
|
|
24
24
|
* - `list` - List all organizations accessible to the current user
|
|
@@ -1,7 +1,41 @@
|
|
|
1
|
+
import { CommandLineOptions } from '../../Command/commandDefinition';
|
|
2
|
+
import { OPTION_LIST } from './pluginGenerateOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a local repository for developing a Plugin 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:31
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```bash
|
|
14
|
+
* # Generate plugin project interactively
|
|
15
|
+
* sos plugin generate
|
|
16
|
+
*
|
|
17
|
+
* # Generate non-interactively (suitable for CI/CD)
|
|
18
|
+
* sos plugin generate --name my-plugin --description "My custom plugin" --yes
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @since 2.6.0
|
|
22
|
+
*/
|
|
1
23
|
export declare const pluginGenerate: {
|
|
2
24
|
name: "generate";
|
|
3
25
|
description: string;
|
|
4
|
-
optionList:
|
|
26
|
+
optionList: readonly [{
|
|
27
|
+
readonly name: "name";
|
|
28
|
+
readonly type: StringConstructor;
|
|
29
|
+
readonly description: "Plugin name";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "description";
|
|
32
|
+
readonly type: StringConstructor;
|
|
33
|
+
readonly description: "Plugin 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 pluginGenerateFacade_1 = require("./pluginGenerateFacade");
|
|
22
|
+
const pluginGenerateOptions_1 = require("./pluginGenerateOptions");
|
|
23
|
+
/**
|
|
24
|
+
* Generates a local repository for developing a Plugin 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:31
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```bash
|
|
34
|
+
* # Generate plugin project interactively
|
|
35
|
+
* sos plugin generate
|
|
36
|
+
*
|
|
37
|
+
* # Generate non-interactively (suitable for CI/CD)
|
|
38
|
+
* sos plugin generate --name my-plugin --description "My custom plugin" --yes
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @since 2.6.0
|
|
42
|
+
*/
|
|
22
43
|
exports.pluginGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
23
44
|
name: 'generate',
|
|
24
45
|
description: 'Generates a local repository for developing a Plugin',
|
|
25
|
-
optionList:
|
|
46
|
+
optionList: pluginGenerateOptions_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, pluginGenerateFacade_1.askForParameters)(options, skipConfirmation);
|
|
31
53
|
yield (0, pluginGenerateFacade_1.downloadBoilerplateCode)(targetDir);
|
|
32
54
|
yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description });
|
|
33
55
|
(0, log_1.log)('info', `Plugin ${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 './pluginGenerateOptions';
|
|
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('Plugin 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 Plugin 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: "Plugin name";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "description";
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly description: "Plugin 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: 'Plugin name',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'description',
|
|
12
|
+
type: String,
|
|
13
|
+
description: 'Plugin 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 plugin or version creation";
|
|
10
14
|
}];
|
|
15
|
+
/**
|
|
16
|
+
* Uploads current plugin version to the signageOS platform based on configuration
|
|
17
|
+
* and schema files in the current directory. Handles plugin and version management automatically.
|
|
18
|
+
*
|
|
19
|
+
* May prompt for confirmation when creating new plugins or versions.
|
|
20
|
+
* Use `--yes` to skip confirmation prompts for automated deployments.
|
|
21
|
+
*
|
|
22
|
+
* @group Development:32
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```bash
|
|
26
|
+
* # Upload plugin from current directory
|
|
27
|
+
* sos plugin upload
|
|
28
|
+
*
|
|
29
|
+
* # Upload with specific organization, skip prompts
|
|
30
|
+
* sos plugin upload --organization-uid abc123def456 --yes
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @since 2.6.0
|
|
34
|
+
*/
|
|
11
35
|
export declare const pluginUpload: {
|
|
12
36
|
name: "upload";
|
|
13
37
|
description: string;
|
|
@@ -19,6 +43,10 @@ export declare const pluginUpload: {
|
|
|
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 plugin or version creation";
|
|
22
50
|
}];
|
|
23
51
|
commands: never[];
|
|
24
52
|
run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
|
|
@@ -23,7 +23,35 @@ const util_1 = require("util");
|
|
|
23
23
|
const helper_1 = require("../../helper");
|
|
24
24
|
const debug_1 = __importDefault(require("debug"));
|
|
25
25
|
const Debug = (0, debug_1.default)('@signageos/cli:Plugin: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 plugin or version creation',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Uploads current plugin version to the signageOS platform based on configuration
|
|
37
|
+
* and schema files in the current directory. Handles plugin and version management automatically.
|
|
38
|
+
*
|
|
39
|
+
* May prompt for confirmation when creating new plugins or versions.
|
|
40
|
+
* Use `--yes` to skip confirmation prompts for automated deployments.
|
|
41
|
+
*
|
|
42
|
+
* @group Development:32
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```bash
|
|
46
|
+
* # Upload plugin from current directory
|
|
47
|
+
* sos plugin upload
|
|
48
|
+
*
|
|
49
|
+
* # Upload with specific organization, skip prompts
|
|
50
|
+
* sos plugin upload --organization-uid abc123def456 --yes
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @since 2.6.0
|
|
54
|
+
*/
|
|
27
55
|
exports.pluginUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
28
56
|
name: 'upload',
|
|
29
57
|
description: 'Uploads current plugin version',
|
|
@@ -37,7 +65,8 @@ exports.pluginUpload = (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, pluginFacade_1.loadSchemas)(currentDirectory);
|
|
40
|
-
const
|
|
68
|
+
const skipConfirmation = !!options.yes;
|
|
69
|
+
const pluginVersion = yield (0, pluginFacade_1.ensurePluginVersion)(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,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;
|