@signageos/cli 3.0.0-rc.0 → 3.0.0-rc.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/dist/CustomScript/Generate/customScriptGenerateCommand.js +6 -0
- package/dist/CustomScript/customScriptFacade.d.ts +17 -1
- package/dist/CustomScript/customScriptFacade.js +16 -5
- package/dist/Emulator/emulatorFacade.js +4 -0
- package/dist/Lib/fileSystem.d.ts +5 -0
- package/dist/Lib/fileSystem.js +23 -0
- package/dist/Plugin/Generate/pluginGenerateCommand.js +6 -0
- package/dist/Plugin/Upload/pluginUploadCommand.js +1 -2
- package/dist/Plugin/pluginFacade.d.ts +14 -0
- package/dist/Plugin/pluginFacade.js +25 -2
- package/dist/Runner/Generate/runnerGenerateCommand.js +6 -0
- package/dist/Runner/Upload/runnerUploadCommand.js +6 -6
- package/dist/Runner/{runnerFacede.js → runnerFacade.js} +3 -1
- package/package.json +2 -2
- /package/dist/Runner/{runnerFacede.d.ts → runnerFacade.d.ts} +0 -0
|
@@ -18,6 +18,8 @@ const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
|
18
18
|
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
19
19
|
const customScriptFacade_1 = require("../customScriptFacade");
|
|
20
20
|
const customScriptGenerateFacade_1 = require("./customScriptGenerateFacade");
|
|
21
|
+
const fileSystem_1 = require("../../Lib/fileSystem");
|
|
22
|
+
const packageVersion_1 = require("../../Cli/packageVersion");
|
|
21
23
|
const git_1 = require("../../Lib/git");
|
|
22
24
|
const customScriptGenerateOptions_1 = require("./customScriptGenerateOptions");
|
|
23
25
|
/**
|
|
@@ -57,6 +59,10 @@ exports.customScriptGenerate = (0, commandDefinition_1.createCommandDefinition)(
|
|
|
57
59
|
const { targetDir, name, description, dangerLevel } = yield (0, customScriptGenerateFacade_1.askForParameters)(options, skipConfirmation);
|
|
58
60
|
yield (0, customScriptGenerateFacade_1.downloadBoilerplateCode)(targetDir);
|
|
59
61
|
yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description, dangerLevel });
|
|
62
|
+
const frontAppletVersion = yield (0, packageVersion_1.getLatestVersion)('@signageos/front-applet');
|
|
63
|
+
if (frontAppletVersion) {
|
|
64
|
+
yield (0, fileSystem_1.addFrontAppletVersionToConfigFile)(targetDir, frontAppletVersion);
|
|
65
|
+
}
|
|
60
66
|
(0, log_1.log)('info', `Custom Script ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
|
|
61
67
|
(0, log_1.log)('info', 'Next steps:');
|
|
62
68
|
(0, log_1.log)('info', ` - Open the folder ${chalk_1.default.green(targetDir)} and read the ${chalk_1.default.green('README.md')} file.`);
|
|
@@ -24,6 +24,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
24
24
|
version: z.ZodString;
|
|
25
25
|
description: z.ZodOptional<z.ZodString>;
|
|
26
26
|
dangerLevel: z.ZodOptional<z.ZodString>;
|
|
27
|
+
sos: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
'@signageos/front-applet': z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
'@signageos/front-applet'?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
'@signageos/front-applet'?: string | undefined;
|
|
33
|
+
}>>;
|
|
27
34
|
/**
|
|
28
35
|
* Config of individual custom script implementations for each target platform.
|
|
29
36
|
*
|
|
@@ -57,6 +64,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
57
64
|
}>;
|
|
58
65
|
configDefinition: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
59
66
|
description?: string | undefined;
|
|
67
|
+
sos?: {
|
|
68
|
+
'@signageos/front-applet'?: string | undefined;
|
|
69
|
+
} | undefined;
|
|
60
70
|
uid?: string | undefined;
|
|
61
71
|
dangerLevel?: string | undefined;
|
|
62
72
|
}, {
|
|
@@ -69,6 +79,9 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
69
79
|
}>;
|
|
70
80
|
configDefinition: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
71
81
|
description?: string | undefined;
|
|
82
|
+
sos?: {
|
|
83
|
+
'@signageos/front-applet'?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
72
85
|
uid?: string | undefined;
|
|
73
86
|
dangerLevel?: string | undefined;
|
|
74
87
|
}>;
|
|
@@ -94,6 +107,9 @@ export declare function getConfig(workDir: string): Promise<{
|
|
|
94
107
|
}>;
|
|
95
108
|
configDefinition: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
96
109
|
description?: string | undefined;
|
|
110
|
+
sos?: {
|
|
111
|
+
'@signageos/front-applet'?: string | undefined;
|
|
112
|
+
} | undefined;
|
|
97
113
|
uid?: string | undefined;
|
|
98
114
|
dangerLevel?: string | undefined;
|
|
99
115
|
}>;
|
|
@@ -101,7 +117,7 @@ export declare function getConfig(workDir: string): Promise<{
|
|
|
101
117
|
* Add data to the config file .sosconfig.json
|
|
102
118
|
*/
|
|
103
119
|
export declare function addToConfigFile(workDir: string, data: Partial<CustomScriptConfig>): Promise<void>;
|
|
104
|
-
export declare function ensureCustomScriptVersion(restApi: RestApi, config: CustomScriptConfig, skipConfirmation?: boolean): Promise<import("@signageos/sdk/dist/RestApi/CustomScript/Version/CustomScriptVersion").CustomScriptVersion>;
|
|
120
|
+
export declare function ensureCustomScriptVersion(restApi: RestApi, config: CustomScriptConfig, skipConfirmation?: boolean): Promise<ICustomScriptVersion | import("@signageos/sdk/dist/RestApi/CustomScript/Version/CustomScriptVersion").CustomScriptVersion>;
|
|
105
121
|
export declare function uploadCode({ restApi, workDir, platform, config, customScriptVersion, }: {
|
|
106
122
|
restApi: RestApi;
|
|
107
123
|
workDir: string;
|
|
@@ -60,7 +60,6 @@ const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
|
60
60
|
const archive_1 = require("../Lib/archive");
|
|
61
61
|
const fileSystem_1 = require("../Lib/fileSystem");
|
|
62
62
|
const runtimeFileSystem_1 = require("@signageos/sdk/dist/Development/runtimeFileSystem");
|
|
63
|
-
const CONFIG_FILE_NAME = '.sosconfig.json';
|
|
64
63
|
const CUSTOM_SCRIPTS_BUILDS_DIRNAME = 'custom_scripts_builds';
|
|
65
64
|
exports.PlatformSchema = z.strictObject({
|
|
66
65
|
/** List of files/directories that are part of the custom script for a particular platform. */
|
|
@@ -76,6 +75,11 @@ const ConfigSchema = z.object({
|
|
|
76
75
|
version: z.string(),
|
|
77
76
|
description: z.string().optional(),
|
|
78
77
|
dangerLevel: z.string().optional(),
|
|
78
|
+
sos: z
|
|
79
|
+
.object({
|
|
80
|
+
'@signageos/front-applet': z.string().optional(),
|
|
81
|
+
})
|
|
82
|
+
.optional(),
|
|
79
83
|
/**
|
|
80
84
|
* Config of individual custom script implementations for each target platform.
|
|
81
85
|
*
|
|
@@ -109,17 +113,23 @@ function loadConfigFromFile(workDir) {
|
|
|
109
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
114
|
const filePath = getConfigFilePath(workDir);
|
|
111
115
|
if (!(yield fs.pathExists(filePath))) {
|
|
112
|
-
throw new Error(`Config file ${
|
|
116
|
+
throw new Error(`Config file ${fileSystem_1.SOS_CONFIG_FILE_NAME} not found`);
|
|
117
|
+
}
|
|
118
|
+
const fileContent = yield fs.readFile(filePath, 'utf-8');
|
|
119
|
+
try {
|
|
120
|
+
return JSON.parse(fileContent);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new Error(`Invalid JSON in ${fileSystem_1.SOS_CONFIG_FILE_NAME}: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
124
|
}
|
|
114
|
-
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
115
|
-
return JSON.parse(fileContent);
|
|
116
125
|
});
|
|
117
126
|
}
|
|
118
127
|
function getConfigFilePath(workDir) {
|
|
119
|
-
return path.join(workDir,
|
|
128
|
+
return path.join(workDir, fileSystem_1.SOS_CONFIG_FILE_NAME);
|
|
120
129
|
}
|
|
121
130
|
function ensureCustomScriptVersion(restApi, config, skipConfirmation) {
|
|
122
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
var _a;
|
|
123
133
|
const customScript = yield ensureCustomScript(restApi, config, skipConfirmation);
|
|
124
134
|
const customScriptVersion = yield restApi.customScript.version.get({
|
|
125
135
|
customScriptUid: customScript.uid,
|
|
@@ -146,6 +156,7 @@ function ensureCustomScriptVersion(restApi, config, skipConfirmation) {
|
|
|
146
156
|
customScriptUid: customScript.uid,
|
|
147
157
|
version: config.version,
|
|
148
158
|
configDefinition: config.configDefinition,
|
|
159
|
+
jsApiVersion: (_a = config.sos) === null || _a === void 0 ? void 0 : _a['@signageos/front-applet'],
|
|
149
160
|
});
|
|
150
161
|
});
|
|
151
162
|
}
|
|
@@ -18,6 +18,7 @@ const prompts_1 = __importDefault(require("prompts"));
|
|
|
18
18
|
const runControlHelper_1 = require("../RunControl/runControlHelper");
|
|
19
19
|
const RestApi_1 = __importDefault(require("@signageos/sdk/dist/RestApi/RestApi"));
|
|
20
20
|
const AuthenticationError_1 = __importDefault(require("@signageos/sdk/dist/RestApi/Error/AuthenticationError"));
|
|
21
|
+
const NotFoundError_1 = __importDefault(require("@signageos/sdk/dist/RestApi/Error/NotFoundError"));
|
|
21
22
|
const apiVersions_1 = require("@signageos/sdk/dist/RestApi/apiVersions");
|
|
22
23
|
const helper_1 = require("../helper");
|
|
23
24
|
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
@@ -46,6 +47,9 @@ function getListOfEmulators(restApi, organizationUid) {
|
|
|
46
47
|
if (e instanceof AuthenticationError_1.default) {
|
|
47
48
|
throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
|
|
48
49
|
}
|
|
50
|
+
else if (e instanceof NotFoundError_1.default) {
|
|
51
|
+
throw new Error(`Organization with UID ${chalk_1.default.red(organizationUid)} was not found.`);
|
|
52
|
+
}
|
|
49
53
|
else {
|
|
50
54
|
throw new Error('Unknown error: ' + e.message);
|
|
51
55
|
}
|
package/dist/Lib/fileSystem.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const SOS_CONFIG_FILE_NAME = ".sosconfig.json";
|
|
1
2
|
export declare function getFileType(filePath: string): Promise<string>;
|
|
2
3
|
export declare function validateAllFormalities(appletPath: string, entryFileAbsolutePath: string, appletFilePaths: string[]): Promise<void>;
|
|
3
4
|
/**
|
|
@@ -6,4 +7,8 @@ export declare function validateAllFormalities(appletPath: string, entryFileAbso
|
|
|
6
7
|
* This function will ignore differences in slashes. It will only check if the file is included no matter what slashes are used.
|
|
7
8
|
*/
|
|
8
9
|
export declare function isPathIncluded(filePaths: string[], filePath: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Writes the latest @signageos/front-applet version into the .sosconfig.json of the generated project.
|
|
12
|
+
*/
|
|
13
|
+
export declare function addFrontAppletVersionToConfigFile(targetDir: string, frontAppletVersion: string): Promise<void>;
|
|
9
14
|
export declare function getFileMD5Checksum(filePath: string): Promise<string>;
|
package/dist/Lib/fileSystem.js
CHANGED
|
@@ -45,9 +45,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.SOS_CONFIG_FILE_NAME = void 0;
|
|
48
49
|
exports.getFileType = getFileType;
|
|
49
50
|
exports.validateAllFormalities = validateAllFormalities;
|
|
50
51
|
exports.isPathIncluded = isPathIncluded;
|
|
52
|
+
exports.addFrontAppletVersionToConfigFile = addFrontAppletVersionToConfigFile;
|
|
51
53
|
exports.getFileMD5Checksum = getFileMD5Checksum;
|
|
52
54
|
const path = __importStar(require("path"));
|
|
53
55
|
const file_1 = __importDefault(require("@signageos/file"));
|
|
@@ -56,6 +58,7 @@ const fs = __importStar(require("fs-extra"));
|
|
|
56
58
|
const debug_1 = __importDefault(require("debug"));
|
|
57
59
|
const packageConfig_1 = require("@signageos/sdk/dist/FileSystem/packageConfig");
|
|
58
60
|
const Debug = (0, debug_1.default)('@signageos/cli:FileSystem:helper');
|
|
61
|
+
exports.SOS_CONFIG_FILE_NAME = '.sosconfig.json';
|
|
59
62
|
const DEFAULT_FILE_TYPE = 'application/octet-stream';
|
|
60
63
|
function getFileType(filePath) {
|
|
61
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -93,6 +96,26 @@ function isPathIncluded(filePaths, filePath) {
|
|
|
93
96
|
const sanitizedFilePaths = filePaths.map((filePathItem) => filePathItem.replace(/\\/g, '/'));
|
|
94
97
|
return sanitizedFilePaths.includes(sanitizedFilePath);
|
|
95
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Writes the latest @signageos/front-applet version into the .sosconfig.json of the generated project.
|
|
101
|
+
*/
|
|
102
|
+
function addFrontAppletVersionToConfigFile(targetDir, frontAppletVersion) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
const configPath = path.join(targetDir, exports.SOS_CONFIG_FILE_NAME);
|
|
105
|
+
if (!(yield fs.pathExists(configPath))) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const rawContent = yield fs.readFile(configPath, 'utf-8');
|
|
109
|
+
try {
|
|
110
|
+
const content = JSON.parse(rawContent);
|
|
111
|
+
content.sos = Object.assign(Object.assign({}, content.sos), { '@signageos/front-applet': frontAppletVersion });
|
|
112
|
+
yield fs.writeFile(configPath, JSON.stringify(content, undefined, '\t') + '\n');
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
throw new Error(`Invalid JSON in ${exports.SOS_CONFIG_FILE_NAME}: ${error instanceof Error ? error.message : String(error)}`);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
96
119
|
function getFileMD5Checksum(filePath) {
|
|
97
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
121
|
const hash = (0, crypto_1.createHash)('md5');
|
|
@@ -19,7 +19,9 @@ 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 fileSystem_1 = require("../../Lib/fileSystem");
|
|
22
23
|
const pluginGenerateOptions_1 = require("./pluginGenerateOptions");
|
|
24
|
+
const packageVersion_1 = require("../../Cli/packageVersion");
|
|
23
25
|
/**
|
|
24
26
|
* Generates a local repository for developing a Plugin with boilerplate code and configuration files.
|
|
25
27
|
* Sets up complete development environment with necessary dependencies and project structure.
|
|
@@ -52,6 +54,10 @@ exports.pluginGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
52
54
|
const { targetDir, name, description } = yield (0, pluginGenerateFacade_1.askForParameters)(options, skipConfirmation);
|
|
53
55
|
yield (0, pluginGenerateFacade_1.downloadBoilerplateCode)(targetDir);
|
|
54
56
|
yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description });
|
|
57
|
+
const frontAppletVersion = yield (0, packageVersion_1.getLatestVersion)('@signageos/front-applet');
|
|
58
|
+
if (frontAppletVersion) {
|
|
59
|
+
yield (0, fileSystem_1.addFrontAppletVersionToConfigFile)(targetDir, frontAppletVersion);
|
|
60
|
+
}
|
|
55
61
|
(0, log_1.log)('info', `Plugin ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
|
|
56
62
|
(0, log_1.log)('info', 'Next steps:');
|
|
57
63
|
(0, log_1.log)('info', ` - Open the folder ${chalk_1.default.green(targetDir)} and read the ${chalk_1.default.green('README.md')} file.`);
|
|
@@ -17,7 +17,6 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
17
17
|
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
18
18
|
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
19
19
|
const organizationFacade_1 = require("../../Organization/organizationFacade");
|
|
20
|
-
const customScriptFacade_1 = require("../../CustomScript/customScriptFacade");
|
|
21
20
|
const pluginFacade_1 = require("../pluginFacade");
|
|
22
21
|
const util_1 = require("util");
|
|
23
22
|
const helper_1 = require("../../helper");
|
|
@@ -64,7 +63,7 @@ exports.pluginUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
64
63
|
const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options, skipPrompts);
|
|
65
64
|
const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
|
|
66
65
|
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
67
|
-
const config = yield (0,
|
|
66
|
+
const config = yield (0, pluginFacade_1.getSosConfig)(currentDirectory);
|
|
68
67
|
const schema = yield (0, pluginFacade_1.loadSchemas)(currentDirectory);
|
|
69
68
|
const skipConfirmation = !!options.yes;
|
|
70
69
|
const pluginVersion = yield (0, pluginFacade_1.ensurePluginVersion)(restApi, config, schema, skipConfirmation);
|
|
@@ -16,6 +16,13 @@ export declare const ConfigSchema: z.ZodObject<{
|
|
|
16
16
|
name: z.ZodString;
|
|
17
17
|
version: z.ZodString;
|
|
18
18
|
description: z.ZodOptional<z.ZodString>;
|
|
19
|
+
sos: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
'@signageos/front-applet': z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
'@signageos/front-applet'?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
'@signageos/front-applet'?: string | undefined;
|
|
25
|
+
}>>;
|
|
19
26
|
/**
|
|
20
27
|
* Config of individual plugin script implementations for each target platform.
|
|
21
28
|
*
|
|
@@ -46,6 +53,9 @@ export declare const ConfigSchema: z.ZodObject<{
|
|
|
46
53
|
}>;
|
|
47
54
|
configDefinition: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
48
55
|
description?: string | undefined;
|
|
56
|
+
sos?: {
|
|
57
|
+
'@signageos/front-applet'?: string | undefined;
|
|
58
|
+
} | undefined;
|
|
49
59
|
uid?: string | undefined;
|
|
50
60
|
}, {
|
|
51
61
|
version: string;
|
|
@@ -57,6 +67,10 @@ export declare const ConfigSchema: z.ZodObject<{
|
|
|
57
67
|
}>;
|
|
58
68
|
configDefinition: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
|
|
59
69
|
description?: string | undefined;
|
|
70
|
+
sos?: {
|
|
71
|
+
'@signageos/front-applet'?: string | undefined;
|
|
72
|
+
} | undefined;
|
|
60
73
|
uid?: string | undefined;
|
|
61
74
|
}>;
|
|
62
75
|
export type PluginConfig = z.infer<typeof ConfigSchema>;
|
|
76
|
+
export declare function getSosConfig(workDir: string): Promise<PluginConfig>;
|
|
@@ -49,20 +49,22 @@ exports.ConfigSchema = void 0;
|
|
|
49
49
|
exports.ensurePluginVersion = ensurePluginVersion;
|
|
50
50
|
exports.uploadCode = uploadCode;
|
|
51
51
|
exports.loadSchemas = loadSchemas;
|
|
52
|
+
exports.getSosConfig = getSosConfig;
|
|
52
53
|
const path = __importStar(require("path"));
|
|
53
54
|
const os = __importStar(require("os"));
|
|
54
55
|
const fs = __importStar(require("fs-extra"));
|
|
55
56
|
const zod_1 = __importDefault(require("zod"));
|
|
57
|
+
const fileSystem_1 = require("../Lib/fileSystem");
|
|
56
58
|
const prompts_1 = __importDefault(require("prompts"));
|
|
57
59
|
const chalk_1 = __importDefault(require("chalk"));
|
|
58
60
|
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
59
61
|
const archive_1 = require("../Lib/archive");
|
|
60
|
-
const fileSystem_1 = require("../Lib/fileSystem");
|
|
61
62
|
const runtimeFileSystem_1 = require("@signageos/sdk/dist/Development/runtimeFileSystem");
|
|
62
63
|
const customScriptFacade_1 = require("../CustomScript/customScriptFacade");
|
|
63
64
|
const PLUGIN_BUILDS_DIRNAME = 'plugin_builds';
|
|
64
65
|
function ensurePluginVersion(restApi, config, schema, skipConfirmation) {
|
|
65
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
var _a;
|
|
66
68
|
const plugin = yield ensurePlugin(restApi, config, skipConfirmation);
|
|
67
69
|
const pluginVersion = yield restApi.plugin.version.get({
|
|
68
70
|
pluginUid: plugin.uid,
|
|
@@ -91,6 +93,7 @@ function ensurePluginVersion(restApi, config, schema, skipConfirmation) {
|
|
|
91
93
|
description: config.description,
|
|
92
94
|
schema: schema.schema,
|
|
93
95
|
configDefinition: config.configDefinition,
|
|
96
|
+
jsApiVersion: (_a = config.sos) === null || _a === void 0 ? void 0 : _a['@signageos/front-applet'],
|
|
94
97
|
});
|
|
95
98
|
});
|
|
96
99
|
}
|
|
@@ -238,7 +241,7 @@ function loadSchemas(workDir) {
|
|
|
238
241
|
if (!(yield fs.pathExists(filePath))) {
|
|
239
242
|
throw new Error(`Config file schema.json not found`);
|
|
240
243
|
}
|
|
241
|
-
const fileContent = fs.
|
|
244
|
+
const fileContent = yield fs.readFile(filePath, 'utf-8');
|
|
242
245
|
return JSON.parse(fileContent);
|
|
243
246
|
});
|
|
244
247
|
}
|
|
@@ -250,6 +253,11 @@ exports.ConfigSchema = zod_1.default.object({
|
|
|
250
253
|
name: zod_1.default.string(),
|
|
251
254
|
version: zod_1.default.string(),
|
|
252
255
|
description: zod_1.default.string().optional(),
|
|
256
|
+
sos: zod_1.default
|
|
257
|
+
.object({
|
|
258
|
+
'@signageos/front-applet': zod_1.default.string().optional(),
|
|
259
|
+
})
|
|
260
|
+
.optional(),
|
|
253
261
|
/**
|
|
254
262
|
* Config of individual plugin script implementations for each target platform.
|
|
255
263
|
*
|
|
@@ -259,3 +267,18 @@ exports.ConfigSchema = zod_1.default.object({
|
|
|
259
267
|
platforms: zod_1.default.record(zod_1.default.string(), customScriptFacade_1.PlatformSchema),
|
|
260
268
|
configDefinition: zod_1.default.array(zod_1.default.object({}).passthrough()), // outsource validation to API because it's a bit complex
|
|
261
269
|
});
|
|
270
|
+
function getSosConfig(workDir) {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
const filePath = path.join(workDir, fileSystem_1.SOS_CONFIG_FILE_NAME);
|
|
273
|
+
if (!(yield fs.pathExists(filePath))) {
|
|
274
|
+
throw new Error(`Config file ${fileSystem_1.SOS_CONFIG_FILE_NAME} not found`);
|
|
275
|
+
}
|
|
276
|
+
const fileContent = yield fs.readFile(filePath, 'utf-8');
|
|
277
|
+
try {
|
|
278
|
+
return exports.ConfigSchema.parse(JSON.parse(fileContent));
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
throw new Error(`Invalid JSON in ${fileSystem_1.SOS_CONFIG_FILE_NAME}: ${error instanceof Error ? error.message : String(error)}`);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
@@ -19,7 +19,9 @@ 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 fileSystem_1 = require("../../Lib/fileSystem");
|
|
22
23
|
const runnerGenerateOptions_1 = require("./runnerGenerateOptions");
|
|
24
|
+
const packageVersion_1 = require("../../Cli/packageVersion");
|
|
23
25
|
/**
|
|
24
26
|
* Generates a local repository for developing a Runner with boilerplate code and configuration files.
|
|
25
27
|
* Sets up complete development environment with necessary dependencies and project structure.
|
|
@@ -52,6 +54,10 @@ exports.runnerGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
52
54
|
const { targetDir, name, description } = yield (0, runnerGenerateFacade_1.askForParameters)(options, skipConfirmation);
|
|
53
55
|
yield (0, runnerGenerateFacade_1.downloadBoilerplateCode)(targetDir);
|
|
54
56
|
yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description });
|
|
57
|
+
const frontAppletVersion = yield (0, packageVersion_1.getLatestVersion)('@signageos/front-applet');
|
|
58
|
+
if (frontAppletVersion) {
|
|
59
|
+
yield (0, fileSystem_1.addFrontAppletVersionToConfigFile)(targetDir, frontAppletVersion);
|
|
60
|
+
}
|
|
55
61
|
(0, log_1.log)('info', `Runner ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
|
|
56
62
|
(0, log_1.log)('info', 'Next steps:');
|
|
57
63
|
(0, log_1.log)('info', ` - Open the folder ${chalk_1.default.green(targetDir)} and read the ${chalk_1.default.green('README.md')} file.`);
|
|
@@ -20,8 +20,8 @@ const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
|
20
20
|
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
21
21
|
const helper_1 = require("../../helper");
|
|
22
22
|
const organizationFacade_1 = require("../../Organization/organizationFacade");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
const runnerFacade_1 = require("../runnerFacade");
|
|
24
|
+
const pluginFacade_1 = require("../../Plugin/pluginFacade");
|
|
25
25
|
const Debug = (0, debug_1.default)('@signageos/cli:Runner:Upload:Command');
|
|
26
26
|
exports.OPTION_LIST = [
|
|
27
27
|
organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
|
|
@@ -64,17 +64,17 @@ exports.runnerUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
64
64
|
const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options, skipPrompts);
|
|
65
65
|
const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
|
|
66
66
|
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
67
|
-
const config = yield (0,
|
|
68
|
-
const schema = yield (0,
|
|
67
|
+
const config = yield (0, pluginFacade_1.getSosConfig)(currentDirectory);
|
|
68
|
+
const schema = yield (0, runnerFacade_1.loadSchemas)(currentDirectory);
|
|
69
69
|
const skipConfirmation = !!options.yes;
|
|
70
|
-
const runnerVersion = yield (0,
|
|
70
|
+
const runnerVersion = yield (0, runnerFacade_1.ensureRunnerVersion)(restApi, config, schema, skipConfirmation);
|
|
71
71
|
for (const platform of Object.keys(config.platforms)) {
|
|
72
72
|
const platformConfig = config.platforms[platform];
|
|
73
73
|
if (!platformConfig) {
|
|
74
74
|
console.warn(`Skipping platform ${platform} due to missing configuration`);
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
|
-
yield (0,
|
|
77
|
+
yield (0, runnerFacade_1.uploadCode)({
|
|
78
78
|
restApi,
|
|
79
79
|
workDir: currentDirectory,
|
|
80
80
|
platform,
|
|
@@ -61,6 +61,7 @@ const customScriptFacade_1 = require("../CustomScript/customScriptFacade");
|
|
|
61
61
|
const PLUGIN_BUILDS_DIRNAME = 'plugin_builds';
|
|
62
62
|
function ensureRunnerVersion(restApi, config, schema, skipConfirmation) {
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
var _a;
|
|
64
65
|
const runner = yield ensureRunner(restApi, config, skipConfirmation);
|
|
65
66
|
const runnerVersion = yield restApi.runner.version.get({ runnerUid: runner.uid, version: config.version });
|
|
66
67
|
if (runnerVersion) {
|
|
@@ -88,6 +89,7 @@ function ensureRunnerVersion(restApi, config, schema, skipConfirmation) {
|
|
|
88
89
|
output: schema.output,
|
|
89
90
|
telemetry: schema.telemetry,
|
|
90
91
|
configDefinition: config.configDefinition,
|
|
92
|
+
jsApiVersion: (_a = config.sos) === null || _a === void 0 ? void 0 : _a['@signageos/front-applet'],
|
|
91
93
|
});
|
|
92
94
|
});
|
|
93
95
|
}
|
|
@@ -235,7 +237,7 @@ function loadSchemas(workDir) {
|
|
|
235
237
|
if (!(yield fs.pathExists(filePath))) {
|
|
236
238
|
throw new Error(`Config file schema.json not found`);
|
|
237
239
|
}
|
|
238
|
-
const fileContent = fs.
|
|
240
|
+
const fileContent = yield fs.readFile(filePath, 'utf-8');
|
|
239
241
|
return JSON.parse(fileContent);
|
|
240
242
|
});
|
|
241
243
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signageos/cli",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"author": "signageOS.io <dev@signageos.io>",
|
|
6
6
|
"files": [
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@signageos/file": "2.0.1",
|
|
89
|
-
"@signageos/sdk": "2.
|
|
89
|
+
"@signageos/sdk": "2.5.0",
|
|
90
90
|
"archiver": "7.0.1",
|
|
91
91
|
"chalk": "2.4.2",
|
|
92
92
|
"child-process-promise": "2.1.3",
|
|
File without changes
|