@sasjs/cli 3.6.2 → 3.6.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.
- package/build/cli.js +4 -4
- package/build/cli.spec.js +6 -6
- package/build/commands/add/addCommand.js +2 -2
- package/build/commands/add/addCredential.js +27 -27
- package/build/commands/add/addTarget.js +10 -10
- package/build/commands/add/internal/input.js +30 -30
- package/build/commands/add/internal/saveConfig.js +2 -2
- package/build/commands/add/spec/addCommand.spec.js +24 -20
- package/build/commands/add/spec/addCredential.spec.js +14 -14
- package/build/commands/add/spec/addTarget.spec.js +22 -22
- package/build/commands/build/build.js +81 -77
- package/build/commands/build/buildCommand.js +3 -3
- package/build/commands/build/compileBuildCommand.js +4 -4
- package/build/commands/build/internal/config.js +8 -8
- package/build/commands/build/internal/getLaunchPageCode.js +2 -2
- package/build/commands/build/spec/build.spec.js +10 -10
- package/build/commands/build/spec/buildCommand.spec.js +16 -12
- package/build/commands/build/spec/cb.spec.server.js +18 -18
- package/build/commands/build/spec/compileBuildCommand.spec.js +17 -13
- package/build/commands/compile/compile.js +61 -61
- package/build/commands/compile/compileCommand.js +10 -10
- package/build/commands/compile/compileSingleFile.js +17 -17
- package/build/commands/compile/internal/checkCompileStatus.js +11 -11
- package/build/commands/compile/internal/compareFolders.js +11 -11
- package/build/commands/compile/internal/compileJobFile.js +3 -3
- package/build/commands/compile/internal/compileServiceFile.js +14 -14
- package/build/commands/compile/internal/compileTestFile.js +41 -37
- package/build/commands/compile/internal/getAllJobFolders.js +13 -9
- package/build/commands/compile/internal/getAllServiceFolders.js +13 -9
- package/build/commands/compile/internal/getServerType.js +1 -1
- package/build/commands/compile/internal/identifySasFile.js +2 -2
- package/build/commands/compile/internal/loadDependencies.js +5 -5
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +40 -40
- package/build/commands/compile/spec/compareFolders.spec.js +27 -27
- package/build/commands/compile/spec/compile.spec.js +93 -93
- package/build/commands/compile/spec/compileCommand.spec.js +37 -33
- package/build/commands/compile/spec/compileJobFile.spec.js +11 -11
- package/build/commands/compile/spec/compileServiceFile.spec.js +11 -11
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
- package/build/commands/compile/spec/loadDependencies.spec.js +30 -30
- package/build/commands/context/contextCommand.js +16 -16
- package/build/commands/context/create.js +1 -1
- package/build/commands/context/delete.js +2 -2
- package/build/commands/context/edit.js +1 -1
- package/build/commands/context/export.js +5 -5
- package/build/commands/context/internal/validateConfigPath.js +1 -1
- package/build/commands/context/list.js +4 -4
- package/build/commands/context/spec/contextCommand.spec.js +80 -76
- package/build/commands/context/spec/create.spec.js +3 -3
- package/build/commands/context/spec/delete.spec.js +3 -3
- package/build/commands/context/spec/edit.spec.js +3 -3
- package/build/commands/context/spec/export.spec.js +8 -8
- package/build/commands/context/spec/list.spec.js +5 -5
- package/build/commands/create/create.js +12 -12
- package/build/commands/create/createCommand.js +2 -2
- package/build/commands/create/internal/createReadme.js +2 -2
- package/build/commands/create/spec/create.spec.js +39 -39
- package/build/commands/create/spec/createCommand.spec.js +14 -10
- package/build/commands/db/db.js +22 -22
- package/build/commands/db/dbCommand.js +1 -1
- package/build/commands/db/spec/db.spec.js +8 -8
- package/build/commands/db/spec/dbCommand.spec.js +11 -7
- package/build/commands/deploy/compileBuildDeployCommand.js +6 -6
- package/build/commands/deploy/deploy.js +39 -39
- package/build/commands/deploy/deployCommand.js +2 -2
- package/build/commands/deploy/internal/getDeployScripts.js +14 -10
- package/build/commands/deploy/spec/cbd.spec.js +14 -14
- package/build/commands/deploy/spec/cbd.spec.server.js +40 -40
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +18 -14
- package/build/commands/deploy/spec/deployCommand.spec.js +15 -11
- package/build/commands/deploy/spec/getDeployScripts.spec.js +8 -8
- package/build/commands/deploy/spec/utils.js +17 -17
- package/build/commands/docs/docsCommand.js +7 -7
- package/build/commands/docs/generateDocs.js +33 -29
- package/build/commands/docs/generateDot.js +12 -8
- package/build/commands/docs/initDocs.js +1 -1
- package/build/commands/docs/internal/createDotFiles.js +6 -6
- package/build/commands/docs/internal/getDotFileContent.js +17 -17
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +4 -4
- package/build/commands/docs/internal/populateNodeDictionary.js +1 -1
- package/build/commands/docs/spec/docsCommand.spec.js +25 -21
- package/build/commands/docs/spec/generateDocs.spec.js +60 -60
- package/build/commands/docs/spec/generateDot.spec.js +23 -23
- package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
- package/build/commands/docs/spec/initDocs.spec.js +7 -7
- package/build/commands/flow/execute.js +8 -8
- package/build/commands/flow/flowCommand.js +5 -5
- package/build/commands/flow/internal/checkPredecessorDeadlock.js +11 -7
- package/build/commands/flow/internal/executeFlow.js +23 -23
- package/build/commands/flow/internal/failAllSuccessors.js +1 -1
- package/build/commands/flow/internal/generateFileName.js +2 -2
- package/build/commands/flow/internal/normalizeFilePath.js +1 -1
- package/build/commands/flow/internal/parseJobDetails.js +3 -3
- package/build/commands/flow/internal/printError.js +1 -1
- package/build/commands/flow/internal/saveLog.js +8 -8
- package/build/commands/flow/internal/saveToCsv.js +2 -2
- package/build/commands/flow/internal/spec/allFlowsCompleted.spec.js +4 -4
- package/build/commands/flow/internal/spec/checkPredecessorDeadlock.spec.js +4 -4
- package/build/commands/flow/internal/spec/executeFlow.spec.js +10 -10
- package/build/commands/flow/internal/spec/failAllSuccessors.spec.js +1 -1
- package/build/commands/flow/internal/spec/saveToCsv.spec.js +16 -16
- package/build/commands/flow/internal/spec/validateParams.spec.js +33 -33
- package/build/commands/flow/internal/validateParams.js +17 -17
- package/build/commands/flow/spec/flow.spec.js +1 -1
- package/build/commands/flow/spec/flow.spec.server.js +60 -60
- package/build/commands/flow/spec/flowCommand.spec.js +16 -12
- package/build/commands/folder/create.js +2 -2
- package/build/commands/folder/delete.js +2 -2
- package/build/commands/folder/folderCommand.js +11 -11
- package/build/commands/folder/move.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.js +35 -35
- package/build/commands/folder/spec/folderCommand.spec.js +23 -19
- package/build/commands/help/help.js +46 -46
- package/build/commands/help/helpCommand.js +1 -1
- package/build/commands/help/spec/help.spec.js +8 -8
- package/build/commands/help/spec/helpCommand.spec.js +11 -7
- package/build/commands/init/init.js +7 -7
- package/build/commands/init/initCommand.js +1 -1
- package/build/commands/init/spec/init.spec.server.js +17 -17
- package/build/commands/init/spec/initCommand.spec.js +11 -7
- package/build/commands/job/internal/execute/sasjs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +35 -35
- package/build/commands/job/internal/utils.js +6 -6
- package/build/commands/job/jobCommand.js +6 -6
- package/build/commands/job/spec/execute.spec.js +6 -6
- package/build/commands/job/spec/getContextName.spec.js +2 -2
- package/build/commands/job/spec/job.spec.server.js +53 -53
- package/build/commands/job/spec/jobCommand.spec.js +17 -13
- package/build/commands/lint/initLint.js +2 -2
- package/build/commands/lint/lintCommand.js +10 -10
- package/build/commands/lint/processLint.js +5 -5
- package/build/commands/lint/spec/lintCommand.spec.js +19 -15
- package/build/commands/request/request.js +16 -16
- package/build/commands/request/requestCommand.js +5 -5
- package/build/commands/request/spec/request.spec.server.js +71 -71
- package/build/commands/request/spec/requestCommand.spec.js +17 -13
- package/build/commands/run/run.js +23 -23
- package/build/commands/run/runCommand.js +2 -2
- package/build/commands/run/spec/run.spec.server.js +51 -51
- package/build/commands/run/spec/runCommand.spec.js +10 -6
- package/build/commands/servicepack/deploy.js +6 -6
- package/build/commands/servicepack/servicePackCommand.js +3 -3
- package/build/commands/servicepack/spec/servicepack.spec.server.js +6 -6
- package/build/commands/servicepack/spec/servicepackCommand.spec.js +10 -6
- package/build/commands/shared/createConfigFile.js +2 -2
- package/build/commands/shared/createFileStructure.js +6 -6
- package/build/commands/shared/createLintConfigFile.js +1 -1
- package/build/commands/shared/deployToSasViyaWithServicePack.js +4 -4
- package/build/commands/shared/fetchLogFileContent.js +10 -6
- package/build/commands/testing/internal/saveOutput.js +38 -34
- package/build/commands/testing/spec/testCommand.spec.js +17 -13
- package/build/commands/testing/spec/testing.spec.server.js +38 -38
- package/build/commands/testing/test.js +45 -41
- package/build/commands/testing/testCommand.js +2 -2
- package/build/commands/version/spec/version.spec.js +1 -1
- package/build/commands/version/spec/versionCommand.spec.js +11 -7
- package/build/commands/version/version.js +3 -3
- package/build/commands/version/versionCommand.js +2 -2
- package/build/commands/web/internal/createAssetServices.js +28 -24
- package/build/commands/web/internal/getWebServiceContent.js +6 -6
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +1 -1
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +10 -10
- package/build/commands/web/internal/updateAllTags.js +19 -15
- package/build/commands/web/internal/updateLinkTag.js +2 -2
- package/build/commands/web/internal/updateScriptTag.js +6 -6
- package/build/commands/web/spec/web.spec.js +23 -23
- package/build/commands/web/spec/webCommand.spec.js +16 -12
- package/build/commands/web/web.js +25 -25
- package/build/commands/web/webCommand.js +3 -3
- package/build/types/command/commandBase.js +19 -15
- package/build/types/command/parse.js +1 -1
- package/build/types/command/spec/commandBase.spec.js +16 -12
- package/build/types/command/targetCommand.js +4 -4
- package/build/types/command/unalias.js +9 -5
- package/build/utils/auth.js +7 -7
- package/build/utils/config.js +53 -49
- package/build/utils/displayResult.js +4 -4
- package/build/utils/file.js +11 -11
- package/build/utils/fileStructures/builtFiles.js +2 -2
- package/build/utils/fileStructures/builtFilesCustom1.js +2 -2
- package/build/utils/getLogFilePath.js +1 -1
- package/build/utils/loadEnvVariables.js +3 -3
- package/build/utils/prefixAppLoc.js +1 -1
- package/build/utils/saveLog.js +7 -7
- package/build/utils/setConstants.js +4 -4
- package/build/utils/setProjectDir.js +2 -2
- package/build/utils/spec/config.spec.js +80 -80
- package/build/utils/spec/displayResult.spec.js +7 -7
- package/build/utils/spec/file.spec.js +15 -15
- package/build/utils/spec/removeComments.spec.js +11 -11
- package/build/utils/spec/setConstants.spec.js +3 -3
- package/build/utils/spec/utils.spec.js +55 -55
- package/build/utils/test.js +59 -59
- package/build/utils/utils.js +47 -43
- package/package.json +10 -10
package/build/utils/config.js
CHANGED
|
@@ -62,10 +62,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
62
62
|
}
|
|
63
63
|
return ar;
|
|
64
64
|
};
|
|
65
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
66
|
-
for (var i = 0,
|
|
67
|
-
|
|
68
|
-
|
|
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));
|
|
69
73
|
};
|
|
70
74
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
71
75
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -82,7 +86,7 @@ var utils_2 = require("./utils");
|
|
|
82
86
|
var ERROR_MESSAGE = function (targetName) {
|
|
83
87
|
if (targetName === void 0) { targetName = ''; }
|
|
84
88
|
return {
|
|
85
|
-
NOT_FOUND_TARGET_NAME: "Target `"
|
|
89
|
+
NOT_FOUND_TARGET_NAME: "Target `".concat(targetName, "` was not found.\nPlease check the target name and try again, or use `sasjs add` to add a new target.\nMore info: https://cli.sasjs.io/faq/#what-is-the-difference-between-local-and-global-targets\n"),
|
|
86
90
|
NOT_FOUND_FALLBACK: "No target was found.\nPlease check the target name and try again, or use `sasjs add` to add a new target.\nMore info: https://cli.sasjs.io/faq/#what-is-the-difference-between-local-and-global-targets\n"
|
|
87
91
|
};
|
|
88
92
|
};
|
|
@@ -96,14 +100,14 @@ function getConfiguration(pathToFile) {
|
|
|
96
100
|
var config, configJson;
|
|
97
101
|
return __generator(this, function (_a) {
|
|
98
102
|
switch (_a.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, utils_1.readFile(pathToFile).catch(function () { return null; })];
|
|
103
|
+
case 0: return [4 /*yield*/, (0, utils_1.readFile)(pathToFile).catch(function () { return null; })];
|
|
100
104
|
case 1:
|
|
101
105
|
config = _a.sent();
|
|
102
106
|
if (config) {
|
|
103
107
|
configJson = JSON.parse(config);
|
|
104
108
|
return [2 /*return*/, (configJson.config ? configJson.config : configJson)];
|
|
105
109
|
}
|
|
106
|
-
throw new Error("No configuration was found at path "
|
|
110
|
+
throw new Error("No configuration was found at path ".concat(pathToFile, " ."));
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
});
|
|
@@ -243,12 +247,12 @@ function getLocalTarget(targetName) {
|
|
|
243
247
|
if (!(localConfig === null || localConfig === void 0 ? void 0 : localConfig.targets)) return [3 /*break*/, 3];
|
|
244
248
|
targetJson = localConfig.targets.find(function (t) { return t.name === targetName; });
|
|
245
249
|
if (!targetJson) return [3 /*break*/, 3];
|
|
246
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Target "
|
|
250
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Target ".concat(targetName, " was found in your local sasjsconfig.json file."));
|
|
247
251
|
targetJson.appLoc = sanitizeAppLoc(targetJson.appLoc);
|
|
248
252
|
if (!targetJson.hasOwnProperty('serverUrl')) {
|
|
249
253
|
targetJson.serverUrl = '';
|
|
250
254
|
}
|
|
251
|
-
targetJson.serverUrl = utils_1.urlOrigin(targetJson.serverUrl);
|
|
255
|
+
targetJson.serverUrl = (0, utils_1.urlOrigin)(targetJson.serverUrl);
|
|
252
256
|
_b = targetJson;
|
|
253
257
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(localConfig, targetJson)];
|
|
254
258
|
case 2:
|
|
@@ -275,18 +279,18 @@ function getLocalFallbackTarget() {
|
|
|
275
279
|
fallBackTargetJson = (_a = localConfig === null || localConfig === void 0 ? void 0 : localConfig.targets) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.name === defaultTargetName_1; });
|
|
276
280
|
}
|
|
277
281
|
if (!fallBackTargetJson) return [3 /*break*/, 4];
|
|
278
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("No target was specified. Falling back to default target '"
|
|
282
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("No target was specified. Falling back to default target '".concat(fallBackTargetJson.name, "' from your local sasjsconfig.json file."));
|
|
279
283
|
fallBackTargetJson.appLoc = sanitizeAppLoc(fallBackTargetJson.appLoc);
|
|
280
284
|
if (!fallBackTargetJson.hasOwnProperty('serverUrl')) {
|
|
281
285
|
fallBackTargetJson.serverUrl = '';
|
|
282
286
|
}
|
|
283
|
-
fallBackTargetJson.serverUrl = utils_1.urlOrigin(fallBackTargetJson.serverUrl);
|
|
287
|
+
fallBackTargetJson.serverUrl = (0, utils_1.urlOrigin)(fallBackTargetJson.serverUrl);
|
|
284
288
|
_c = fallBackTargetJson;
|
|
285
289
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(localConfig, fallBackTargetJson)];
|
|
286
290
|
case 2:
|
|
287
291
|
_c.httpsAgentOptions =
|
|
288
292
|
_d.sent();
|
|
289
|
-
return [4 /*yield*/, utils_2.loadEnvVariables(".env."
|
|
293
|
+
return [4 /*yield*/, (0, utils_2.loadEnvVariables)(".env.".concat(fallBackTargetJson.name))];
|
|
290
294
|
case 3:
|
|
291
295
|
_d.sent();
|
|
292
296
|
return [2 /*return*/, new utils_1.Target(fallBackTargetJson)];
|
|
@@ -307,12 +311,12 @@ function getGlobalTarget(targetName) {
|
|
|
307
311
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.targets)) return [3 /*break*/, 3];
|
|
308
312
|
targetJson = globalConfig.targets.find(function (t) { return t.name === targetName; });
|
|
309
313
|
if (!targetJson) return [3 /*break*/, 3];
|
|
310
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Target "
|
|
314
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Target ".concat(targetName, " was found in your global .sasjsrc file."));
|
|
311
315
|
targetJson.appLoc = sanitizeAppLoc(targetJson.appLoc);
|
|
312
316
|
if (!targetJson.hasOwnProperty('serverUrl')) {
|
|
313
317
|
targetJson.serverUrl = '';
|
|
314
318
|
}
|
|
315
|
-
targetJson.serverUrl = utils_1.urlOrigin(targetJson.serverUrl);
|
|
319
|
+
targetJson.serverUrl = (0, utils_1.urlOrigin)(targetJson.serverUrl);
|
|
316
320
|
_b = targetJson;
|
|
317
321
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(globalConfig, targetJson)];
|
|
318
322
|
case 2:
|
|
@@ -338,12 +342,12 @@ function getGlobalFallbackTarget() {
|
|
|
338
342
|
fallBackTargetJson = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.targets) === null || _a === void 0 ? void 0 : _a.find(function (t) { return t.name === defaultTargetName; });
|
|
339
343
|
}
|
|
340
344
|
if (!fallBackTargetJson) return [3 /*break*/, 3];
|
|
341
|
-
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("No target was specified. Falling back to default target '"
|
|
345
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("No target was specified. Falling back to default target '".concat(fallBackTargetJson.name, "' from your global .sasjsrc file."));
|
|
342
346
|
fallBackTargetJson.appLoc = sanitizeAppLoc(fallBackTargetJson.appLoc);
|
|
343
347
|
if (!fallBackTargetJson.hasOwnProperty('serverUrl')) {
|
|
344
348
|
fallBackTargetJson.serverUrl = '';
|
|
345
349
|
}
|
|
346
|
-
fallBackTargetJson.serverUrl = utils_1.urlOrigin(fallBackTargetJson.serverUrl);
|
|
350
|
+
fallBackTargetJson.serverUrl = (0, utils_1.urlOrigin)(fallBackTargetJson.serverUrl);
|
|
347
351
|
_c = fallBackTargetJson;
|
|
348
352
|
return [4 /*yield*/, getPrecedenceOfHttpsAgentOptionsAndContent(globalConfig, fallBackTargetJson)];
|
|
349
353
|
case 2:
|
|
@@ -362,7 +366,7 @@ function getGlobalRcFile() {
|
|
|
362
366
|
switch (_a.label) {
|
|
363
367
|
case 0:
|
|
364
368
|
homeDir = require('os').homedir();
|
|
365
|
-
return [4 /*yield*/, utils_1.readFile(path_1.default.join(homeDir, '.sasjsrc')).catch(function () { return null; })];
|
|
369
|
+
return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(homeDir, '.sasjsrc')).catch(function () { return null; })];
|
|
366
370
|
case 1:
|
|
367
371
|
sasjsRcFileContent = _a.sent();
|
|
368
372
|
return [2 /*return*/, sasjsRcFileContent
|
|
@@ -401,7 +405,7 @@ function saveGlobalRcFile(content) {
|
|
|
401
405
|
case 0:
|
|
402
406
|
homeDir = require('os').homedir();
|
|
403
407
|
rcFilePath = path_1.default.join(homeDir, '.sasjsrc');
|
|
404
|
-
return [4 /*yield*/, utils_1.createFile(rcFilePath, content)];
|
|
408
|
+
return [4 /*yield*/, (0, utils_1.createFile)(rcFilePath, content)];
|
|
405
409
|
case 1:
|
|
406
410
|
_a.sent();
|
|
407
411
|
return [2 /*return*/, rcFilePath];
|
|
@@ -485,7 +489,7 @@ function removeFromLocalConfig(targetName) {
|
|
|
485
489
|
config.defaultTarget = '';
|
|
486
490
|
}
|
|
487
491
|
configPath = path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json');
|
|
488
|
-
return [4 /*yield*/, utils_1.createFile(configPath, JSON.stringify(__assign(__assign({}, config), { targets: targets }), null, 2))];
|
|
492
|
+
return [4 /*yield*/, (0, utils_1.createFile)(configPath, JSON.stringify(__assign(__assign({}, config), { targets: targets }), null, 2))];
|
|
489
493
|
case 2:
|
|
490
494
|
_a.sent();
|
|
491
495
|
_a.label = 3;
|
|
@@ -538,7 +542,7 @@ function saveLocalConfigFile(content) {
|
|
|
538
542
|
switch (_a.label) {
|
|
539
543
|
case 0:
|
|
540
544
|
configPath = path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json');
|
|
541
|
-
return [4 /*yield*/, utils_1.createFile(configPath, content)];
|
|
545
|
+
return [4 /*yield*/, (0, utils_1.createFile)(configPath, content)];
|
|
542
546
|
case 1:
|
|
543
547
|
_a.sent();
|
|
544
548
|
return [2 /*return*/, configPath];
|
|
@@ -581,7 +585,7 @@ function saveToLocalConfig(target, isDefault, saveWithDefaultValues) {
|
|
|
581
585
|
config.defaultTarget = target.name;
|
|
582
586
|
}
|
|
583
587
|
configPath = path_1.default.join(process.projectDir, 'sasjs', 'sasjsconfig.json');
|
|
584
|
-
return [4 /*yield*/, utils_1.createFile(configPath, JSON.stringify(config, null, 2))];
|
|
588
|
+
return [4 /*yield*/, (0, utils_1.createFile)(configPath, JSON.stringify(config, null, 2))];
|
|
585
589
|
case 2:
|
|
586
590
|
_b.sent();
|
|
587
591
|
return [2 /*return*/, configPath];
|
|
@@ -597,7 +601,7 @@ function getFolders() {
|
|
|
597
601
|
switch (_a.label) {
|
|
598
602
|
case 0:
|
|
599
603
|
configPath = '../config.json';
|
|
600
|
-
return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, configPath))];
|
|
604
|
+
return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(__dirname, configPath))];
|
|
601
605
|
case 1:
|
|
602
606
|
config = _a.sent();
|
|
603
607
|
if (config) {
|
|
@@ -633,9 +637,9 @@ function getProgramFolders(target) {
|
|
|
633
637
|
}
|
|
634
638
|
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
635
639
|
programFolders = programFolders.map(function (programFolder) {
|
|
636
|
-
return utils_1.getAbsolutePath(programFolder, buildSourceFolder);
|
|
640
|
+
return (0, utils_1.getAbsolutePath)(programFolder, buildSourceFolder);
|
|
637
641
|
});
|
|
638
|
-
return [2 /*return*/, __spreadArray([], __read(new Set(programFolders)))];
|
|
642
|
+
return [2 /*return*/, __spreadArray([], __read(new Set(programFolders)), false)];
|
|
639
643
|
}
|
|
640
644
|
});
|
|
641
645
|
});
|
|
@@ -659,9 +663,9 @@ function getBinaryFolders(target) {
|
|
|
659
663
|
}
|
|
660
664
|
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
661
665
|
binaryFolders = binaryFolders.map(function (binaryFolder) {
|
|
662
|
-
return utils_1.getAbsolutePath(binaryFolder, buildSourceFolder);
|
|
666
|
+
return (0, utils_1.getAbsolutePath)(binaryFolder, buildSourceFolder);
|
|
663
667
|
});
|
|
664
|
-
return [2 /*return*/, __spreadArray([], __read(new Set(binaryFolders)))];
|
|
668
|
+
return [2 /*return*/, __spreadArray([], __read(new Set(binaryFolders)), false)];
|
|
665
669
|
}
|
|
666
670
|
});
|
|
667
671
|
});
|
|
@@ -690,9 +694,9 @@ function getMacroFolders(target) {
|
|
|
690
694
|
}
|
|
691
695
|
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
692
696
|
macroFolders = macroFolders.map(function (macroFolder) {
|
|
693
|
-
return utils_1.getAbsolutePath(macroFolder, buildSourceFolder);
|
|
697
|
+
return (0, utils_1.getAbsolutePath)(macroFolder, buildSourceFolder);
|
|
694
698
|
});
|
|
695
|
-
return [2 /*return*/, __spreadArray([], __read(new Set(macroFolders)))];
|
|
699
|
+
return [2 /*return*/, __spreadArray([], __read(new Set(macroFolders)), false)];
|
|
696
700
|
}
|
|
697
701
|
});
|
|
698
702
|
});
|
|
@@ -750,11 +754,11 @@ function getProjectRoot() {
|
|
|
750
754
|
_b.label = 1;
|
|
751
755
|
case 1:
|
|
752
756
|
if (!(!rootFound && i <= maxLevels)) return [3 /*break*/, 5];
|
|
753
|
-
return [4 /*yield*/, utils_1.folderExists(path_1.default.join(currentLocation, 'sasjs'))];
|
|
757
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(path_1.default.join(currentLocation, 'sasjs'))];
|
|
754
758
|
case 2:
|
|
755
759
|
_a = (_b.sent());
|
|
756
760
|
if (!_a) return [3 /*break*/, 4];
|
|
757
|
-
return [4 /*yield*/, utils_1.fileExists(path_1.default.join(currentLocation, 'sasjs', 'sasjsconfig.json'))];
|
|
761
|
+
return [4 /*yield*/, (0, utils_1.fileExists)(path_1.default.join(currentLocation, 'sasjs', 'sasjsconfig.json'))];
|
|
758
762
|
case 3:
|
|
759
763
|
_a = (_b.sent());
|
|
760
764
|
_b.label = 4;
|
|
@@ -794,7 +798,7 @@ function getAuthConfig(target) {
|
|
|
794
798
|
if (!(!access_token ||
|
|
795
799
|
access_token.trim() === 'null' ||
|
|
796
800
|
access_token.trim() === 'undefined')) return [3 /*break*/, 2];
|
|
797
|
-
return [4 /*yield*/, exports.overrideEnvVariables(target === null || target === void 0 ? void 0 : target.name)];
|
|
801
|
+
return [4 /*yield*/, (0, exports.overrideEnvVariables)(target === null || target === void 0 ? void 0 : target.name)];
|
|
798
802
|
case 1:
|
|
799
803
|
_e.sent();
|
|
800
804
|
access_token = process.env.ACCESS_TOKEN;
|
|
@@ -816,7 +820,7 @@ function getAuthConfig(target) {
|
|
|
816
820
|
? undefined
|
|
817
821
|
: client;
|
|
818
822
|
if (!client) {
|
|
819
|
-
throw new Error("Client ID was not found.\n Please make sure that the 'client' property is set in your local .env file or in the correct target authConfig in your global ~"
|
|
823
|
+
throw new Error("Client ID was not found.\n Please make sure that the 'client' property is set in your local .env file or in the correct target authConfig in your global ~".concat(path_1.default.sep, ".sasjsrc file."));
|
|
820
824
|
}
|
|
821
825
|
secret = ((_d = target === null || target === void 0 ? void 0 : target.authConfig) === null || _d === void 0 ? void 0 : _d.secret)
|
|
822
826
|
? target.authConfig.secret
|
|
@@ -826,21 +830,21 @@ function getAuthConfig(target) {
|
|
|
826
830
|
? undefined
|
|
827
831
|
: secret;
|
|
828
832
|
if (!secret) {
|
|
829
|
-
throw new Error("Client secret was not found.\n Please make sure that the 'secret' property is set in your local .env file or in the correct target authConfig in your global ~"
|
|
833
|
+
throw new Error("Client secret was not found.\n Please make sure that the 'secret' property is set in your local .env file or in the correct target authConfig in your global ~".concat(path_1.default.sep, ".sasjsrc file."));
|
|
830
834
|
}
|
|
831
|
-
if (!auth_1.isAccessTokenExpiring(access_token)) return [3 /*break*/, 7];
|
|
835
|
+
if (!(0, auth_1.isAccessTokenExpiring)(access_token)) return [3 /*break*/, 7];
|
|
832
836
|
sasjs = new node_1.default({
|
|
833
837
|
serverUrl: target.serverUrl,
|
|
834
838
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
835
839
|
serverType: target.serverType
|
|
836
840
|
});
|
|
837
841
|
tokens = void 0;
|
|
838
|
-
if (!auth_1.isRefreshTokenExpiring(refresh_token)) return [3 /*break*/, 4];
|
|
839
|
-
return [4 /*yield*/, auth_1.getNewAccessToken(sasjs, client, secret, target)];
|
|
842
|
+
if (!(0, auth_1.isRefreshTokenExpiring)(refresh_token)) return [3 /*break*/, 4];
|
|
843
|
+
return [4 /*yield*/, (0, auth_1.getNewAccessToken)(sasjs, client, secret, target)];
|
|
840
844
|
case 3:
|
|
841
845
|
tokens = _e.sent();
|
|
842
846
|
return [3 /*break*/, 6];
|
|
843
|
-
case 4: return [4 /*yield*/, auth_1.refreshTokens(sasjs, client, secret, refresh_token)];
|
|
847
|
+
case 4: return [4 /*yield*/, (0, auth_1.refreshTokens)(sasjs, client, secret, refresh_token)];
|
|
844
848
|
case 5:
|
|
845
849
|
tokens = _e.sent();
|
|
846
850
|
_e.label = 6;
|
|
@@ -886,7 +890,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
886
890
|
if (!(!accessToken ||
|
|
887
891
|
accessToken.trim() === 'null' ||
|
|
888
892
|
accessToken.trim() === 'undefined')) return [3 /*break*/, 2];
|
|
889
|
-
return [4 /*yield*/, exports.overrideEnvVariables(target === null || target === void 0 ? void 0 : target.name)];
|
|
893
|
+
return [4 /*yield*/, (0, exports.overrideEnvVariables)(target === null || target === void 0 ? void 0 : target.name)];
|
|
890
894
|
case 1:
|
|
891
895
|
_a.sent();
|
|
892
896
|
accessToken = process.env.ACCESS_TOKEN;
|
|
@@ -897,7 +901,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
897
901
|
accessToken.trim() === 'undefined') {
|
|
898
902
|
throw new Error("A valid access token was not found.\nPlease provide an access token in the access_token property in your .env file or as part of the authInfo in your target configuration (sasjsconfig.json).");
|
|
899
903
|
}
|
|
900
|
-
if (!(checkIfExpiring && auth_1.isAccessTokenExpiring(accessToken))) return [3 /*break*/, 7];
|
|
904
|
+
if (!(checkIfExpiring && (0, auth_1.isAccessTokenExpiring)(accessToken))) return [3 /*break*/, 7];
|
|
901
905
|
sasjs = new node_1.default({
|
|
902
906
|
serverUrl: target.serverUrl,
|
|
903
907
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
@@ -911,7 +915,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
911
915
|
? undefined
|
|
912
916
|
: client;
|
|
913
917
|
if (!client) {
|
|
914
|
-
throw new Error("Client ID was not found.\n Please make sure that the 'client' property is set in your local .env file or in the correct target authConfig in your global ~"
|
|
918
|
+
throw new Error("Client ID was not found.\n Please make sure that the 'client' property is set in your local .env file or in the correct target authConfig in your global ~".concat(path_1.default.sep, ".sasjsrc file."));
|
|
915
919
|
}
|
|
916
920
|
secret = target.authConfig && target.authConfig.secret
|
|
917
921
|
? target.authConfig.secret
|
|
@@ -921,7 +925,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
921
925
|
? undefined
|
|
922
926
|
: secret;
|
|
923
927
|
if (!secret) {
|
|
924
|
-
throw new Error("Client secret was not found.\n Please make sure that the 'secret' property is set in your local .env file or in the correct target authConfig in your global ~"
|
|
928
|
+
throw new Error("Client secret was not found.\n Please make sure that the 'secret' property is set in your local .env file or in the correct target authConfig in your global ~".concat(path_1.default.sep, ".sasjsrc file."));
|
|
925
929
|
}
|
|
926
930
|
refreshToken = target.authConfig && target.authConfig.refresh_token
|
|
927
931
|
? target.authConfig.refresh_token
|
|
@@ -932,12 +936,12 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
932
936
|
? undefined
|
|
933
937
|
: refreshToken;
|
|
934
938
|
tokens = void 0;
|
|
935
|
-
if (!auth_1.isRefreshTokenExpiring(refreshToken)) return [3 /*break*/, 4];
|
|
936
|
-
return [4 /*yield*/, auth_1.getNewAccessToken(sasjs, client, secret, target)];
|
|
939
|
+
if (!(0, auth_1.isRefreshTokenExpiring)(refreshToken)) return [3 /*break*/, 4];
|
|
940
|
+
return [4 /*yield*/, (0, auth_1.getNewAccessToken)(sasjs, client, secret, target)];
|
|
937
941
|
case 3:
|
|
938
942
|
tokens = _a.sent();
|
|
939
943
|
return [3 /*break*/, 6];
|
|
940
|
-
case 4: return [4 /*yield*/, auth_1.refreshTokens(sasjs, client, secret, refreshToken)];
|
|
944
|
+
case 4: return [4 /*yield*/, (0, auth_1.refreshTokens)(sasjs, client, secret, refreshToken)];
|
|
941
945
|
case 5:
|
|
942
946
|
tokens = _a.sent();
|
|
943
947
|
_a.label = 6;
|
|
@@ -963,9 +967,9 @@ var overrideEnvVariables = function (targetName) { return __awaiter(void 0, void
|
|
|
963
967
|
if (!targetName) {
|
|
964
968
|
return [2 /*return*/];
|
|
965
969
|
}
|
|
966
|
-
return [4 /*yield*/, utils_1.readFile(path_1.default.join(process.projectDir, ".env."
|
|
970
|
+
return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(process.projectDir, ".env.".concat(targetName))).catch(function (e) {
|
|
967
971
|
var _a;
|
|
968
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.warn("A .env."
|
|
972
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.warn("A .env.".concat(targetName, " file was not found in your project directory. Defaulting to variables from the main .env file."));
|
|
969
973
|
})];
|
|
970
974
|
case 1:
|
|
971
975
|
targetEnvFile = _a.sent();
|
|
@@ -989,21 +993,21 @@ var getPrecedenceOfHttpsAgentOptionsAndContent = function (config, target) { ret
|
|
|
989
993
|
httpsAgentOptions = getHttpsAgentOptionsForInsecure(__assign(__assign({ allowInsecureRequests: false }, config.httpsAgentOptions), target.httpsAgentOptions));
|
|
990
994
|
if (!httpsAgentOptions.caPath) return [3 /*break*/, 2];
|
|
991
995
|
_a = httpsAgentOptions;
|
|
992
|
-
return [4 /*yield*/, utils_1.readFile(httpsAgentOptions.caPath)];
|
|
996
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.caPath)];
|
|
993
997
|
case 1:
|
|
994
998
|
_a.ca = _d.sent();
|
|
995
999
|
_d.label = 2;
|
|
996
1000
|
case 2:
|
|
997
1001
|
if (!httpsAgentOptions.keyPath) return [3 /*break*/, 4];
|
|
998
1002
|
_b = httpsAgentOptions;
|
|
999
|
-
return [4 /*yield*/, utils_1.readFile(httpsAgentOptions.keyPath)];
|
|
1003
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.keyPath)];
|
|
1000
1004
|
case 3:
|
|
1001
1005
|
_b.key = _d.sent();
|
|
1002
1006
|
_d.label = 4;
|
|
1003
1007
|
case 4:
|
|
1004
1008
|
if (!httpsAgentOptions.certPath) return [3 /*break*/, 6];
|
|
1005
1009
|
_c = httpsAgentOptions;
|
|
1006
|
-
return [4 /*yield*/, utils_1.readFile(httpsAgentOptions.certPath)];
|
|
1010
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.certPath)];
|
|
1007
1011
|
case 5:
|
|
1008
1012
|
_c.cert = _d.sent();
|
|
1009
1013
|
_d.label = 6;
|
|
@@ -11,7 +11,7 @@ function displayError(err, errorMessage) {
|
|
|
11
11
|
var _a, _b, _c;
|
|
12
12
|
if (errorMessage === void 0) { errorMessage = ''; }
|
|
13
13
|
if (errorMessage)
|
|
14
|
-
errorMessage = errorMessage
|
|
14
|
+
errorMessage = "".concat(errorMessage, "\n");
|
|
15
15
|
if (err !== undefined) {
|
|
16
16
|
var failureDetails = '';
|
|
17
17
|
if (err.hasOwnProperty('error')) {
|
|
@@ -24,9 +24,9 @@ function displayError(err, errorMessage) {
|
|
|
24
24
|
details = JSON.stringify(details);
|
|
25
25
|
if (typeof raw === 'object')
|
|
26
26
|
raw = JSON.stringify(raw);
|
|
27
|
-
failureDetails = ""
|
|
27
|
+
failureDetails = "".concat(message).concat(details ? '\n' + details : '').concat(raw ? '\n' + raw : '');
|
|
28
28
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(errorMessage, failureDetails);
|
|
29
|
-
return ""
|
|
29
|
+
return "".concat(errorMessage).concat(failureDetails);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else if (err.hasOwnProperty('message')) {
|
|
@@ -45,7 +45,7 @@ function displayError(err, errorMessage) {
|
|
|
45
45
|
if (err instanceof Error && process.env.LOG_LEVEL === utils_1.LogLevel.Debug) {
|
|
46
46
|
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.error(err.stack || '');
|
|
47
47
|
}
|
|
48
|
-
return ""
|
|
48
|
+
return "".concat(errorMessage).concat(failureDetails);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.displayError = displayError;
|
package/build/utils/file.js
CHANGED
|
@@ -55,7 +55,7 @@ function createFolderStructure(folder, parentFolderName) {
|
|
|
55
55
|
if (parentFolderName) {
|
|
56
56
|
folderPath = path_1.default.join(process.projectDir, parentFolderName, folder.folderName);
|
|
57
57
|
}
|
|
58
|
-
return [4 /*yield*/, utils_1.createFolder(folderPath).catch(function () { var _a; return (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error creating folder: ', folder.folderName); })];
|
|
58
|
+
return [4 /*yield*/, (0, utils_1.createFolder)(folderPath).catch(function () { var _a; return (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error creating folder: ', folder.folderName); })];
|
|
59
59
|
case 1:
|
|
60
60
|
_a.sent();
|
|
61
61
|
if (folder.files && folder.files.length) {
|
|
@@ -64,8 +64,8 @@ function createFolderStructure(folder, parentFolderName) {
|
|
|
64
64
|
return __generator(this, function (_a) {
|
|
65
65
|
switch (_a.label) {
|
|
66
66
|
case 0:
|
|
67
|
-
filePath = path_1.default.join(process.projectDir, parentFolderName, folder.folderName
|
|
68
|
-
return [4 /*yield*/, utils_1.createFile(filePath, file.content).catch(function () {
|
|
67
|
+
filePath = path_1.default.join(process.projectDir, parentFolderName, "".concat(folder.folderName, "/").concat(file.fileName));
|
|
68
|
+
return [4 /*yield*/, (0, utils_1.createFile)(filePath, file.content).catch(function () {
|
|
69
69
|
var _a;
|
|
70
70
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error creating file: ', filePath);
|
|
71
71
|
})];
|
|
@@ -81,7 +81,7 @@ function createFolderStructure(folder, parentFolderName) {
|
|
|
81
81
|
return __generator(this, function (_a) {
|
|
82
82
|
switch (_a.label) {
|
|
83
83
|
case 0:
|
|
84
|
-
subFolder.folderName = ""
|
|
84
|
+
subFolder.folderName = "".concat(parentFolderName ? parentFolderName + '/' : '').concat(folder.folderName, "/").concat(subFolder.folderName);
|
|
85
85
|
return [4 /*yield*/, createFolderStructure(subFolder)];
|
|
86
86
|
case 1:
|
|
87
87
|
_a.sent();
|
|
@@ -162,13 +162,13 @@ function getRelativePath(from, to) {
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
similarPath = similarPath.join(path_1.default.sep);
|
|
165
|
-
var leadingPathSepRegExp = new RegExp("^"
|
|
166
|
-
var trailingPathSepRegExp = new RegExp(path_1.default.sep.replace(/\\/g, '\\\\')
|
|
165
|
+
var leadingPathSepRegExp = new RegExp("^".concat(path_1.default.sep.replace(/\\/g, '\\\\')));
|
|
166
|
+
var trailingPathSepRegExp = new RegExp("".concat(path_1.default.sep.replace(/\\/g, '\\\\'), "$"));
|
|
167
167
|
relativePath =
|
|
168
168
|
(!path_1.default.sep.match(/\\/)
|
|
169
169
|
? relativePath.length
|
|
170
|
-
?
|
|
171
|
-
: "."
|
|
170
|
+
? "..".concat(path_1.default.sep).repeat(relativePath.length)
|
|
171
|
+
: ".".concat(path_1.default.sep)
|
|
172
172
|
: '') +
|
|
173
173
|
to
|
|
174
174
|
.replace(similarPath, '')
|
|
@@ -182,18 +182,18 @@ function saveToDefaultLocation(filePath, data) {
|
|
|
182
182
|
var root, destination, relativePath;
|
|
183
183
|
return __generator(this, function (_a) {
|
|
184
184
|
switch (_a.label) {
|
|
185
|
-
case 0: return [4 /*yield*/, config_1.getProjectRoot()];
|
|
185
|
+
case 0: return [4 /*yield*/, (0, config_1.getProjectRoot)()];
|
|
186
186
|
case 1:
|
|
187
187
|
root = _a.sent();
|
|
188
188
|
destination = path_1.default.join(root, 'sasjsbuild', filePath);
|
|
189
189
|
getRelativePath(process.cwd(), destination);
|
|
190
190
|
relativePath = getRelativePath(process.cwd(), destination);
|
|
191
|
-
return [4 /*yield*/, utils_1.createFile(destination, data)];
|
|
191
|
+
return [4 /*yield*/, (0, utils_1.createFile)(destination, data)];
|
|
192
192
|
case 2:
|
|
193
193
|
_a.sent();
|
|
194
194
|
return [2 /*return*/, Promise.resolve({
|
|
195
195
|
absolutePath: destination,
|
|
196
|
-
relativePath: ""
|
|
196
|
+
relativePath: "".concat(relativePath)
|
|
197
197
|
})];
|
|
198
198
|
}
|
|
199
199
|
});
|
|
@@ -5,8 +5,8 @@ var builtFiles = function (buildFileName) {
|
|
|
5
5
|
return {
|
|
6
6
|
folderName: 'sasjsbuild',
|
|
7
7
|
files: [
|
|
8
|
-
{ fileName: buildFileName
|
|
9
|
-
{ fileName: buildFileName
|
|
8
|
+
{ fileName: "".concat(buildFileName, ".sas") },
|
|
9
|
+
{ fileName: "".concat(buildFileName, ".json") }
|
|
10
10
|
],
|
|
11
11
|
subFolders: [
|
|
12
12
|
{
|
|
@@ -5,8 +5,8 @@ var builtFilesCustom1 = function (buildFileName) {
|
|
|
5
5
|
return {
|
|
6
6
|
folderName: 'sasjsbuild',
|
|
7
7
|
files: [
|
|
8
|
-
{ fileName: buildFileName
|
|
9
|
-
{ fileName: buildFileName
|
|
8
|
+
{ fileName: "".concat(buildFileName, ".sas") },
|
|
9
|
+
{ fileName: "".concat(buildFileName, ".json") }
|
|
10
10
|
],
|
|
11
11
|
subFolders: [
|
|
12
12
|
{
|
|
@@ -14,7 +14,7 @@ var getLogFilePath = function (logArg, jobPath) {
|
|
|
14
14
|
: process.projectDir;
|
|
15
15
|
return path_1.default.join(currentDirPath, logArg);
|
|
16
16
|
}
|
|
17
|
-
var logFileName = jobPath.split('/').slice(-1).pop()
|
|
17
|
+
var logFileName = "".concat(jobPath.split('/').slice(-1).pop(), ".log");
|
|
18
18
|
return path_1.default.join(process.projectDir, logFileName);
|
|
19
19
|
};
|
|
20
20
|
exports.getLogFilePath = getLogFilePath;
|
|
@@ -60,7 +60,7 @@ function loadTargetEnvVariables(targetName) {
|
|
|
60
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
switch (_a.label) {
|
|
63
|
-
case 0: return [4 /*yield*/, loadEnvVariables(".env."
|
|
63
|
+
case 0: return [4 /*yield*/, loadEnvVariables(".env.".concat(targetName))];
|
|
64
64
|
case 1:
|
|
65
65
|
_a.sent();
|
|
66
66
|
return [2 /*return*/];
|
|
@@ -74,10 +74,10 @@ function loadEnvVariables(fileName) {
|
|
|
74
74
|
var envFileExistsInCurrentPath, envFileExistsInParentPath, envFilePath;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
switch (_a.label) {
|
|
77
|
-
case 0: return [4 /*yield*/, file_1.fileExists(path_1.default.join(process.cwd(), fileName))];
|
|
77
|
+
case 0: return [4 /*yield*/, (0, file_1.fileExists)(path_1.default.join(process.cwd(), fileName))];
|
|
78
78
|
case 1:
|
|
79
79
|
envFileExistsInCurrentPath = _a.sent();
|
|
80
|
-
return [4 /*yield*/, file_1.fileExists(path_1.default.join(process.cwd(), '..', fileName))];
|
|
80
|
+
return [4 /*yield*/, (0, file_1.fileExists)(path_1.default.join(process.cwd(), '..', fileName))];
|
|
81
81
|
case 2:
|
|
82
82
|
envFileExistsInParentPath = _a.sent();
|
|
83
83
|
envFilePath = envFileExistsInCurrentPath
|
|
@@ -12,7 +12,7 @@ var prefixAppLoc = function (appLoc, path) {
|
|
|
12
12
|
path = path.join(' ');
|
|
13
13
|
return path
|
|
14
14
|
.split(' ')
|
|
15
|
-
.map(function (p) { return (/^\//.test(p) ? p : appLoc
|
|
15
|
+
.map(function (p) { return (/^\//.test(p) ? p : "".concat(appLoc, "/").concat(p)); })
|
|
16
16
|
.join(' ');
|
|
17
17
|
};
|
|
18
18
|
exports.prefixAppLoc = prefixAppLoc;
|
package/build/utils/saveLog.js
CHANGED
|
@@ -53,26 +53,26 @@ var saveLog = function (logData, logFile, jobPath, returnStatusOnly) { return __
|
|
|
53
53
|
logPath = logFile;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
logPath = path_1.default.join(process.projectDir, jobPath.split(path_1.default.sep).slice(-1).pop()
|
|
56
|
+
logPath = path_1.default.join(process.projectDir, "".concat(jobPath.split(path_1.default.sep).slice(-1).pop(), ".log"));
|
|
57
57
|
}
|
|
58
58
|
folderPath = logPath.split(path_1.default.sep);
|
|
59
59
|
folderPath.pop();
|
|
60
60
|
parentFolderPath = folderPath.join(path_1.default.sep);
|
|
61
|
-
return [4 /*yield*/, utils_1.folderExists(parentFolderPath)];
|
|
61
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(parentFolderPath)];
|
|
62
62
|
case 1:
|
|
63
63
|
if (!!(_b.sent())) return [3 /*break*/, 3];
|
|
64
|
-
return [4 /*yield*/, utils_1.createFolder(parentFolderPath)];
|
|
64
|
+
return [4 /*yield*/, (0, utils_1.createFolder)(parentFolderPath)];
|
|
65
65
|
case 2:
|
|
66
66
|
_b.sent();
|
|
67
67
|
_b.label = 3;
|
|
68
68
|
case 3:
|
|
69
|
-
logLines = typeof logData === 'object' ? _1.parseLogLines(logData) : logData;
|
|
70
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Creating log file at "
|
|
71
|
-
return [4 /*yield*/, utils_1.createFile(logPath, logLines)];
|
|
69
|
+
logLines = typeof logData === 'object' ? (0, _1.parseLogLines)(logData) : logData;
|
|
70
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Creating log file at ".concat(logPath, " ."));
|
|
71
|
+
return [4 /*yield*/, (0, utils_1.createFile)(logPath, logLines)];
|
|
72
72
|
case 4:
|
|
73
73
|
_b.sent();
|
|
74
74
|
if (!returnStatusOnly)
|
|
75
|
-
_1.displaySuccess("Log saved to "
|
|
75
|
+
(0, _1.displaySuccess)("Log saved to ".concat(logPath));
|
|
76
76
|
return [2 /*return*/];
|
|
77
77
|
}
|
|
78
78
|
});
|
|
@@ -50,7 +50,7 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
50
50
|
var _c, _d;
|
|
51
51
|
return __generator(this, function (_e) {
|
|
52
52
|
switch (_e.label) {
|
|
53
|
-
case 0: return [4 /*yield*/, config_1.getLocalOrGlobalConfig().catch(function () { return ({
|
|
53
|
+
case 0: return [4 /*yield*/, (0, config_1.getLocalOrGlobalConfig)().catch(function () { return ({
|
|
54
54
|
configuration: null,
|
|
55
55
|
isLocal: false
|
|
56
56
|
}); })];
|
|
@@ -67,7 +67,7 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
67
67
|
switch (_a.label) {
|
|
68
68
|
case 0:
|
|
69
69
|
_a.trys.push([0, 2, , 3]);
|
|
70
|
-
return [4 /*yield*/, get_installed_path_1.getInstalledPath('@sasjs/cli')];
|
|
70
|
+
return [4 /*yield*/, (0, get_installed_path_1.getInstalledPath)('@sasjs/cli')];
|
|
71
71
|
case 1:
|
|
72
72
|
sasjsPath = _a.sent();
|
|
73
73
|
macroCoreGlobal = path_1.default.join(sasjsPath, 'node_modules', '@sasjs', 'core');
|
|
@@ -81,7 +81,7 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
81
81
|
}); };
|
|
82
82
|
buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
|
|
83
83
|
buildSourceDbFolder = path_1.default.join(isLocal ? process.projectDir : homeDir, 'sasjs', 'db');
|
|
84
|
-
buildDestinationFolder = utils_1.getAbsolutePath(buildOutputFolder, isLocal ? process.projectDir : homeDir);
|
|
84
|
+
buildDestinationFolder = (0, utils_1.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
|
|
85
85
|
buildDestinationServicesFolder = path_1.default.join(buildDestinationFolder, 'services');
|
|
86
86
|
buildDestinationTestFolder = path_1.default.join(buildDestinationFolder, 'tests');
|
|
87
87
|
buildDestinationJobsFolder = path_1.default.join(buildDestinationFolder, 'jobs');
|
|
@@ -96,7 +96,7 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
96
96
|
_e.label = 4;
|
|
97
97
|
case 4:
|
|
98
98
|
macroCorePath = _b;
|
|
99
|
-
buildDestinationResultsFolder = utils_1.getAbsolutePath(buildResultsFolder, isLocal ? process.projectDir : homeDir);
|
|
99
|
+
buildDestinationResultsFolder = (0, utils_1.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
|
|
100
100
|
buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
|
|
101
101
|
sas9CredentialsError = 'The following attributes were not found:' +
|
|
102
102
|
'\n* SAS_USERNAME' +
|
|
@@ -44,7 +44,7 @@ var setProjectDir = function (args) { return __awaiter(void 0, void 0, void 0, f
|
|
|
44
44
|
return __generator(this, function (_a) {
|
|
45
45
|
switch (_a.label) {
|
|
46
46
|
case 0:
|
|
47
|
-
baseCommand = getBaseCommand_1.getBaseCommand(args);
|
|
47
|
+
baseCommand = (0, getBaseCommand_1.getBaseCommand)(args);
|
|
48
48
|
nonProjectCommands = ['create', 'init'];
|
|
49
49
|
if (!nonProjectCommands.includes(baseCommand.name)) return [3 /*break*/, 1];
|
|
50
50
|
if (!process.projectDir)
|
|
@@ -54,7 +54,7 @@ var setProjectDir = function (args) { return __awaiter(void 0, void 0, void 0, f
|
|
|
54
54
|
process.currentDir = process.cwd();
|
|
55
55
|
if (!!process.projectDir) return [3 /*break*/, 3];
|
|
56
56
|
process.projectDir = process.cwd();
|
|
57
|
-
return [4 /*yield*/, config_1.getProjectRoot()];
|
|
57
|
+
return [4 /*yield*/, (0, config_1.getProjectRoot)()];
|
|
58
58
|
case 2:
|
|
59
59
|
rootDir = _a.sent();
|
|
60
60
|
if (rootDir !== process.projectDir) {
|