@sasjs/cli 3.21.6 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/build/compileBuildCommand.js +1 -1
- package/build/commands/build/spec/compileBuildCommand.spec.js +4 -2
- package/build/commands/compile/compileCommand.js +1 -1
- package/build/commands/compile/spec/compileCommand.spec.js +4 -2
- package/build/commands/deploy/compileBuildDeployCommand.js +1 -1
- package/build/commands/deploy/internal/deployToSASJSWithServicePack.js +30 -14
- package/build/commands/deploy/spec/cbd.spec.js +6 -0
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +4 -2
- package/package.json +2 -2
|
@@ -97,7 +97,7 @@ var CompileBuildCommand = /** @class */ (function (_super) {
|
|
|
97
97
|
return [2 /*return*/, returnCode];
|
|
98
98
|
}
|
|
99
99
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
100
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("
|
|
100
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("The project was successfully compiled using the '".concat(target.name, "' target (serverType '").concat(target.serverType, "')!\nThe compile output is located in the ").concat(buildDestinationFolder, " directory."));
|
|
101
101
|
return [4 /*yield*/, (0, build_1.build)(target)
|
|
102
102
|
.then(function () { return command_1.ReturnCode.Success; })
|
|
103
103
|
.catch(function (err) {
|
|
@@ -162,7 +162,7 @@ describe('CompileBuildCommand', function () {
|
|
|
162
162
|
});
|
|
163
163
|
}); });
|
|
164
164
|
it('should log success and return the success code when execution is successful', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
165
|
-
var args, command, returnCode;
|
|
165
|
+
var args, command, returnCode, buildDestinationFolder, expectedLoggedMessage;
|
|
166
166
|
return __generator(this, function (_a) {
|
|
167
167
|
switch (_a.label) {
|
|
168
168
|
case 0:
|
|
@@ -171,8 +171,10 @@ describe('CompileBuildCommand', function () {
|
|
|
171
171
|
return [4 /*yield*/, command.execute()];
|
|
172
172
|
case 1:
|
|
173
173
|
returnCode = _a.sent();
|
|
174
|
+
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
175
|
+
expectedLoggedMessage = "The project was successfully compiled using the '".concat(target.name, "' target (serverType '").concat(target.serverType, "')!\nThe compile output is located in the ").concat(buildDestinationFolder, " directory.");
|
|
174
176
|
expect(returnCode).toEqual(command_1.ReturnCode.Success);
|
|
175
|
-
expect(process.logger.success).
|
|
177
|
+
expect(process.logger.success).toHaveBeenNthCalledWith(1, expectedLoggedMessage);
|
|
176
178
|
return [2 /*return*/];
|
|
177
179
|
}
|
|
178
180
|
});
|
|
@@ -167,7 +167,7 @@ var CompileCommand = /** @class */ (function (_super) {
|
|
|
167
167
|
return [4 /*yield*/, (0, compile_1.compile)(target, true)
|
|
168
168
|
.then(function () {
|
|
169
169
|
var _a;
|
|
170
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("
|
|
170
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("The project was successfully compiled using the '".concat(target.name, "' target (serverType '").concat(target.serverType, "')!\nThe compile output is located in the ").concat(buildDestinationFolder, " directory."));
|
|
171
171
|
return command_1.ReturnCode.Success;
|
|
172
172
|
})
|
|
173
173
|
.catch(function (err) {
|
|
@@ -177,7 +177,7 @@ describe('CompileCommand', function () {
|
|
|
177
177
|
});
|
|
178
178
|
}); });
|
|
179
179
|
it('should log success and return the success code when execution is successful', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
-
var args, command, returnCode;
|
|
180
|
+
var args, command, returnCode, buildDestinationFolder, expectedLoggedMessage;
|
|
181
181
|
return __generator(this, function (_a) {
|
|
182
182
|
switch (_a.label) {
|
|
183
183
|
case 0:
|
|
@@ -186,8 +186,10 @@ describe('CompileCommand', function () {
|
|
|
186
186
|
return [4 /*yield*/, command.execute()];
|
|
187
187
|
case 1:
|
|
188
188
|
returnCode = _a.sent();
|
|
189
|
+
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
190
|
+
expectedLoggedMessage = "The project was successfully compiled using the '".concat(target.name, "' target (serverType '").concat(target.serverType, "')!\nThe compile output is located in the ").concat(buildDestinationFolder, " directory.");
|
|
189
191
|
expect(returnCode).toEqual(command_1.ReturnCode.Success);
|
|
190
|
-
expect(process.logger.success).
|
|
192
|
+
expect(process.logger.success).toHaveBeenNthCalledWith(1, expectedLoggedMessage);
|
|
191
193
|
return [2 /*return*/];
|
|
192
194
|
}
|
|
193
195
|
});
|
|
@@ -98,7 +98,7 @@ var CompileBuildDeployCommand = /** @class */ (function (_super) {
|
|
|
98
98
|
return [2 /*return*/, returnCode];
|
|
99
99
|
}
|
|
100
100
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
101
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("
|
|
101
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("The project was successfully compiled using the '".concat(target.name, "' target (serverType '").concat(target.serverType, "')!\nThe compile output is located in the ").concat(buildDestinationFolder, " directory."));
|
|
102
102
|
return [4 /*yield*/, (0, build_1.build)(target)
|
|
103
103
|
.then(function () { return command_1.ReturnCode.Success; })
|
|
104
104
|
.catch(function (err) {
|
|
@@ -49,34 +49,50 @@ var utils_2 = require("@sasjs/utils");
|
|
|
49
49
|
function deployToSasjsWithServicePack(jsonFilePath, target, streamConfig) {
|
|
50
50
|
var _a, _b, _c;
|
|
51
51
|
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
-
var
|
|
52
|
+
var sasjsApiClient, authConfig, _d, result, zipFilePath, jsonContent, payload, webAppStreamUrl;
|
|
53
53
|
return __generator(this, function (_e) {
|
|
54
54
|
switch (_e.label) {
|
|
55
|
-
case 0:
|
|
56
|
-
|
|
57
|
-
jsonContent = _e.sent();
|
|
58
|
-
payload = JSON.parse(jsonContent);
|
|
55
|
+
case 0:
|
|
56
|
+
sasjsApiClient = new node_1.SASjsApiClient(new node_1.SasjsRequestClient(target.serverUrl, target.httpsAgentOptions));
|
|
59
57
|
return [4 /*yield*/, (0, utils_1.isSasJsServerInServerMode)(target)];
|
|
60
|
-
case
|
|
61
|
-
if (!(_e.sent())) return [3 /*break*/,
|
|
58
|
+
case 1:
|
|
59
|
+
if (!(_e.sent())) return [3 /*break*/, 3];
|
|
62
60
|
return [4 /*yield*/, (0, config_1.getAuthConfig)(target)];
|
|
63
|
-
case
|
|
61
|
+
case 2:
|
|
64
62
|
_d = _e.sent();
|
|
65
|
-
return [3 /*break*/,
|
|
66
|
-
case
|
|
63
|
+
return [3 /*break*/, 4];
|
|
64
|
+
case 3:
|
|
67
65
|
_d = undefined;
|
|
68
|
-
_e.label =
|
|
69
|
-
case
|
|
66
|
+
_e.label = 4;
|
|
67
|
+
case 4:
|
|
70
68
|
authConfig = _d;
|
|
71
|
-
|
|
69
|
+
zipFilePath = jsonFilePath + '.zip';
|
|
70
|
+
return [4 /*yield*/, (0, utils_2.fileExists)(zipFilePath)];
|
|
71
|
+
case 5:
|
|
72
|
+
if (!_e.sent()) return [3 /*break*/, 7];
|
|
72
73
|
return [4 /*yield*/, sasjsApiClient
|
|
73
|
-
.
|
|
74
|
+
.deployZipFile(zipFilePath, authConfig)
|
|
74
75
|
.catch(function (err) {
|
|
75
76
|
var _a;
|
|
76
77
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('deployToSASjs Error', err);
|
|
77
78
|
})];
|
|
78
79
|
case 6:
|
|
79
80
|
result = _e.sent();
|
|
81
|
+
return [3 /*break*/, 10];
|
|
82
|
+
case 7: return [4 /*yield*/, (0, utils_2.readFile)(jsonFilePath)];
|
|
83
|
+
case 8:
|
|
84
|
+
jsonContent = _e.sent();
|
|
85
|
+
payload = JSON.parse(jsonContent);
|
|
86
|
+
return [4 /*yield*/, sasjsApiClient
|
|
87
|
+
.deploy(payload, target.appLoc, authConfig)
|
|
88
|
+
.catch(function (err) {
|
|
89
|
+
var _a;
|
|
90
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('deployToSASjs Error', err);
|
|
91
|
+
})];
|
|
92
|
+
case 9:
|
|
93
|
+
result = _e.sent();
|
|
94
|
+
_e.label = 10;
|
|
95
|
+
case 10:
|
|
80
96
|
if ((result === null || result === void 0 ? void 0 : result.status) === 'failure') {
|
|
81
97
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(result.message);
|
|
82
98
|
if (result.example) {
|
|
@@ -62,6 +62,7 @@ var path_1 = __importDefault(require("path"));
|
|
|
62
62
|
var node_1 = require("@sasjs/adapter/node");
|
|
63
63
|
var js_base64_1 = require("js-base64");
|
|
64
64
|
var utils_1 = require("@sasjs/utils");
|
|
65
|
+
var fileModule = __importStar(require("@sasjs/utils/file"));
|
|
65
66
|
var test_1 = require("../../../utils/test");
|
|
66
67
|
var utilsModule = __importStar(require("../../../utils/utils"));
|
|
67
68
|
var types_1 = require("../../../types");
|
|
@@ -103,6 +104,11 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
103
104
|
return __generator(this, function (_b) {
|
|
104
105
|
switch (_b.label) {
|
|
105
106
|
case 0:
|
|
107
|
+
jest.spyOn(fileModule, 'fileExists').mockImplementation(function (filePath) {
|
|
108
|
+
if (filePath.endsWith('.zip'))
|
|
109
|
+
return Promise.resolve(false);
|
|
110
|
+
return Promise.resolve(true);
|
|
111
|
+
});
|
|
106
112
|
deployMock = jest
|
|
107
113
|
.spyOn(node_1.SASjsApiClient.prototype, 'deploy')
|
|
108
114
|
.mockImplementation(function () {
|
|
@@ -168,7 +168,7 @@ describe('CompileBuildDeployCommand', function () {
|
|
|
168
168
|
});
|
|
169
169
|
}); });
|
|
170
170
|
it('should log success and return the success code when execution is successful', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
-
var args, command, returnCode;
|
|
171
|
+
var args, command, returnCode, buildDestinationFolder, expectedLoggedMessage;
|
|
172
172
|
return __generator(this, function (_a) {
|
|
173
173
|
switch (_a.label) {
|
|
174
174
|
case 0:
|
|
@@ -177,8 +177,10 @@ describe('CompileBuildDeployCommand', function () {
|
|
|
177
177
|
return [4 /*yield*/, command.execute()];
|
|
178
178
|
case 1:
|
|
179
179
|
returnCode = _a.sent();
|
|
180
|
+
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
181
|
+
expectedLoggedMessage = "The project was successfully compiled using the '".concat(target.name, "' target (serverType '").concat(target.serverType, "')!\nThe compile output is located in the ").concat(buildDestinationFolder, " directory.");
|
|
180
182
|
expect(returnCode).toEqual(command_1.ReturnCode.Success);
|
|
181
|
-
expect(process.logger.success).
|
|
183
|
+
expect(process.logger.success).toHaveBeenNthCalledWith(1, expectedLoggedMessage);
|
|
182
184
|
return [2 /*return*/];
|
|
183
185
|
}
|
|
184
186
|
});
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@sasjs/adapter": "4.0
|
|
53
|
+
"@sasjs/adapter": "4.1.0",
|
|
54
54
|
"@sasjs/core": "4.45.2",
|
|
55
55
|
"@sasjs/lint": "1.15.0",
|
|
56
56
|
"@sasjs/utils": "2.51.1",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"typescript": "4.5.4",
|
|
102
102
|
"util": "0.12.4"
|
|
103
103
|
},
|
|
104
|
-
"version": "3.
|
|
104
|
+
"version": "3.23.0"
|
|
105
105
|
}
|