@sasjs/cli 3.6.0 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- 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 +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 +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 +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/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 +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 +59 -59
- package/build/utils/utils.js +47 -43
- package/package.json +11 -11
|
@@ -119,16 +119,16 @@ var CompileCommand = /** @class */ (function (_super) {
|
|
|
119
119
|
var leafFolderName = sourceFolderPath.split(path_1.default.sep).pop();
|
|
120
120
|
var outputPath;
|
|
121
121
|
if (value) {
|
|
122
|
-
var internal = [value, this.subCommand
|
|
122
|
+
var internal = [value, "".concat(this.subCommand, "s")];
|
|
123
123
|
if (leafFolderName)
|
|
124
124
|
internal.push(leafFolderName);
|
|
125
|
-
outputPath = utils_2.getAbsolutePath(internal.join(path_1.default.sep), process.currentDir);
|
|
125
|
+
outputPath = (0, utils_2.getAbsolutePath)(internal.join(path_1.default.sep), process.currentDir);
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
128
|
outputPath =
|
|
129
129
|
this.subCommand === 'job'
|
|
130
|
-
? getDestinationPath_1.getDestinationJobPath(sourceFolderPath)
|
|
131
|
-
: getDestinationPath_1.getDestinationServicePath(sourceFolderPath);
|
|
130
|
+
? (0, getDestinationPath_1.getDestinationJobPath)(sourceFolderPath)
|
|
131
|
+
: (0, getDestinationPath_1.getDestinationServicePath)(sourceFolderPath);
|
|
132
132
|
}
|
|
133
133
|
return outputPath;
|
|
134
134
|
},
|
|
@@ -164,14 +164,14 @@ var CompileCommand = /** @class */ (function (_super) {
|
|
|
164
164
|
case 1:
|
|
165
165
|
target = (_a.sent()).target;
|
|
166
166
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
167
|
-
return [4 /*yield*/, compile_1.compile(target, true)
|
|
167
|
+
return [4 /*yield*/, (0, compile_1.compile)(target, true)
|
|
168
168
|
.then(function () {
|
|
169
169
|
var _a;
|
|
170
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Services have been successfully compiled!\nThe compile output is located in the "
|
|
170
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Services have been successfully compiled!\nThe compile output is located in the ".concat(buildDestinationFolder, " directory."));
|
|
171
171
|
return command_1.ReturnCode.Success;
|
|
172
172
|
})
|
|
173
173
|
.catch(function (err) {
|
|
174
|
-
utils_1.displayError(err, 'An error has occurred when compiling services.');
|
|
174
|
+
(0, utils_1.displayError)(err, 'An error has occurred when compiling services.');
|
|
175
175
|
return command_1.ReturnCode.InternalError;
|
|
176
176
|
})];
|
|
177
177
|
case 2: return [2 /*return*/, _a.sent()];
|
|
@@ -190,14 +190,14 @@ var CompileCommand = /** @class */ (function (_super) {
|
|
|
190
190
|
return [4 /*yield*/, this.output];
|
|
191
191
|
case 2:
|
|
192
192
|
output = _a.sent();
|
|
193
|
-
return [4 /*yield*/, compileSingleFile_1.compileSingleFile(target, this.parsed.subCommand, this.source, output)
|
|
193
|
+
return [4 /*yield*/, (0, compileSingleFile_1.compileSingleFile)(target, this.parsed.subCommand, this.source, output)
|
|
194
194
|
.then(function (res) {
|
|
195
195
|
var _a;
|
|
196
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Source has been successfully compiled!\nThe compiled output is located at: "
|
|
196
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Source has been successfully compiled!\nThe compiled output is located at: ".concat(res.destinationPath));
|
|
197
197
|
return command_1.ReturnCode.Success;
|
|
198
198
|
})
|
|
199
199
|
.catch(function (err) {
|
|
200
|
-
utils_1.displayError(err, 'Error compiling source.');
|
|
200
|
+
(0, utils_1.displayError)(err, 'Error compiling source.');
|
|
201
201
|
return command_1.ReturnCode.InternalError;
|
|
202
202
|
})];
|
|
203
203
|
case 3: return [2 /*return*/, _a.sent()];
|
|
@@ -60,68 +60,68 @@ function compileSingleFile(target, subCommand, source, output, insertProgramVar)
|
|
|
60
60
|
service: 'service'
|
|
61
61
|
};
|
|
62
62
|
if (!subCommands.hasOwnProperty(subCommand) && subCommand !== 'identify') {
|
|
63
|
-
throw new Error("Unsupported context command. Supported commands are:\n"
|
|
63
|
+
throw new Error("Unsupported context command. Supported commands are:\n".concat(Object.keys(subCommands).join('\n')));
|
|
64
64
|
}
|
|
65
65
|
commandExample = 'sasjs compile <command> --source myjob.sas --target targetName -output /some/folder';
|
|
66
66
|
if (!source) {
|
|
67
|
-
throw new Error("'--source' flag is missing (eg '"
|
|
67
|
+
throw new Error("'--source' flag is missing (eg '".concat(commandExample, "')"));
|
|
68
68
|
}
|
|
69
69
|
source = source.split('/').join(path_1.default.sep);
|
|
70
|
-
sourcePath = utils_1.getAbsolutePath(source, process.currentDir);
|
|
70
|
+
sourcePath = (0, utils_1.getAbsolutePath)(source, process.currentDir);
|
|
71
71
|
return [4 /*yield*/, validateSourcePath(sourcePath)];
|
|
72
72
|
case 1:
|
|
73
73
|
if (!(_c.sent())) {
|
|
74
|
-
throw new Error("Provide a path to source file (eg '"
|
|
74
|
+
throw new Error("Provide a path to source file (eg '".concat(commandExample, "')"));
|
|
75
75
|
}
|
|
76
76
|
if (!(subCommand === 'identify')) return [3 /*break*/, 3];
|
|
77
|
-
return [4 /*yield*/, identifySasFile_1.identifySasFile(target, sourcePath)];
|
|
77
|
+
return [4 /*yield*/, (0, identifySasFile_1.identifySasFile)(target, sourcePath)];
|
|
78
78
|
case 2:
|
|
79
79
|
subCommand = _c.sent();
|
|
80
80
|
_c.label = 3;
|
|
81
81
|
case 3:
|
|
82
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Compiling source file:\n- "
|
|
82
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Compiling source file:\n- ".concat(sourcePath));
|
|
83
83
|
outputPathParts = output.split(path_1.default.sep);
|
|
84
84
|
leafFolderName = source.split(path_1.default.sep).pop();
|
|
85
85
|
outputPathParts.pop(), outputPathParts.pop();
|
|
86
86
|
parentOutputFolder = outputPathParts.join(path_1.default.sep);
|
|
87
|
-
return [4 /*yield*/, utils_1.fileExists(parentOutputFolder)];
|
|
87
|
+
return [4 /*yield*/, (0, utils_1.fileExists)(parentOutputFolder)];
|
|
88
88
|
case 4:
|
|
89
89
|
pathExists = _c.sent();
|
|
90
90
|
if (!pathExists) return [3 /*break*/, 6];
|
|
91
|
-
return [4 /*yield*/, utils_1.deleteFolder(parentOutputFolder)];
|
|
91
|
+
return [4 /*yield*/, (0, utils_1.deleteFolder)(parentOutputFolder)];
|
|
92
92
|
case 5:
|
|
93
93
|
_c.sent();
|
|
94
94
|
_c.label = 6;
|
|
95
|
-
case 6: return [4 /*yield*/, utils_1.createFolder(output)];
|
|
95
|
+
case 6: return [4 /*yield*/, (0, utils_1.createFolder)(output)];
|
|
96
96
|
case 7:
|
|
97
97
|
_c.sent();
|
|
98
98
|
sourceFileName = sourcePath.split(path_1.default.sep).pop();
|
|
99
99
|
destinationPath = path_1.default.join(output, sourceFileName);
|
|
100
|
-
return [4 /*yield*/, utils_1.copy(sourcePath, destinationPath)];
|
|
100
|
+
return [4 /*yield*/, (0, utils_1.copy)(sourcePath, destinationPath)];
|
|
101
101
|
case 8:
|
|
102
102
|
_c.sent();
|
|
103
103
|
sourceFileNameWithoutExt = sourceFileName.split('.')[0];
|
|
104
|
-
return [4 /*yield*/, config_1.getMacroFolders(target)];
|
|
104
|
+
return [4 /*yield*/, (0, config_1.getMacroFolders)(target)];
|
|
105
105
|
case 9:
|
|
106
106
|
macroFolders = _c.sent();
|
|
107
|
-
return [4 /*yield*/, config_1.getProgramFolders(target)];
|
|
107
|
+
return [4 /*yield*/, (0, config_1.getProgramFolders)(target)];
|
|
108
108
|
case 10:
|
|
109
109
|
programFolders = _c.sent();
|
|
110
110
|
psMaxOption = 'options ps=max;';
|
|
111
111
|
programVar = insertProgramVar
|
|
112
|
-
? "%let _program="
|
|
113
|
-
: ""
|
|
112
|
+
? "%let _program=".concat(target.appLoc, "/").concat(subCommand, "s/").concat(leafFolderName, "/").concat(sourceFileNameWithoutExt, ";\n").concat(psMaxOption)
|
|
113
|
+
: "".concat(psMaxOption);
|
|
114
114
|
_b = subCommand;
|
|
115
115
|
switch (_b) {
|
|
116
116
|
case subCommands.service: return [3 /*break*/, 11];
|
|
117
117
|
case subCommands.job: return [3 /*break*/, 13];
|
|
118
118
|
}
|
|
119
119
|
return [3 /*break*/, 15];
|
|
120
|
-
case 11: return [4 /*yield*/, compileServiceFile_1.compileServiceFile(target, destinationPath, macroFolders, programFolders, programVar)];
|
|
120
|
+
case 11: return [4 /*yield*/, (0, compileServiceFile_1.compileServiceFile)(target, destinationPath, macroFolders, programFolders, programVar)];
|
|
121
121
|
case 12:
|
|
122
122
|
_c.sent();
|
|
123
123
|
return [3 /*break*/, 16];
|
|
124
|
-
case 13: return [4 /*yield*/, compileJobFile_1.compileJobFile(target, destinationPath, macroFolders, programFolders, programVar)];
|
|
124
|
+
case 13: return [4 /*yield*/, (0, compileJobFile_1.compileJobFile)(target, destinationPath, macroFolders, programFolders, programVar)];
|
|
125
125
|
case 14:
|
|
126
126
|
_c.sent();
|
|
127
127
|
return [3 /*break*/, 16];
|
|
@@ -143,7 +143,7 @@ function validateSourcePath(path) {
|
|
|
143
143
|
isSourceFile = /\.sas$/i.test(path);
|
|
144
144
|
if (!isSourceFile)
|
|
145
145
|
return [2 /*return*/, false];
|
|
146
|
-
return [4 /*yield*/, utils_1.fileExists(path)];
|
|
146
|
+
return [4 /*yield*/, (0, utils_1.fileExists)(path)];
|
|
147
147
|
case 1: return [2 /*return*/, _a.sent()];
|
|
148
148
|
}
|
|
149
149
|
});
|
|
@@ -49,13 +49,13 @@ function checkCompileStatus(target, exceptions) {
|
|
|
49
49
|
switch (_c.label) {
|
|
50
50
|
case 0:
|
|
51
51
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
52
|
-
return [4 /*yield*/, utils_1.folderExists(buildDestinationFolder)];
|
|
52
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(buildDestinationFolder)];
|
|
53
53
|
case 1:
|
|
54
54
|
pathExists = _c.sent();
|
|
55
55
|
if (!pathExists) {
|
|
56
56
|
return [2 /*return*/, {
|
|
57
57
|
compiled: false,
|
|
58
|
-
message: "Build folder "
|
|
58
|
+
message: "Build folder ".concat(buildDestinationFolder, " doesn't exist.")
|
|
59
59
|
}];
|
|
60
60
|
}
|
|
61
61
|
return [4 /*yield*/, checkServiceFolders(target, exceptions)];
|
|
@@ -69,7 +69,7 @@ function checkCompileStatus(target, exceptions) {
|
|
|
69
69
|
compiled: compiled,
|
|
70
70
|
message: compiled
|
|
71
71
|
? 'All services and jobs are already present.'
|
|
72
|
-
: "Missing Services: "
|
|
72
|
+
: "Missing Services: ".concat(serviceReasons.join(', '), "\nMissing jobs: ").concat(jobReasons.join(', '))
|
|
73
73
|
}];
|
|
74
74
|
}
|
|
75
75
|
});
|
|
@@ -87,18 +87,18 @@ var checkServiceFolders = function (target, exceptions) { return __awaiter(void
|
|
|
87
87
|
var serviceFolders, areServiceFoldersMatching, reasons;
|
|
88
88
|
return __generator(this, function (_a) {
|
|
89
89
|
switch (_a.label) {
|
|
90
|
-
case 0: return [4 /*yield*/, getAllServiceFolders_1.getAllServiceFolders(target)];
|
|
90
|
+
case 0: return [4 /*yield*/, (0, getAllServiceFolders_1.getAllServiceFolders)(target)];
|
|
91
91
|
case 1:
|
|
92
92
|
serviceFolders = _a.sent();
|
|
93
93
|
areServiceFoldersMatching = true;
|
|
94
94
|
reasons = [];
|
|
95
|
-
return [4 /*yield*/, utils_1.asyncForEach(serviceFolders, function (serviceFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(serviceFolders, function (serviceFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
96
|
var destinationPath, _a, equal, reason;
|
|
97
97
|
return __generator(this, function (_b) {
|
|
98
98
|
switch (_b.label) {
|
|
99
99
|
case 0:
|
|
100
|
-
destinationPath = getDestinationPath_1.getDestinationServicePath(serviceFolder);
|
|
101
|
-
return [4 /*yield*/, compareFolders_1.compareFolders(serviceFolder, destinationPath, exceptions)];
|
|
100
|
+
destinationPath = (0, getDestinationPath_1.getDestinationServicePath)(serviceFolder);
|
|
101
|
+
return [4 /*yield*/, (0, compareFolders_1.compareFolders)(serviceFolder, destinationPath, exceptions)];
|
|
102
102
|
case 1:
|
|
103
103
|
_a = _b.sent(), equal = _a.equal, reason = _a.reason;
|
|
104
104
|
areServiceFoldersMatching = areServiceFoldersMatching && equal;
|
|
@@ -126,18 +126,18 @@ var checkJobFolders = function (target, exceptions) { return __awaiter(void 0, v
|
|
|
126
126
|
var jobFolders, areJobFoldersMatching, reasons;
|
|
127
127
|
return __generator(this, function (_a) {
|
|
128
128
|
switch (_a.label) {
|
|
129
|
-
case 0: return [4 /*yield*/, getAllJobFolders_1.getAllJobFolders(target)];
|
|
129
|
+
case 0: return [4 /*yield*/, (0, getAllJobFolders_1.getAllJobFolders)(target)];
|
|
130
130
|
case 1:
|
|
131
131
|
jobFolders = _a.sent();
|
|
132
132
|
areJobFoldersMatching = true;
|
|
133
133
|
reasons = [];
|
|
134
|
-
return [4 /*yield*/, utils_1.asyncForEach(jobFolders, function (jobFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(jobFolders, function (jobFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
135
135
|
var destinationPath, _a, equal, reason;
|
|
136
136
|
return __generator(this, function (_b) {
|
|
137
137
|
switch (_b.label) {
|
|
138
138
|
case 0:
|
|
139
|
-
destinationPath = getDestinationPath_1.getDestinationJobPath(jobFolder);
|
|
140
|
-
return [4 /*yield*/, compareFolders_1.compareFolders(jobFolder, destinationPath, exceptions)];
|
|
139
|
+
destinationPath = (0, getDestinationPath_1.getDestinationJobPath)(jobFolder);
|
|
140
|
+
return [4 /*yield*/, (0, compareFolders_1.compareFolders)(jobFolder, destinationPath, exceptions)];
|
|
141
141
|
case 1:
|
|
142
142
|
_a = _b.sent(), equal = _a.equal, reason = _a.reason;
|
|
143
143
|
areJobFoldersMatching = areJobFoldersMatching && equal;
|
|
@@ -42,33 +42,33 @@ var compareFolders = function (sourcePath, destinationPath, exceptions) { return
|
|
|
42
42
|
var sourcePathExists, destinationPathExists, sourceSubFolders, destinationSubFolders, sourceFiles, destinationFiles, areSubFoldersMatching, missingSubFolders, areFilesMatching, missingFiles;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
44
44
|
switch (_a.label) {
|
|
45
|
-
case 0: return [4 /*yield*/, utils_1.folderExists(sourcePath)];
|
|
45
|
+
case 0: return [4 /*yield*/, (0, utils_1.folderExists)(sourcePath)];
|
|
46
46
|
case 1:
|
|
47
47
|
sourcePathExists = _a.sent();
|
|
48
|
-
return [4 /*yield*/, utils_1.folderExists(destinationPath)];
|
|
48
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(destinationPath)];
|
|
49
49
|
case 2:
|
|
50
50
|
destinationPathExists = _a.sent();
|
|
51
51
|
if (!sourcePathExists) {
|
|
52
|
-
throw new Error("Source path "
|
|
52
|
+
throw new Error("Source path ".concat(sourcePath, " does not exist. Please check the `serviceFolders` and `jobFolders` in your target configuration and try again."));
|
|
53
53
|
}
|
|
54
54
|
if (!destinationPathExists) {
|
|
55
55
|
return [2 /*return*/, {
|
|
56
56
|
equal: false,
|
|
57
|
-
reason: "Destination path "
|
|
57
|
+
reason: "Destination path ".concat(destinationPath, " does not exist.")
|
|
58
58
|
}];
|
|
59
59
|
}
|
|
60
|
-
return [4 /*yield*/, utils_1.listSubFoldersInFolder(sourcePath)];
|
|
60
|
+
return [4 /*yield*/, (0, utils_1.listSubFoldersInFolder)(sourcePath)];
|
|
61
61
|
case 3:
|
|
62
62
|
sourceSubFolders = (_a.sent());
|
|
63
|
-
return [4 /*yield*/, utils_1.listSubFoldersInFolder(destinationPath)];
|
|
63
|
+
return [4 /*yield*/, (0, utils_1.listSubFoldersInFolder)(destinationPath)];
|
|
64
64
|
case 4:
|
|
65
65
|
destinationSubFolders = (_a.sent());
|
|
66
|
-
return [4 /*yield*/, utils_1.listFilesInFolder(sourcePath).then(function (files) {
|
|
67
|
-
return files.filter(function (file) { return !utils_1.isTestFile(file); });
|
|
66
|
+
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(sourcePath).then(function (files) {
|
|
67
|
+
return files.filter(function (file) { return !(0, utils_1.isTestFile)(file); });
|
|
68
68
|
})];
|
|
69
69
|
case 5:
|
|
70
70
|
sourceFiles = (_a.sent());
|
|
71
|
-
return [4 /*yield*/, utils_1.listFilesInFolder(destinationPath)];
|
|
71
|
+
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(destinationPath)];
|
|
72
72
|
case 6:
|
|
73
73
|
destinationFiles = (_a.sent());
|
|
74
74
|
areSubFoldersMatching = sourceSubFolders.every(function (subFolder) {
|
|
@@ -80,7 +80,7 @@ var compareFolders = function (sourcePath, destinationPath, exceptions) { return
|
|
|
80
80
|
missingSubFolders = sourceSubFolders.filter(function (subFolder) { return !destinationSubFolders.includes(subFolder); });
|
|
81
81
|
return [2 /*return*/, {
|
|
82
82
|
equal: false,
|
|
83
|
-
reason: "Subfolders missing from "
|
|
83
|
+
reason: "Subfolders missing from ".concat(destinationPath, ": ").concat(missingSubFolders.join(', '))
|
|
84
84
|
}];
|
|
85
85
|
}
|
|
86
86
|
areFilesMatching = sourceFiles.every(function (file) {
|
|
@@ -90,7 +90,7 @@ var compareFolders = function (sourcePath, destinationPath, exceptions) { return
|
|
|
90
90
|
missingFiles = sourceFiles.filter(function (file) { return !destinationFiles.includes(file); });
|
|
91
91
|
return [2 /*return*/, {
|
|
92
92
|
equal: false,
|
|
93
|
-
reason: "Files missing from "
|
|
93
|
+
reason: "Files missing from ".concat(destinationPath, ": ").concat(missingFiles.join(', '))
|
|
94
94
|
}];
|
|
95
95
|
}
|
|
96
96
|
return [2 /*return*/, {
|
|
@@ -45,11 +45,11 @@ function compileJobFile(target, filePath, macroFolders, programFolders, programV
|
|
|
45
45
|
var dependencies;
|
|
46
46
|
return __generator(this, function (_a) {
|
|
47
47
|
switch (_a.label) {
|
|
48
|
-
case 0: return [4 /*yield*/, loadDependencies_1.loadDependencies(target, filePath, macroFolders, programFolders, utils_1.isTestFile(filePath) ? utils_1.SASJsFileType.test : utils_1.SASJsFileType.job)];
|
|
48
|
+
case 0: return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, filePath, macroFolders, programFolders, (0, utils_1.isTestFile)(filePath) ? utils_1.SASJsFileType.test : utils_1.SASJsFileType.job)];
|
|
49
49
|
case 1:
|
|
50
50
|
dependencies = _a.sent();
|
|
51
|
-
dependencies = ""
|
|
52
|
-
return [4 /*yield*/, utils_1.createFile(filePath, dependencies)];
|
|
51
|
+
dependencies = "".concat(programVar ? programVar + '\n' : '').concat(dependencies);
|
|
52
|
+
return [4 /*yield*/, (0, utils_1.createFile)(filePath, dependencies)];
|
|
53
53
|
case 2:
|
|
54
54
|
_a.sent();
|
|
55
55
|
return [2 /*return*/];
|
|
@@ -49,17 +49,17 @@ function compileServiceFile(target, filePath, macroFolders, programFolders, prog
|
|
|
49
49
|
var dependencies, serverType, preCode;
|
|
50
50
|
return __generator(this, function (_a) {
|
|
51
51
|
switch (_a.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, loadDependencies_1.loadDependencies(target, filePath, macroFolders, programFolders, utils_1.isTestFile(filePath) ? types_1.SASJsFileType.test : types_1.SASJsFileType.service)];
|
|
52
|
+
case 0: return [4 /*yield*/, (0, loadDependencies_1.loadDependencies)(target, filePath, macroFolders, programFolders, (0, utils_1.isTestFile)(filePath) ? types_1.SASJsFileType.test : types_1.SASJsFileType.service)];
|
|
53
53
|
case 1:
|
|
54
54
|
dependencies = _a.sent();
|
|
55
|
-
return [4 /*yield*/, getServerType_1.getServerType(target)];
|
|
55
|
+
return [4 /*yield*/, (0, getServerType_1.getServerType)(target)];
|
|
56
56
|
case 2:
|
|
57
57
|
serverType = _a.sent();
|
|
58
58
|
return [4 /*yield*/, getPreCodeForServicePack(serverType)];
|
|
59
59
|
case 3:
|
|
60
60
|
preCode = _a.sent();
|
|
61
|
-
dependencies = programVar
|
|
62
|
-
return [4 /*yield*/, utils_1.createFile(filePath, dependencies)];
|
|
61
|
+
dependencies = "".concat(programVar, "\n").concat(preCode, "\n").concat(dependencies);
|
|
62
|
+
return [4 /*yield*/, (0, utils_1.createFile)(filePath, dependencies)];
|
|
63
63
|
case 4:
|
|
64
64
|
_a.sent();
|
|
65
65
|
return [2 /*return*/];
|
|
@@ -75,7 +75,7 @@ function getPreCodeForServicePack(serverType) {
|
|
|
75
75
|
switch (_l.label) {
|
|
76
76
|
case 0:
|
|
77
77
|
content = '';
|
|
78
|
-
macroCorePath = config_1.getMacroCorePath();
|
|
78
|
+
macroCorePath = (0, config_1.getMacroCorePath)();
|
|
79
79
|
_a = serverType;
|
|
80
80
|
switch (_a) {
|
|
81
81
|
case types_1.ServerType.SasViya: return [3 /*break*/, 1];
|
|
@@ -85,15 +85,15 @@ function getPreCodeForServicePack(serverType) {
|
|
|
85
85
|
return [3 /*break*/, 13];
|
|
86
86
|
case 1:
|
|
87
87
|
_b = content;
|
|
88
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
88
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/base/mf_getuser.sas"))];
|
|
89
89
|
case 2:
|
|
90
90
|
content = _b + _l.sent();
|
|
91
91
|
_c = content;
|
|
92
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
92
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/base/mp_jsonout.sas"))];
|
|
93
93
|
case 3:
|
|
94
94
|
content = _c + _l.sent();
|
|
95
95
|
_d = content;
|
|
96
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
96
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_webout.sas"))];
|
|
97
97
|
case 4:
|
|
98
98
|
content = _d + _l.sent();
|
|
99
99
|
content +=
|
|
@@ -110,15 +110,15 @@ function getPreCodeForServicePack(serverType) {
|
|
|
110
110
|
return [3 /*break*/, 14];
|
|
111
111
|
case 5:
|
|
112
112
|
_e = content;
|
|
113
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
113
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/base/mf_getuser.sas"))];
|
|
114
114
|
case 6:
|
|
115
115
|
content = _e + _l.sent();
|
|
116
116
|
_f = content;
|
|
117
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
117
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/base/mp_jsonout.sas"))];
|
|
118
118
|
case 7:
|
|
119
119
|
content = _f + _l.sent();
|
|
120
120
|
_g = content;
|
|
121
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
121
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/meta/mm_webout.sas"))];
|
|
122
122
|
case 8:
|
|
123
123
|
content = _g + _l.sent();
|
|
124
124
|
content +=
|
|
@@ -131,15 +131,15 @@ function getPreCodeForServicePack(serverType) {
|
|
|
131
131
|
return [3 /*break*/, 14];
|
|
132
132
|
case 9:
|
|
133
133
|
_h = content;
|
|
134
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
134
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/base/mf_getuser.sas"))];
|
|
135
135
|
case 10:
|
|
136
136
|
content = _h + _l.sent();
|
|
137
137
|
_j = content;
|
|
138
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
138
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/base/mp_jsonout.sas"))];
|
|
139
139
|
case 11:
|
|
140
140
|
content = _j + _l.sent();
|
|
141
141
|
_k = content;
|
|
142
|
-
return [4 /*yield*/, utils_1.readFile(macroCorePath
|
|
142
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/server/ms_webout.sas"))];
|
|
143
143
|
case 12:
|
|
144
144
|
content = _k + _l.sent();
|
|
145
145
|
content +=
|
|
@@ -51,10 +51,14 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
-
for (var i = 0,
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
58
62
|
};
|
|
59
63
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -84,33 +88,33 @@ function compileTestFile(target, filePath, testVar, saveToRoot, removeOriginalFi
|
|
|
84
88
|
case 0:
|
|
85
89
|
_a = loadDependencies_1.loadDependencies;
|
|
86
90
|
_b = [target,
|
|
87
|
-
utils_1.getAbsolutePath(filePath, process.projectDir)];
|
|
88
|
-
return [4 /*yield*/, config_1.getMacroFolders(target)];
|
|
91
|
+
(0, utils_1.getAbsolutePath)(filePath, process.projectDir)];
|
|
92
|
+
return [4 /*yield*/, (0, config_1.getMacroFolders)(target)];
|
|
89
93
|
case 1:
|
|
90
94
|
_b = _b.concat([_c.sent()]);
|
|
91
|
-
return [4 /*yield*/, config_1.getProgramFolders(target)];
|
|
95
|
+
return [4 /*yield*/, (0, config_1.getProgramFolders)(target)];
|
|
92
96
|
case 2: return [4 /*yield*/, _a.apply(void 0, _b.concat([_c.sent(), utils_1.SASJsFileType.test]))];
|
|
93
97
|
case 3:
|
|
94
98
|
dependencies = _c.sent();
|
|
95
|
-
return [4 /*yield*/, compileServiceFile_1.getPreCodeForServicePack(target.serverType)];
|
|
99
|
+
return [4 /*yield*/, (0, compileServiceFile_1.getPreCodeForServicePack)(target.serverType)];
|
|
96
100
|
case 4:
|
|
97
101
|
preCode = _c.sent();
|
|
98
|
-
dependencies = (testVar ? testVar + '\n' : ''
|
|
102
|
+
dependencies = "".concat(testVar ? testVar + '\n' : '', "\n").concat(preCode, "\n").concat(dependencies);
|
|
99
103
|
destinationPath = path_1.default.join(testsBuildFolder(), saveToRoot
|
|
100
104
|
? filePath.split(path_1.default.sep).pop() || ''
|
|
101
105
|
: filePath
|
|
102
106
|
.split(path_1.default.sep)
|
|
103
107
|
.reduce(function (acc, item, i, arr) {
|
|
104
108
|
return acc.length
|
|
105
|
-
? __spreadArray(__spreadArray([], __read(acc)), [item]) : arr[i - 1] === 'sasjsbuild'
|
|
106
|
-
? __spreadArray(__spreadArray([], __read(acc)), [item]) : acc;
|
|
109
|
+
? __spreadArray(__spreadArray([], __read(acc), false), [item], false) : arr[i - 1] === 'sasjsbuild'
|
|
110
|
+
? __spreadArray(__spreadArray([], __read(acc), false), [item], false) : acc;
|
|
107
111
|
}, [])
|
|
108
112
|
.join(path_1.default.sep));
|
|
109
|
-
return [4 /*yield*/, utils_1.createFile(destinationPath, dependencies)];
|
|
113
|
+
return [4 /*yield*/, (0, utils_1.createFile)(destinationPath, dependencies)];
|
|
110
114
|
case 5:
|
|
111
115
|
_c.sent();
|
|
112
116
|
if (!removeOriginalFile) return [3 /*break*/, 7];
|
|
113
|
-
return [4 /*yield*/, utils_1.deleteFile(filePath)];
|
|
117
|
+
return [4 /*yield*/, (0, utils_1.deleteFile)(filePath)];
|
|
114
118
|
case 6:
|
|
115
119
|
_c.sent();
|
|
116
120
|
_c.label = 7;
|
|
@@ -127,31 +131,31 @@ function moveTestFile(filePath) {
|
|
|
127
131
|
switch (_a.label) {
|
|
128
132
|
case 0:
|
|
129
133
|
fileName = filePath.split(path_1.default.sep).pop();
|
|
130
|
-
if (!utils_1.isTestFile(fileName))
|
|
134
|
+
if (!(0, utils_1.isTestFile)(fileName))
|
|
131
135
|
return [2 /*return*/];
|
|
132
136
|
destinationPath = filePath.replace('sasjsbuild', 'sasjsbuild/tests');
|
|
133
137
|
testDestinationFolder = destinationPath
|
|
134
138
|
.split(path_1.default.sep)
|
|
135
139
|
.slice(0, -1)
|
|
136
140
|
.join(path_1.default.sep);
|
|
137
|
-
return [4 /*yield*/, utils_1.folderExists(testDestinationFolder)];
|
|
141
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(testDestinationFolder)];
|
|
138
142
|
case 1:
|
|
139
143
|
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
140
|
-
return [4 /*yield*/, utils_1.createFolder(testDestinationFolder)];
|
|
144
|
+
return [4 /*yield*/, (0, utils_1.createFolder)(testDestinationFolder)];
|
|
141
145
|
case 2:
|
|
142
146
|
_a.sent();
|
|
143
147
|
_a.label = 3;
|
|
144
|
-
case 3: return [4 /*yield*/, utils_1.moveFile(filePath, destinationPath)];
|
|
148
|
+
case 3: return [4 /*yield*/, (0, utils_1.moveFile)(filePath, destinationPath)];
|
|
145
149
|
case 4:
|
|
146
150
|
_a.sent();
|
|
147
151
|
sourceFolder = filePath
|
|
148
152
|
.split(path_1.default.sep)
|
|
149
153
|
.slice(0, filePath.split(path_1.default.sep).length - 1)
|
|
150
154
|
.join(path_1.default.sep);
|
|
151
|
-
return [4 /*yield*/, utils_1.listFilesInFolder(sourceFolder)];
|
|
155
|
+
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(sourceFolder)];
|
|
152
156
|
case 5:
|
|
153
157
|
if (!((_a.sent()).length === 0)) return [3 /*break*/, 7];
|
|
154
|
-
return [4 /*yield*/, utils_1.deleteFolder(sourceFolder)];
|
|
158
|
+
return [4 /*yield*/, (0, utils_1.deleteFolder)(sourceFolder)];
|
|
155
159
|
case 6:
|
|
156
160
|
_a.sent();
|
|
157
161
|
_a.label = 7;
|
|
@@ -167,20 +171,20 @@ function copyTestMacroFiles(folderAbsolutePath) {
|
|
|
167
171
|
var _this = this;
|
|
168
172
|
return __generator(this, function (_a) {
|
|
169
173
|
switch (_a.label) {
|
|
170
|
-
case 0: return [4 /*yield*/, utils_1.listFilesAndSubFoldersInFolder(folderAbsolutePath)];
|
|
174
|
+
case 0: return [4 /*yield*/, (0, utils_1.listFilesAndSubFoldersInFolder)(folderAbsolutePath)];
|
|
171
175
|
case 1:
|
|
172
176
|
macroFiles = _a.sent();
|
|
173
177
|
macroTestFiles = macroFiles.filter(function (item) { return utils_1.testFileRegExp.test(item); });
|
|
174
|
-
return [4 /*yield*/, utils_1.asyncForEach(macroTestFiles, function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
178
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(macroTestFiles, function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
175
179
|
var destinationFile;
|
|
176
180
|
return __generator(this, function (_a) {
|
|
177
181
|
switch (_a.label) {
|
|
178
182
|
case 0:
|
|
179
183
|
destinationFile = path_1.default.join(testsBuildFolder(), 'macros', file);
|
|
180
|
-
return [4 /*yield*/, utils_1.fileExists(destinationFile)];
|
|
184
|
+
return [4 /*yield*/, (0, utils_1.fileExists)(destinationFile)];
|
|
181
185
|
case 1:
|
|
182
186
|
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
183
|
-
return [4 /*yield*/, utils_1.copy(path_1.default.join(folderAbsolutePath, file), destinationFile)];
|
|
187
|
+
return [4 /*yield*/, (0, utils_1.copy)(path_1.default.join(folderAbsolutePath, file), destinationFile)];
|
|
184
188
|
case 2:
|
|
185
189
|
_a.sent();
|
|
186
190
|
_a.label = 3;
|
|
@@ -203,10 +207,10 @@ var compileTestFlow = function (target) { return __awaiter(void 0, void 0, void
|
|
|
203
207
|
switch (_d.label) {
|
|
204
208
|
case 0:
|
|
205
209
|
_a = process.sasjsConstants, buildDestinationFolder = _a.buildDestinationFolder, buildDestinationTestFolder = _a.buildDestinationTestFolder;
|
|
206
|
-
return [4 /*yield*/, utils_1.folderExists(buildDestinationTestFolder)];
|
|
210
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(buildDestinationTestFolder)];
|
|
207
211
|
case 1:
|
|
208
212
|
if (!_d.sent()) return [3 /*break*/, 4];
|
|
209
|
-
return [4 /*yield*/, utils_1.listFilesAndSubFoldersInFolder(buildDestinationTestFolder)];
|
|
213
|
+
return [4 /*yield*/, (0, utils_1.listFilesAndSubFoldersInFolder)(buildDestinationTestFolder)];
|
|
210
214
|
case 2:
|
|
211
215
|
testFiles = (_d.sent()).map(function (file) { return path_1.default.join('tests', file); });
|
|
212
216
|
testFlow = { tests: [] };
|
|
@@ -256,16 +260,16 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
256
260
|
var files;
|
|
257
261
|
return __generator(this, function (_a) {
|
|
258
262
|
switch (_a.label) {
|
|
259
|
-
case 0: return [4 /*yield*/, utils_1.folderExists(folder)];
|
|
263
|
+
case 0: return [4 /*yield*/, (0, utils_1.folderExists)(folder)];
|
|
260
264
|
case 1:
|
|
261
265
|
if (!_a.sent()) return [3 /*break*/, 3];
|
|
262
|
-
return [4 /*yield*/, utils_1.listFilesAndSubFoldersInFolder(folder)];
|
|
266
|
+
return [4 /*yield*/, (0, utils_1.listFilesAndSubFoldersInFolder)(folder)];
|
|
263
267
|
case 2:
|
|
264
268
|
files = (_a.sent())
|
|
265
269
|
.filter(function (file) { return file_1.sasFileRegExp.test(file); })
|
|
266
270
|
.filter(filter)
|
|
267
271
|
.map(function (file) { return [type, file.split(path_1.default.sep).join('/')].join('/'); });
|
|
268
|
-
toCover = __spreadArray(__spreadArray([], __read(toCover)), __read(files));
|
|
272
|
+
toCover = __spreadArray(__spreadArray([], __read(toCover), false), __read(files), false);
|
|
269
273
|
files.forEach(function (file) {
|
|
270
274
|
var shouldBeCovered = ['tests', file.split(path_1.default.sep).join('/')]
|
|
271
275
|
.join('/')
|
|
@@ -302,10 +306,10 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
302
306
|
return [4 /*yield*/, collectCoverage(jobFolder, 'jobs')];
|
|
303
307
|
case 2:
|
|
304
308
|
_d.sent();
|
|
305
|
-
return [4 /*yield*/, config_1.getMacroFolders(target)];
|
|
309
|
+
return [4 /*yield*/, (0, config_1.getMacroFolders)(target)];
|
|
306
310
|
case 3:
|
|
307
311
|
macroFolders = _d.sent();
|
|
308
|
-
return [4 /*yield*/, utils_1.asyncForEach(macroFolders, function (macroFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
312
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(macroFolders, function (macroFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
309
313
|
return __generator(this, function (_a) {
|
|
310
314
|
switch (_a.label) {
|
|
311
315
|
case 0: return [4 /*yield*/, collectCoverage(macroFolder, 'macros', function (file) { return !utils_1.testFileRegExp.test(file); })];
|
|
@@ -318,7 +322,7 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
318
322
|
case 4:
|
|
319
323
|
_d.sent();
|
|
320
324
|
filter = function (files, type) {
|
|
321
|
-
return files.filter(function (file) { return new RegExp("^"
|
|
325
|
+
return files.filter(function (file) { return new RegExp("^".concat(type)).test(file); });
|
|
322
326
|
};
|
|
323
327
|
coverage = {};
|
|
324
328
|
notCovered = toCover.filter(function (tc) { return !covered.includes(tc); });
|
|
@@ -344,15 +348,15 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
344
348
|
macrosToCover = filter(toCover, types_1.CoverageType.macro);
|
|
345
349
|
notCoveredMacros = filter(notCovered, types_1.CoverageType.macro);
|
|
346
350
|
if (!notCoveredMacros.length) return [3 /*break*/, 6];
|
|
347
|
-
return [4 /*yield*/, utils_1.asyncForEach(macroFolders, function (macroFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
351
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(macroFolders, function (macroFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
348
352
|
var macros, macroTypeRegExp;
|
|
349
353
|
return __generator(this, function (_a) {
|
|
350
354
|
switch (_a.label) {
|
|
351
|
-
case 0: return [4 /*yield*/, utils_1.listFilesAndSubFoldersInFolder(macroFolder)];
|
|
352
|
-
case 1: return [4 /*yield*/, (_a.sent()).filter(function (file) { return !utils_1.isTestFile(file); })];
|
|
355
|
+
case 0: return [4 /*yield*/, (0, utils_1.listFilesAndSubFoldersInFolder)(macroFolder)];
|
|
356
|
+
case 1: return [4 /*yield*/, (_a.sent()).filter(function (file) { return !(0, utils_1.isTestFile)(file); })];
|
|
353
357
|
case 2:
|
|
354
358
|
macros = _a.sent();
|
|
355
|
-
macroTypeRegExp = new RegExp("^macros"
|
|
359
|
+
macroTypeRegExp = new RegExp("^macros".concat(utils_1.pathSepEscaped));
|
|
356
360
|
notCoveredMacros = notCoveredMacros.map(function (macro) {
|
|
357
361
|
return macros.includes(macro.replace(macroTypeRegExp, ''))
|
|
358
362
|
? macro.replace(macroTypeRegExp, macroFolder + path_1.default.sep)
|
|
@@ -384,7 +388,7 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
384
388
|
formatCoverage = function (type, covered, toCover) {
|
|
385
389
|
var _a;
|
|
386
390
|
return toCover.length
|
|
387
|
-
? (_a = process.logger) === null || _a === void 0 ? void 0 : _a.info(type
|
|
391
|
+
? (_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("".concat(type, " coverage: ").concat(covered.length, "/").concat(toCover.length, " (").concat(chalk_1.default.greenBright(calculateCoverage(covered.length, toCover.length)), ")"))
|
|
388
392
|
: null;
|
|
389
393
|
};
|
|
390
394
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info('Test coverage:');
|
|
@@ -400,7 +404,7 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
400
404
|
formatCoverage('Macros', coveredMacros, macrosToCover);
|
|
401
405
|
formatCoverage('Overall', covered, toCover);
|
|
402
406
|
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.log('');
|
|
403
|
-
return [4 /*yield*/, utils_1.createFile(path_1.default.join(buildDestinationFolder, 'testFlow.json'), JSON.stringify(testFlow, null, 2))];
|
|
407
|
+
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(buildDestinationFolder, 'testFlow.json'), JSON.stringify(testFlow, null, 2))];
|
|
404
408
|
case 7:
|
|
405
409
|
_d.sent();
|
|
406
410
|
return [2 /*return*/];
|