@sasjs/cli 3.5.1 → 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 +11 -7
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +41 -41
- 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 +12 -22
- package/build/commands/compile/spec/compileServiceFile.spec.js +12 -22
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
- package/build/commands/compile/spec/loadDependencies.spec.js +31 -162
- 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 +16 -16
- 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 +210 -178
- 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 +39 -35
- 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/config.json +1 -0
- 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.d.ts +1 -0
- package/build/utils/config.js +78 -48
- 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 +2 -3
- 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 +62 -60
- package/build/utils/utils.js +47 -43
- package/package.json +14 -14
package/build/utils/config.js
CHANGED
|
@@ -62,16 +62,20 @@ 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 };
|
|
72
76
|
};
|
|
73
77
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
|
-
exports.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.getAccessToken = exports.getAuthConfig = exports.getProjectRoot = exports.sanitizeAppLoc = exports.getMacroCorePath = exports.getStreamConfig = exports.getMacroFolders = exports.getProgramFolders = exports.getFolders = exports.saveToLocalConfig = exports.saveLocalConfigFile = exports.getLocalOrGlobalConfig = exports.getLocalConfig = exports.removeFromLocalConfig = exports.removeFromGlobalConfig = exports.saveToGlobalConfig = exports.saveGlobalRcFile = exports.getLocalRcFile = exports.getGlobalRcFile = exports.findTargetInConfiguration = exports.getConfiguration = void 0;
|
|
78
|
+
exports.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.getAccessToken = exports.getAuthConfig = exports.getProjectRoot = exports.sanitizeAppLoc = exports.getMacroCorePath = exports.getStreamConfig = exports.getMacroFolders = exports.getBinaryFolders = exports.getProgramFolders = exports.getFolders = exports.saveToLocalConfig = exports.saveLocalConfigFile = exports.getLocalOrGlobalConfig = exports.getLocalConfig = exports.removeFromLocalConfig = exports.removeFromGlobalConfig = exports.saveToGlobalConfig = exports.saveGlobalRcFile = exports.getLocalRcFile = exports.getGlobalRcFile = exports.findTargetInConfiguration = exports.getConfiguration = void 0;
|
|
75
79
|
var node_1 = __importDefault(require("@sasjs/adapter/node"));
|
|
76
80
|
var utils_1 = require("@sasjs/utils");
|
|
77
81
|
var auth_1 = require("./auth");
|
|
@@ -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,14 +637,40 @@ 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
|
});
|
|
642
646
|
}
|
|
643
647
|
exports.getProgramFolders = getProgramFolders;
|
|
648
|
+
function getBinaryFolders(target) {
|
|
649
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
650
|
+
var binaryFolders, localConfig, buildSourceFolder;
|
|
651
|
+
return __generator(this, function (_a) {
|
|
652
|
+
switch (_a.label) {
|
|
653
|
+
case 0:
|
|
654
|
+
binaryFolders = [];
|
|
655
|
+
return [4 /*yield*/, getLocalConfig().catch(function () { return null; })];
|
|
656
|
+
case 1:
|
|
657
|
+
localConfig = _a.sent();
|
|
658
|
+
if (localConfig === null || localConfig === void 0 ? void 0 : localConfig.binaryFolders) {
|
|
659
|
+
binaryFolders = binaryFolders.concat(localConfig.binaryFolders);
|
|
660
|
+
}
|
|
661
|
+
if (target === null || target === void 0 ? void 0 : target.binaryFolders) {
|
|
662
|
+
binaryFolders = binaryFolders.concat(target.binaryFolders);
|
|
663
|
+
}
|
|
664
|
+
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
665
|
+
binaryFolders = binaryFolders.map(function (binaryFolder) {
|
|
666
|
+
return (0, utils_1.getAbsolutePath)(binaryFolder, buildSourceFolder);
|
|
667
|
+
});
|
|
668
|
+
return [2 /*return*/, __spreadArray([], __read(new Set(binaryFolders)), false)];
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
exports.getBinaryFolders = getBinaryFolders;
|
|
644
674
|
/**
|
|
645
675
|
* Returns SAS macro folders from configuration.
|
|
646
676
|
* This list includes both common and target-specific folders.
|
|
@@ -664,9 +694,9 @@ function getMacroFolders(target) {
|
|
|
664
694
|
}
|
|
665
695
|
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
666
696
|
macroFolders = macroFolders.map(function (macroFolder) {
|
|
667
|
-
return utils_1.getAbsolutePath(macroFolder, buildSourceFolder);
|
|
697
|
+
return (0, utils_1.getAbsolutePath)(macroFolder, buildSourceFolder);
|
|
668
698
|
});
|
|
669
|
-
return [2 /*return*/, __spreadArray([], __read(new Set(macroFolders)))];
|
|
699
|
+
return [2 /*return*/, __spreadArray([], __read(new Set(macroFolders)), false)];
|
|
670
700
|
}
|
|
671
701
|
});
|
|
672
702
|
});
|
|
@@ -724,11 +754,11 @@ function getProjectRoot() {
|
|
|
724
754
|
_b.label = 1;
|
|
725
755
|
case 1:
|
|
726
756
|
if (!(!rootFound && i <= maxLevels)) return [3 /*break*/, 5];
|
|
727
|
-
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'))];
|
|
728
758
|
case 2:
|
|
729
759
|
_a = (_b.sent());
|
|
730
760
|
if (!_a) return [3 /*break*/, 4];
|
|
731
|
-
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'))];
|
|
732
762
|
case 3:
|
|
733
763
|
_a = (_b.sent());
|
|
734
764
|
_b.label = 4;
|
|
@@ -768,7 +798,7 @@ function getAuthConfig(target) {
|
|
|
768
798
|
if (!(!access_token ||
|
|
769
799
|
access_token.trim() === 'null' ||
|
|
770
800
|
access_token.trim() === 'undefined')) return [3 /*break*/, 2];
|
|
771
|
-
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)];
|
|
772
802
|
case 1:
|
|
773
803
|
_e.sent();
|
|
774
804
|
access_token = process.env.ACCESS_TOKEN;
|
|
@@ -790,7 +820,7 @@ function getAuthConfig(target) {
|
|
|
790
820
|
? undefined
|
|
791
821
|
: client;
|
|
792
822
|
if (!client) {
|
|
793
|
-
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."));
|
|
794
824
|
}
|
|
795
825
|
secret = ((_d = target === null || target === void 0 ? void 0 : target.authConfig) === null || _d === void 0 ? void 0 : _d.secret)
|
|
796
826
|
? target.authConfig.secret
|
|
@@ -800,21 +830,21 @@ function getAuthConfig(target) {
|
|
|
800
830
|
? undefined
|
|
801
831
|
: secret;
|
|
802
832
|
if (!secret) {
|
|
803
|
-
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."));
|
|
804
834
|
}
|
|
805
|
-
if (!auth_1.isAccessTokenExpiring(access_token)) return [3 /*break*/, 7];
|
|
835
|
+
if (!(0, auth_1.isAccessTokenExpiring)(access_token)) return [3 /*break*/, 7];
|
|
806
836
|
sasjs = new node_1.default({
|
|
807
837
|
serverUrl: target.serverUrl,
|
|
808
838
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
809
839
|
serverType: target.serverType
|
|
810
840
|
});
|
|
811
841
|
tokens = void 0;
|
|
812
|
-
if (!auth_1.isRefreshTokenExpiring(refresh_token)) return [3 /*break*/, 4];
|
|
813
|
-
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)];
|
|
814
844
|
case 3:
|
|
815
845
|
tokens = _e.sent();
|
|
816
846
|
return [3 /*break*/, 6];
|
|
817
|
-
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)];
|
|
818
848
|
case 5:
|
|
819
849
|
tokens = _e.sent();
|
|
820
850
|
_e.label = 6;
|
|
@@ -860,7 +890,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
860
890
|
if (!(!accessToken ||
|
|
861
891
|
accessToken.trim() === 'null' ||
|
|
862
892
|
accessToken.trim() === 'undefined')) return [3 /*break*/, 2];
|
|
863
|
-
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)];
|
|
864
894
|
case 1:
|
|
865
895
|
_a.sent();
|
|
866
896
|
accessToken = process.env.ACCESS_TOKEN;
|
|
@@ -871,7 +901,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
871
901
|
accessToken.trim() === 'undefined') {
|
|
872
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).");
|
|
873
903
|
}
|
|
874
|
-
if (!(checkIfExpiring && auth_1.isAccessTokenExpiring(accessToken))) return [3 /*break*/, 7];
|
|
904
|
+
if (!(checkIfExpiring && (0, auth_1.isAccessTokenExpiring)(accessToken))) return [3 /*break*/, 7];
|
|
875
905
|
sasjs = new node_1.default({
|
|
876
906
|
serverUrl: target.serverUrl,
|
|
877
907
|
httpsAgentOptions: target.httpsAgentOptions,
|
|
@@ -885,7 +915,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
885
915
|
? undefined
|
|
886
916
|
: client;
|
|
887
917
|
if (!client) {
|
|
888
|
-
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."));
|
|
889
919
|
}
|
|
890
920
|
secret = target.authConfig && target.authConfig.secret
|
|
891
921
|
? target.authConfig.secret
|
|
@@ -895,7 +925,7 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
895
925
|
? undefined
|
|
896
926
|
: secret;
|
|
897
927
|
if (!secret) {
|
|
898
|
-
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."));
|
|
899
929
|
}
|
|
900
930
|
refreshToken = target.authConfig && target.authConfig.refresh_token
|
|
901
931
|
? target.authConfig.refresh_token
|
|
@@ -906,12 +936,12 @@ function getAccessToken(target, checkIfExpiring) {
|
|
|
906
936
|
? undefined
|
|
907
937
|
: refreshToken;
|
|
908
938
|
tokens = void 0;
|
|
909
|
-
if (!auth_1.isRefreshTokenExpiring(refreshToken)) return [3 /*break*/, 4];
|
|
910
|
-
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)];
|
|
911
941
|
case 3:
|
|
912
942
|
tokens = _a.sent();
|
|
913
943
|
return [3 /*break*/, 6];
|
|
914
|
-
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)];
|
|
915
945
|
case 5:
|
|
916
946
|
tokens = _a.sent();
|
|
917
947
|
_a.label = 6;
|
|
@@ -937,9 +967,9 @@ var overrideEnvVariables = function (targetName) { return __awaiter(void 0, void
|
|
|
937
967
|
if (!targetName) {
|
|
938
968
|
return [2 /*return*/];
|
|
939
969
|
}
|
|
940
|
-
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) {
|
|
941
971
|
var _a;
|
|
942
|
-
(_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."));
|
|
943
973
|
})];
|
|
944
974
|
case 1:
|
|
945
975
|
targetEnvFile = _a.sent();
|
|
@@ -963,21 +993,21 @@ var getPrecedenceOfHttpsAgentOptionsAndContent = function (config, target) { ret
|
|
|
963
993
|
httpsAgentOptions = getHttpsAgentOptionsForInsecure(__assign(__assign({ allowInsecureRequests: false }, config.httpsAgentOptions), target.httpsAgentOptions));
|
|
964
994
|
if (!httpsAgentOptions.caPath) return [3 /*break*/, 2];
|
|
965
995
|
_a = httpsAgentOptions;
|
|
966
|
-
return [4 /*yield*/, utils_1.readFile(httpsAgentOptions.caPath)];
|
|
996
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.caPath)];
|
|
967
997
|
case 1:
|
|
968
998
|
_a.ca = _d.sent();
|
|
969
999
|
_d.label = 2;
|
|
970
1000
|
case 2:
|
|
971
1001
|
if (!httpsAgentOptions.keyPath) return [3 /*break*/, 4];
|
|
972
1002
|
_b = httpsAgentOptions;
|
|
973
|
-
return [4 /*yield*/, utils_1.readFile(httpsAgentOptions.keyPath)];
|
|
1003
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.keyPath)];
|
|
974
1004
|
case 3:
|
|
975
1005
|
_b.key = _d.sent();
|
|
976
1006
|
_d.label = 4;
|
|
977
1007
|
case 4:
|
|
978
1008
|
if (!httpsAgentOptions.certPath) return [3 /*break*/, 6];
|
|
979
1009
|
_c = httpsAgentOptions;
|
|
980
|
-
return [4 /*yield*/, utils_1.readFile(httpsAgentOptions.certPath)];
|
|
1010
|
+
return [4 /*yield*/, (0, utils_1.readFile)(httpsAgentOptions.certPath)];
|
|
981
1011
|
case 5:
|
|
982
1012
|
_c.cert = _d.sent();
|
|
983
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
|
{
|
|
@@ -6,16 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getLogFilePath = void 0;
|
|
7
7
|
var path_1 = __importDefault(require("path"));
|
|
8
8
|
var getLogFilePath = function (logArg, jobPath) {
|
|
9
|
-
if (logArg === undefined || !jobPath || jobPath === '')
|
|
9
|
+
if (logArg === undefined || !jobPath || jobPath === '')
|
|
10
10
|
return undefined;
|
|
11
|
-
}
|
|
12
11
|
if (logArg) {
|
|
13
12
|
var currentDirPath = path_1.default.isAbsolute(logArg)
|
|
14
13
|
? ''
|
|
15
14
|
: process.projectDir;
|
|
16
15
|
return path_1.default.join(currentDirPath, logArg);
|
|
17
16
|
}
|
|
18
|
-
var logFileName = jobPath.split('/').slice(-1).pop()
|
|
17
|
+
var logFileName = "".concat(jobPath.split('/').slice(-1).pop(), ".log");
|
|
19
18
|
return path_1.default.join(process.projectDir, logFileName);
|
|
20
19
|
};
|
|
21
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' +
|