@sasjs/cli 3.23.1 → 3.23.3

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.
@@ -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("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."));
100
+ (_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("The project was successfully compiled for ".concat(target.serverType, " using target '").concat(target.name, "'\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) {
@@ -172,7 +172,7 @@ describe('CompileBuildCommand', function () {
172
172
  case 1:
173
173
  returnCode = _a.sent();
174
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.");
175
+ expectedLoggedMessage = "The project was successfully compiled for ".concat(target.serverType, " using target '").concat(target.name, "'\nThe compile output is located in the ").concat(buildDestinationFolder, " directory.");
176
176
  expect(returnCode).toEqual(command_1.ReturnCode.Success);
177
177
  expect(process.logger.success).toHaveBeenNthCalledWith(1, expectedLoggedMessage);
178
178
  return [2 /*return*/];
@@ -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("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."));
170
+ (_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("The project was successfully compiled for ".concat(target.serverType, " using target '").concat(target.name, "'\nThe compile output is located in the ").concat(buildDestinationFolder, " directory."));
171
171
  return command_1.ReturnCode.Success;
172
172
  })
173
173
  .catch(function (err) {
@@ -187,7 +187,7 @@ describe('CompileCommand', function () {
187
187
  case 1:
188
188
  returnCode = _a.sent();
189
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.");
190
+ expectedLoggedMessage = "The project was successfully compiled for ".concat(target.serverType, " using target '").concat(target.name, "'\nThe compile output is located in the ").concat(buildDestinationFolder, " directory.");
191
191
  expect(returnCode).toEqual(command_1.ReturnCode.Success);
192
192
  expect(process.logger.success).toHaveBeenNthCalledWith(1, expectedLoggedMessage);
193
193
  return [2 /*return*/];
@@ -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("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
+ (_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("The project was successfully compiled for ".concat(target.serverType, " using target '").concat(target.name, "'\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) {
@@ -178,7 +178,7 @@ describe('CompileBuildDeployCommand', function () {
178
178
  case 1:
179
179
  returnCode = _a.sent();
180
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.");
181
+ expectedLoggedMessage = "The project was successfully compiled for ".concat(target.serverType, " using target '").concat(target.name, "'\nThe compile output is located in the ").concat(buildDestinationFolder, " directory.");
182
182
  expect(returnCode).toEqual(command_1.ReturnCode.Success);
183
183
  expect(process.logger.success).toHaveBeenNthCalledWith(1, expectedLoggedMessage);
184
184
  return [2 /*return*/];
@@ -1165,6 +1165,7 @@ function getSASjs(target) {
1165
1165
  serverUrl: target.serverUrl,
1166
1166
  appLoc: target.appLoc,
1167
1167
  serverType: target.serverType,
1168
+ contextName: target.contextName,
1168
1169
  httpsAgentOptions: target.httpsAgentOptions,
1169
1170
  debug: true,
1170
1171
  useComputeApi: target.serverType === utils_1.ServerType.SasViya
@@ -184,7 +184,7 @@ function createTemplateApp(folderPath, template) {
184
184
  return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
185
185
  var _a, stdout, stderr, code;
186
186
  return __generator(this, function (_b) {
187
- _a = downloadFile("https://username:password@github.com/sasjs/template_".concat(template)), stdout = _a.stdout, stderr = _a.stderr, code = _a.code;
187
+ _a = downloadFile("https://username:password@github.com/sasjs/template_".concat(template), 'response.txt'), stdout = _a.stdout, stderr = _a.stderr, code = _a.code;
188
188
  if (stderr.includes('404: Not Found') || code) {
189
189
  return [2 /*return*/, reject(new Error("Template \"".concat(template, "\" is not a SASjs template")))];
190
190
  }
@@ -216,12 +216,12 @@ function createApp(folderPath, repoUrl, docsUrl, errorCallback, installDependenc
216
216
  var spinner = (0, ora_1.default)("Creating SASjs project in ".concat(folderPath, "."));
217
217
  spinner.start();
218
218
  //Get repo zip, assuming main branch is called `main`
219
- var _a = downloadFile("".concat(repoUrl).concat(fullZipPath)), stdout = _a.stdout, stderr = _a.stderr, code = _a.code;
219
+ var _a = downloadFile("".concat(repoUrl).concat(fullZipPath), zipName), stdout = _a.stdout, stderr = _a.stderr, code = _a.code;
220
220
  // If doesn't exist, we try again, but with master.zip for the zip name.
221
221
  // Since that's the name generated from branch name.
222
222
  if (stderr.includes('404: Not Found') || code) {
223
223
  zipName = 'master.zip';
224
- var _b = downloadFile("".concat(repoUrl).concat(zipPath).concat(zipName)), stdout_1 = _b.stdout, stderr_1 = _b.stderr, code_1 = _b.code;
224
+ var _b = downloadFile("".concat(repoUrl).concat(zipPath).concat(zipName), zipName), stdout_1 = _b.stdout, stderr_1 = _b.stderr, code_1 = _b.code;
225
225
  if (stderr_1.includes('404: Not Found') || code_1) {
226
226
  errorCallback("".concat(repoUrl).concat(zipPath, " is not SASjs repository!"));
227
227
  return;
@@ -262,7 +262,7 @@ var loadDocsSubmodule = function (docsUrl, folderPath, zipPath) { return __await
262
262
  case 1:
263
263
  if (!(_a.sent()))
264
264
  docsFolderPath = "".concat(folderPath, "/docs"); // If not, we load submodule in root
265
- downloadFile("".concat(docsUrl).concat(zipPath));
265
+ downloadFile("".concat(docsUrl).concat(zipPath), 'main.zip');
266
266
  zip = new adm_zip_1.default('main.zip');
267
267
  zip.extractAllTo('./', true);
268
268
  shelljs_1.default.cp('-r', "./*-main/.", docsFolderPath);
@@ -272,10 +272,14 @@ var loadDocsSubmodule = function (docsUrl, folderPath, zipPath) { return __await
272
272
  }
273
273
  });
274
274
  }); };
275
- function downloadFile(url) {
275
+ function downloadFile(url, filename) {
276
276
  if ((0, utils_1.isLinux)()) {
277
277
  return shelljs_1.default.exec("wget ".concat(url), { silent: true });
278
278
  }
279
+ else if ((0, utils_1.isWindows)()) {
280
+ // First We set TLS12 & then we invoke request to download file.
281
+ return shelljs_1.default.exec("powershell.exe \"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest ".concat(url, " ").concat(filename ? '-O ' + filename : '', "\""), { silent: true });
282
+ }
279
283
  else {
280
284
  return shelljs_1.default.exec("curl ".concat(url, " -LO -f"), { silent: true });
281
285
  }
package/package.json CHANGED
@@ -101,5 +101,5 @@
101
101
  "typescript": "4.5.4",
102
102
  "util": "0.12.4"
103
103
  },
104
- "version": "3.23.1"
104
+ "version": "3.23.3"
105
105
  }