@signageos/cli 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/Applet/Build/appletBuildCommand.js +28 -72
- package/dist/Applet/Generate/Templates/rspack.config.mjs.template +12 -12
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +23 -62
- package/dist/Applet/Generate/appletGenerateCommand.js +398 -365
- package/dist/Applet/Start/appletStartCommand.js +69 -131
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +89 -177
- package/dist/Applet/Test/Upload/appletTestRunFacade.js +4 -27
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +98 -223
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js +39 -102
- package/dist/Applet/Test/appletTestCommand.js +6 -36
- package/dist/Applet/Upload/appletUploadCommand.js +199 -305
- package/dist/Applet/Upload/appletUploadCommandHelper.js +103 -138
- package/dist/Applet/Upload/appletUploadFacade.d.ts +2 -2
- package/dist/Applet/Upload/appletUploadFacade.js +172 -263
- package/dist/Applet/Upload/appletUploadFacadeHelper.js +39 -52
- package/dist/Applet/appletCommand.d.ts +22 -62
- package/dist/Applet/appletCommand.js +9 -39
- package/dist/Applet/appletErrors.js +5 -24
- package/dist/Applet/appletFacade.js +106 -141
- package/dist/Applet/appletServerHelper.js +16 -53
- package/dist/Auth/loginCommand.js +96 -137
- package/dist/Cache/tmpCache.js +35 -13
- package/dist/Cli/helper.js +1 -2
- package/dist/Cli/packageVersion.js +82 -123
- package/dist/Command/commandDefinition.js +0 -1
- package/dist/Command/commandProcessor.js +40 -129
- package/dist/Command/globalArgs.js +7 -5
- package/dist/CommandLine/IProgressBar.js +0 -1
- package/dist/CommandLine/progressBarFactory.js +31 -11
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -56
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +82 -106
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +44 -120
- package/dist/CustomScript/customScriptCommand.js +6 -36
- package/dist/CustomScript/customScriptFacade.js +175 -294
- package/dist/Device/Connect/connectCommand.js +72 -136
- package/dist/Device/Content/setContentCommand.js +33 -78
- package/dist/Device/PowerAction/powerActionCommand.js +22 -65
- package/dist/Device/deviceCommand.js +7 -37
- package/dist/Device/deviceFacade.js +67 -123
- package/dist/Emulator/IEmulator.js +0 -1
- package/dist/Emulator/createDomain.js +33 -12
- package/dist/Emulator/emulatorFacade.js +74 -131
- package/dist/Emulator/emulatorFactory.js +112 -124
- package/dist/Firmware/Upload/firmwareUploadCommand.js +133 -221
- package/dist/Firmware/Upload/firmwareUploadFacade.js +64 -110
- package/dist/Firmware/Upload/firmwareUploadHelper.js +27 -5
- package/dist/Firmware/firmwareCommand.js +5 -35
- package/dist/Lib/archive.js +45 -60
- package/dist/Lib/childProcess.js +27 -5
- package/dist/Lib/fileSystem.js +62 -82
- package/dist/Lib/git.d.ts +1 -1
- package/dist/Lib/git.js +44 -82
- package/dist/Organization/Get/organizationGetCommand.js +14 -50
- package/dist/Organization/List/organizationListCommand.js +12 -46
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +18 -56
- package/dist/Organization/organizationCommand.js +7 -37
- package/dist/Organization/organizationFacade.js +97 -172
- package/dist/RunControl/runControlHelper.js +11 -60
- package/dist/Timer/wait.js +1 -2
- package/dist/Timing/List/timingListCommand.js +20 -62
- package/dist/Timing/timingCommand.js +5 -35
- package/dist/generalCommand.js +1 -2
- package/dist/helper.js +48 -109
- package/dist/index.js +15 -45
- package/dist/parameters.js +17 -40
- package/package.json +16 -18
- package/dist/Applet/Build/appletBuildCommand.js.map +0 -1
- package/dist/Applet/Generate/appletGenerateCommand.js.map +0 -1
- package/dist/Applet/Start/appletStartCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestRunFacade.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js.map +0 -1
- package/dist/Applet/Test/appletTestCommand.js.map +0 -1
- package/dist/Applet/Upload/appletUploadCommand.js.map +0 -1
- package/dist/Applet/Upload/appletUploadCommandHelper.js.map +0 -1
- package/dist/Applet/Upload/appletUploadFacade.js.map +0 -1
- package/dist/Applet/Upload/appletUploadFacadeHelper.js.map +0 -1
- package/dist/Applet/appletCommand.js.map +0 -1
- package/dist/Applet/appletErrors.js.map +0 -1
- package/dist/Applet/appletFacade.js.map +0 -1
- package/dist/Applet/appletServerHelper.js.map +0 -1
- package/dist/Auth/loginCommand.js.map +0 -1
- package/dist/Cache/tmpCache.js.map +0 -1
- package/dist/Cli/helper.js.map +0 -1
- package/dist/Cli/packageVersion.js.map +0 -1
- package/dist/Command/commandDefinition.js.map +0 -1
- package/dist/Command/commandProcessor.js.map +0 -1
- package/dist/Command/globalArgs.js.map +0 -1
- package/dist/CommandLine/IProgressBar.js.map +0 -1
- package/dist/CommandLine/progressBarFactory.js.map +0 -1
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js.map +0 -1
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js.map +0 -1
- package/dist/CustomScript/Upload/customScriptUploadCommand.js.map +0 -1
- package/dist/CustomScript/customScriptCommand.js.map +0 -1
- package/dist/CustomScript/customScriptFacade.js.map +0 -1
- package/dist/Device/Connect/connectCommand.js.map +0 -1
- package/dist/Device/Content/setContentCommand.js.map +0 -1
- package/dist/Device/PowerAction/powerActionCommand.js.map +0 -1
- package/dist/Device/deviceCommand.js.map +0 -1
- package/dist/Device/deviceFacade.js.map +0 -1
- package/dist/Emulator/IEmulator.js.map +0 -1
- package/dist/Emulator/createDomain.js.map +0 -1
- package/dist/Emulator/emulatorFacade.js.map +0 -1
- package/dist/Emulator/emulatorFactory.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadCommand.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadFacade.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadHelper.js.map +0 -1
- package/dist/Firmware/firmwareCommand.js.map +0 -1
- package/dist/Lib/archive.js.map +0 -1
- package/dist/Lib/childProcess.js.map +0 -1
- package/dist/Lib/fileSystem.js.map +0 -1
- package/dist/Lib/git.js.map +0 -1
- package/dist/Organization/Get/organizationGetCommand.js.map +0 -1
- package/dist/Organization/List/organizationListCommand.js.map +0 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js.map +0 -1
- package/dist/Organization/organizationCommand.js.map +0 -1
- package/dist/Organization/organizationFacade.js.map +0 -1
- package/dist/RunControl/runControlHelper.js.map +0 -1
- package/dist/Timer/wait.js.map +0 -1
- package/dist/Timing/List/timingListCommand.js.map +0 -1
- package/dist/Timing/timingCommand.js.map +0 -1
- package/dist/generalCommand.js.map +0 -1
- package/dist/helper.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/parameters.js.map +0 -1
|
@@ -8,94 +8,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
-
if (ar || !(i in from)) {
|
|
68
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
-
ar[i] = from[i];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
73
13
|
};
|
|
74
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
15
|
exports.appletTestUpload = void 0;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
18
|
+
const helper_1 = require("../../../helper");
|
|
19
|
+
const organizationFacade_1 = require("../../../Organization/organizationFacade");
|
|
20
|
+
const appletTestUploadFacade_1 = require("./appletTestUploadFacade");
|
|
21
|
+
const appletFacade_1 = require("../../appletFacade");
|
|
22
|
+
const progressBarFactory_1 = require("../../../CommandLine/progressBarFactory");
|
|
23
|
+
const packageConfig_1 = require("@signageos/sdk/dist/FileSystem/packageConfig");
|
|
24
|
+
const commandDefinition_1 = require("../../../Command/commandDefinition");
|
|
25
|
+
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
26
|
+
const OPTION_LIST = [
|
|
87
27
|
organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
|
|
88
28
|
organizationFacade_1.ORGANIZATION_UID_OPTION,
|
|
89
29
|
appletFacade_1.APPLET_UID_OPTION,
|
|
90
30
|
{
|
|
91
31
|
name: 'yes',
|
|
92
32
|
type: Boolean,
|
|
93
|
-
description:
|
|
33
|
+
description: `Allow to upload new applet test or override existing test without confirmation step`,
|
|
94
34
|
},
|
|
95
35
|
{
|
|
96
36
|
name: 'verbose',
|
|
97
37
|
type: Boolean,
|
|
98
|
-
description:
|
|
38
|
+
description: `outputs all files to upload`,
|
|
99
39
|
},
|
|
100
40
|
];
|
|
101
41
|
exports.appletTestUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
@@ -103,169 +43,104 @@ exports.appletTestUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
103
43
|
description: 'Uploads applet test',
|
|
104
44
|
optionList: OPTION_LIST,
|
|
105
45
|
commands: [],
|
|
106
|
-
run
|
|
46
|
+
run(options) {
|
|
107
47
|
var _a;
|
|
108
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return [4 /*yield*/, (0, appletTestUploadFacade_1.validateTestFiles)(currentDirectory, testFiles)];
|
|
147
|
-
case 9:
|
|
148
|
-
_c.sent();
|
|
149
|
-
if (isVerbose) {
|
|
150
|
-
printMatchedFiles(testFiles);
|
|
151
|
-
}
|
|
152
|
-
return [4 /*yield*/, restApi.applet.tests.list(applet.uid, appletVersion.version)];
|
|
153
|
-
case 10:
|
|
154
|
-
testSuites = _c.sent();
|
|
155
|
-
testSuitesMap = {};
|
|
156
|
-
try {
|
|
157
|
-
for (testSuites_1 = __values(testSuites), testSuites_1_1 = testSuites_1.next(); !testSuites_1_1.done; testSuites_1_1 = testSuites_1.next()) {
|
|
158
|
-
testSuite = testSuites_1_1.value;
|
|
159
|
-
testSuitesMap[testSuite.identifier] = testSuite;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
163
|
-
finally {
|
|
164
|
-
try {
|
|
165
|
-
if (testSuites_1_1 && !testSuites_1_1.done && (_b = testSuites_1.return)) _b.call(testSuites_1);
|
|
166
|
-
}
|
|
167
|
-
finally { if (e_1) throw e_1.error; }
|
|
168
|
-
}
|
|
169
|
-
return [4 /*yield*/, (0, appletTestUploadFacade_1.loadTestFilesContents)(currentDirectory, testFiles)];
|
|
170
|
-
case 11:
|
|
171
|
-
testFilesContents = _c.sent();
|
|
172
|
-
identifiersToCreate = testFiles.filter(function (testFile) { return testSuitesMap[testFile] === undefined; });
|
|
173
|
-
identifiersToUpdate = testFiles.filter(function (testFile) { var _a; return !identifiersToCreate.includes(testFile) && ((_a = testSuitesMap[testFile]) === null || _a === void 0 ? void 0 : _a.binary) !== testFilesContents[testFile]; });
|
|
174
|
-
identifiersToDelete = Object.keys(testSuitesMap).filter(function (identifier) { return !testFiles.includes(identifier); });
|
|
175
|
-
printChangesFiles({ identifiersToCreate: identifiersToCreate, identifiersToUpdate: identifiersToUpdate, identifiersToDelete: identifiersToDelete });
|
|
176
|
-
if (!!skipConfirmation) return [3 /*break*/, 13];
|
|
177
|
-
return [4 /*yield*/, prompts({
|
|
178
|
-
type: 'confirm',
|
|
179
|
-
name: 'continue',
|
|
180
|
-
message: "Do you want to do applet version test changes for applet ".concat(chalk_1.default.green(applet.name), " ") + "and version ".concat(chalk_1.default.green(version), "?"),
|
|
181
|
-
})];
|
|
182
|
-
case 12:
|
|
183
|
-
response = _c.sent();
|
|
184
|
-
if (!response.continue) {
|
|
185
|
-
throw new Error("Uploading applet tests canceled");
|
|
186
|
-
}
|
|
187
|
-
_c.label = 13;
|
|
188
|
-
case 13:
|
|
189
|
-
progressBar = (0, progressBarFactory_1.createProgressBar)();
|
|
190
|
-
_c.label = 14;
|
|
191
|
-
case 14:
|
|
192
|
-
_c.trys.push([14, , 16, 17]);
|
|
193
|
-
progressBar.init({
|
|
194
|
-
size: identifiersToCreate.length + identifiersToUpdate.length + identifiersToDelete.length,
|
|
195
|
-
name: "Uploading applet test files",
|
|
196
|
-
});
|
|
197
|
-
return [4 /*yield*/, Promise.all(__spreadArray(__spreadArray(__spreadArray([], __read(identifiersToCreate.map(function (identifier) { return __awaiter(_this, void 0, void 0, function () {
|
|
198
|
-
return __generator(this, function (_a) {
|
|
199
|
-
switch (_a.label) {
|
|
200
|
-
case 0: return [4 /*yield*/, restApi.applet.tests.create(applet.uid, appletVersion.version, {
|
|
201
|
-
identifier: identifier,
|
|
202
|
-
binary: testFilesContents[identifier],
|
|
203
|
-
})];
|
|
204
|
-
case 1:
|
|
205
|
-
_a.sent();
|
|
206
|
-
progressBar.update({ add: 1 });
|
|
207
|
-
return [2 /*return*/];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}); })), false), __read(identifiersToUpdate.map(function (identifier) { return __awaiter(_this, void 0, void 0, function () {
|
|
211
|
-
return __generator(this, function (_a) {
|
|
212
|
-
switch (_a.label) {
|
|
213
|
-
case 0: return [4 /*yield*/, restApi.applet.tests.update(applet.uid, appletVersion.version, identifier, {
|
|
214
|
-
binary: testFilesContents[identifier],
|
|
215
|
-
})];
|
|
216
|
-
case 1:
|
|
217
|
-
_a.sent();
|
|
218
|
-
progressBar.update({ add: 1 });
|
|
219
|
-
return [2 /*return*/];
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}); })), false), __read(identifiersToDelete.map(function (identifier) { return __awaiter(_this, void 0, void 0, function () {
|
|
223
|
-
return __generator(this, function (_a) {
|
|
224
|
-
switch (_a.label) {
|
|
225
|
-
case 0: return [4 /*yield*/, restApi.applet.tests.delete(applet.uid, appletVersion.version, identifier)];
|
|
226
|
-
case 1:
|
|
227
|
-
_a.sent();
|
|
228
|
-
progressBar.update({ add: 1 });
|
|
229
|
-
return [2 /*return*/];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}); })), false))];
|
|
233
|
-
case 15:
|
|
234
|
-
_c.sent();
|
|
235
|
-
displaySuccessMessage(applet.name, appletVersion.version);
|
|
236
|
-
return [3 /*break*/, 17];
|
|
237
|
-
case 16:
|
|
238
|
-
progressBar.end();
|
|
239
|
-
return [7 /*endfinally*/];
|
|
240
|
-
case 17: return [2 /*return*/];
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const isVerbose = !!options.verbose;
|
|
50
|
+
const skipConfirmation = !!options.yes;
|
|
51
|
+
const currentDirectory = process.cwd();
|
|
52
|
+
const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
|
|
53
|
+
const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
|
|
54
|
+
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
55
|
+
const version = yield (0, appletFacade_1.getAppletVersion)(currentDirectory);
|
|
56
|
+
const appletUid = yield (0, appletFacade_1.getAppletUid)(restApi, options);
|
|
57
|
+
const applet = yield restApi.applet.get(appletUid);
|
|
58
|
+
const appletVersion = yield restApi.applet.version.get(appletUid, version);
|
|
59
|
+
const packageConfig = yield (0, packageConfig_1.loadPackage)(currentDirectory);
|
|
60
|
+
if (!((_a = packageConfig === null || packageConfig === void 0 ? void 0 : packageConfig.sos) === null || _a === void 0 ? void 0 : _a.tests)) {
|
|
61
|
+
throw new Error(`No key "sos.tests" found in package.json file. You have to specify all testing files there first.`);
|
|
62
|
+
}
|
|
63
|
+
const testFiles = packageConfig === null || packageConfig === void 0 ? void 0 : packageConfig.sos.tests;
|
|
64
|
+
yield (0, appletTestUploadFacade_1.validateTestFiles)(currentDirectory, testFiles);
|
|
65
|
+
if (isVerbose) {
|
|
66
|
+
printMatchedFiles(testFiles);
|
|
67
|
+
}
|
|
68
|
+
const testSuites = yield restApi.applet.tests.list(applet.uid, appletVersion.version);
|
|
69
|
+
const testSuitesMap = {};
|
|
70
|
+
for (const testSuite of testSuites) {
|
|
71
|
+
testSuitesMap[testSuite.identifier] = testSuite;
|
|
72
|
+
}
|
|
73
|
+
const testFilesContents = yield (0, appletTestUploadFacade_1.loadTestFilesContents)(currentDirectory, testFiles);
|
|
74
|
+
const identifiersToCreate = testFiles.filter((testFile) => testSuitesMap[testFile] === undefined);
|
|
75
|
+
const identifiersToUpdate = testFiles.filter((testFile) => { var _a; return !identifiersToCreate.includes(testFile) && ((_a = testSuitesMap[testFile]) === null || _a === void 0 ? void 0 : _a.binary) !== testFilesContents[testFile]; });
|
|
76
|
+
const identifiersToDelete = Object.keys(testSuitesMap).filter((identifier) => !testFiles.includes(identifier));
|
|
77
|
+
printChangesFiles({ identifiersToCreate, identifiersToUpdate, identifiersToDelete });
|
|
78
|
+
if (!skipConfirmation) {
|
|
79
|
+
const response = yield (0, prompts_1.default)({
|
|
80
|
+
type: 'confirm',
|
|
81
|
+
name: 'continue',
|
|
82
|
+
message: `Do you want to do applet version test changes for applet ${chalk_1.default.green(applet.name)} ` + `and version ${chalk_1.default.green(version)}?`,
|
|
83
|
+
});
|
|
84
|
+
if (!response.continue) {
|
|
85
|
+
throw new Error(`Uploading applet tests canceled`);
|
|
241
86
|
}
|
|
242
|
-
}
|
|
87
|
+
}
|
|
88
|
+
const progressBar = (0, progressBarFactory_1.createProgressBar)();
|
|
89
|
+
try {
|
|
90
|
+
progressBar.init({
|
|
91
|
+
size: identifiersToCreate.length + identifiersToUpdate.length + identifiersToDelete.length,
|
|
92
|
+
name: `Uploading applet test files`,
|
|
93
|
+
});
|
|
94
|
+
yield Promise.all([
|
|
95
|
+
...identifiersToCreate.map((identifier) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
var _b;
|
|
97
|
+
yield restApi.applet.tests.create(applet.uid, appletVersion.version, {
|
|
98
|
+
identifier,
|
|
99
|
+
binary: (_b = testFilesContents[identifier]) !== null && _b !== void 0 ? _b : '',
|
|
100
|
+
});
|
|
101
|
+
progressBar.update({ add: 1 });
|
|
102
|
+
})),
|
|
103
|
+
...identifiersToUpdate.map((identifier) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
var _c;
|
|
105
|
+
yield restApi.applet.tests.update(applet.uid, appletVersion.version, identifier, {
|
|
106
|
+
binary: (_c = testFilesContents[identifier]) !== null && _c !== void 0 ? _c : '',
|
|
107
|
+
});
|
|
108
|
+
progressBar.update({ add: 1 });
|
|
109
|
+
})),
|
|
110
|
+
...identifiersToDelete.map((identifier) => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
yield restApi.applet.tests.delete(applet.uid, appletVersion.version, identifier);
|
|
112
|
+
progressBar.update({ add: 1 });
|
|
113
|
+
})),
|
|
114
|
+
]);
|
|
115
|
+
displaySuccessMessage(applet.name, appletVersion.version);
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
progressBar.end();
|
|
119
|
+
}
|
|
243
120
|
});
|
|
244
121
|
},
|
|
245
122
|
});
|
|
246
123
|
function displaySuccessMessage(appletName, appletVersion) {
|
|
247
|
-
(0, log_1.log)('info',
|
|
248
|
-
(0, log_1.log)('info',
|
|
124
|
+
(0, log_1.log)('info', `Applet ${chalk_1.default.green(appletName)} version ${chalk_1.default.green(appletVersion)} tests has been uploaded.`);
|
|
125
|
+
(0, log_1.log)('info', `To run the tests, use command ${chalk_1.default.blue(`sos applet test run`)}`);
|
|
249
126
|
}
|
|
250
127
|
function printMatchedFiles(testFiles) {
|
|
251
128
|
if (testFiles.length > 0) {
|
|
252
|
-
(0, log_1.log)('info', chalk_1.default.yellow(
|
|
129
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Next files are going to be checked for upload...`));
|
|
253
130
|
}
|
|
254
|
-
testFiles.forEach(
|
|
131
|
+
testFiles.forEach((file) => (0, log_1.log)('info', file));
|
|
255
132
|
}
|
|
256
|
-
function printChangesFiles(
|
|
257
|
-
var identifiersToCreate = _a.identifiersToCreate, identifiersToUpdate = _a.identifiersToUpdate, identifiersToDelete = _a.identifiersToDelete;
|
|
133
|
+
function printChangesFiles({ identifiersToCreate, identifiersToUpdate, identifiersToDelete }) {
|
|
258
134
|
if (identifiersToCreate.length > 0) {
|
|
259
|
-
(0, log_1.log)('info', chalk_1.default.yellow(
|
|
260
|
-
identifiersToCreate.forEach(
|
|
135
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Next files is being created...`));
|
|
136
|
+
identifiersToCreate.forEach((file) => (0, log_1.log)('info', file));
|
|
261
137
|
}
|
|
262
138
|
if (identifiersToUpdate.length > 0) {
|
|
263
|
-
(0, log_1.log)('info', chalk_1.default.yellow(
|
|
264
|
-
identifiersToUpdate.forEach(
|
|
139
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Next files is being updated...`));
|
|
140
|
+
identifiersToUpdate.forEach((file) => (0, log_1.log)('info', file));
|
|
265
141
|
}
|
|
266
142
|
if (identifiersToDelete.length > 0) {
|
|
267
|
-
(0, log_1.log)('info', chalk_1.default.yellow(
|
|
268
|
-
identifiersToDelete.forEach(
|
|
143
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Next files is being deleted...`));
|
|
144
|
+
identifiersToDelete.forEach((file) => (0, log_1.log)('info', file));
|
|
269
145
|
}
|
|
270
146
|
}
|
|
271
|
-
//# sourceMappingURL=appletTestUploadCommand.js.map
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,116 +31,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
35
|
exports.loadTestFilesContents = exports.validateTestFiles = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
const fs = __importStar(require("fs-extra"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
53
38
|
function validateTestFiles(currentDirectory, testFiles) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
case 0:
|
|
60
|
-
_b.trys.push([0, 5, 6, 7]);
|
|
61
|
-
testFiles_1 = __values(testFiles), testFiles_1_1 = testFiles_1.next();
|
|
62
|
-
_b.label = 1;
|
|
63
|
-
case 1:
|
|
64
|
-
if (!!testFiles_1_1.done) return [3 /*break*/, 4];
|
|
65
|
-
testFile = testFiles_1_1.value;
|
|
66
|
-
testFilePath = path.join(currentDirectory, testFile);
|
|
67
|
-
return [4 /*yield*/, fs.pathExists(testFilePath)];
|
|
68
|
-
case 2:
|
|
69
|
-
if (!(_b.sent())) {
|
|
70
|
-
throw new Error("Test file ".concat(testFilePath, " specified in package.json sos.tests doesn't exist"));
|
|
71
|
-
}
|
|
72
|
-
_b.label = 3;
|
|
73
|
-
case 3:
|
|
74
|
-
testFiles_1_1 = testFiles_1.next();
|
|
75
|
-
return [3 /*break*/, 1];
|
|
76
|
-
case 4: return [3 /*break*/, 7];
|
|
77
|
-
case 5:
|
|
78
|
-
e_1_1 = _b.sent();
|
|
79
|
-
e_1 = { error: e_1_1 };
|
|
80
|
-
return [3 /*break*/, 7];
|
|
81
|
-
case 6:
|
|
82
|
-
try {
|
|
83
|
-
if (testFiles_1_1 && !testFiles_1_1.done && (_a = testFiles_1.return)) _a.call(testFiles_1);
|
|
84
|
-
}
|
|
85
|
-
finally { if (e_1) throw e_1.error; }
|
|
86
|
-
return [7 /*endfinally*/];
|
|
87
|
-
case 7: return [2 /*return*/];
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
for (const testFile of testFiles) {
|
|
41
|
+
const testFilePath = path.join(currentDirectory, testFile);
|
|
42
|
+
if (!(yield fs.pathExists(testFilePath))) {
|
|
43
|
+
throw new Error(`Test file ${testFilePath} specified in package.json sos.tests doesn't exist`);
|
|
88
44
|
}
|
|
89
|
-
}
|
|
45
|
+
}
|
|
90
46
|
});
|
|
91
47
|
}
|
|
92
48
|
exports.validateTestFiles = validateTestFiles;
|
|
93
49
|
function loadTestFilesContents(currentDirectory, testFiles) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var testFilePath, buffer;
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
testFilePath = path.join(currentDirectory, testFile);
|
|
107
|
-
return [4 /*yield*/, fs.readFile(testFilePath)];
|
|
108
|
-
case 1:
|
|
109
|
-
buffer = _a.sent();
|
|
110
|
-
contentsMap[testFile] = buffer.toString();
|
|
111
|
-
return [2 /*return*/];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}); }))];
|
|
115
|
-
case 1:
|
|
116
|
-
_a.sent();
|
|
117
|
-
return [2 /*return*/, contentsMap];
|
|
118
|
-
}
|
|
119
|
-
});
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const contentsMap = {};
|
|
52
|
+
yield Promise.all(testFiles.map((testFile) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const testFilePath = path.join(currentDirectory, testFile);
|
|
54
|
+
const buffer = yield fs.readFile(testFilePath);
|
|
55
|
+
contentsMap[testFile] = buffer.toString();
|
|
56
|
+
})));
|
|
57
|
+
return contentsMap;
|
|
120
58
|
});
|
|
121
59
|
}
|
|
122
60
|
exports.loadTestFilesContents = loadTestFilesContents;
|
|
123
|
-
//# sourceMappingURL=appletTestUploadFacade.js.map
|
|
@@ -8,49 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.appletTest = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
14
|
+
const appletTestRunCommand_1 = require("./Upload/appletTestRunCommand");
|
|
15
|
+
const appletTestUploadCommand_1 = require("./Upload/appletTestUploadCommand");
|
|
43
16
|
exports.appletTest = (0, commandDefinition_1.createCommandDefinition)({
|
|
44
17
|
name: 'test',
|
|
45
18
|
description: 'Applet test management',
|
|
46
19
|
optionList: [],
|
|
47
20
|
commands: [appletTestUploadCommand_1.appletTestUpload, appletTestRunCommand_1.appletTestRun],
|
|
48
|
-
run
|
|
49
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
|
|
51
|
-
throw new Error('Unknown command');
|
|
52
|
-
});
|
|
21
|
+
run() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
throw new Error('Unknown command');
|
|
53
24
|
});
|
|
54
25
|
},
|
|
55
26
|
});
|
|
56
|
-
//# sourceMappingURL=appletTestCommand.js.map
|