@sasjs/cli 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/add/addCredential.d.ts +6 -2
- package/build/commands/add/addCredential.js +79 -47
- package/build/commands/add/addTarget.js +32 -20
- package/build/commands/add/internal/input.d.ts +7 -0
- package/build/commands/add/internal/input.js +53 -8
- package/build/commands/add/spec/addTarget.spec.js +78 -0
- package/build/commands/build/build.js +11 -11
- package/build/commands/build/internal/config.d.ts +1 -1
- package/build/commands/build/internal/config.js +5 -6
- package/build/commands/compile/compile.js +4 -4
- package/build/commands/compile/compileCommand.js +2 -1
- package/build/commands/compile/compileSingleFile.d.ts +1 -1
- package/build/commands/compile/compileSingleFile.js +6 -7
- package/build/commands/compile/internal/compareFolders.js +1 -2
- package/build/commands/compile/internal/compileJobFile.js +1 -1
- package/build/commands/compile/internal/compileServiceFile.js +32 -16
- package/build/commands/compile/internal/compileTestFile.d.ts +0 -2
- package/build/commands/compile/internal/compileTestFile.js +11 -15
- package/build/commands/compile/internal/getAllJobFolders.js +1 -1
- package/build/commands/compile/internal/getAllServiceFolders.js +1 -1
- package/build/commands/compile/internal/loadDependencies.d.ts +2 -3
- package/build/commands/compile/internal/loadDependencies.js +43 -230
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +8 -8
- package/build/commands/compile/spec/compile.spec.js +30 -0
- package/build/commands/compile/spec/compileJobFile.spec.js +3 -3
- package/build/commands/compile/spec/compileServiceFile.spec.js +3 -3
- package/build/commands/compile/spec/loadDependencies.spec.js +37 -37
- package/build/commands/create/spec/reactAppFiles.js +5 -5
- package/build/commands/deploy/deploy.js +1 -1
- package/build/commands/deploy/spec/cbd.spec.js +19 -3
- package/build/commands/docs/generateDocs.js +4 -5
- package/build/commands/docs/internal/getFileInputs.d.ts +1 -1
- package/build/commands/docs/internal/getFileInputs.js +2 -2
- package/build/commands/docs/internal/getFileOutputs.d.ts +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +2 -2
- package/build/commands/docs/internal/getFoldersForDocs.d.ts +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +0 -6
- package/build/commands/job/internal/utils.js +6 -8
- package/build/commands/request/request.js +2 -2
- package/build/commands/run/run.js +1 -1
- package/build/commands/servicepack/deploy.js +1 -1
- package/build/commands/shared/fetchLogFileContent.js +6 -8
- package/build/commands/testing/test.js +1 -1
- package/build/commands/web/internal/getTags.d.ts +2 -1
- package/build/commands/web/internal/getTags.js +10 -12
- package/build/commands/web/internal/getWebServiceContent.js +1 -2
- 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.d.ts +4 -0
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +32 -0
- package/build/commands/web/internal/updateAllTags.js +33 -8
- package/build/commands/web/internal/updateLinkTag.d.ts +4 -0
- package/build/commands/web/internal/updateLinkTag.js +24 -0
- package/build/commands/web/web.js +12 -13
- package/build/utils/auth.d.ts +10 -4
- package/build/utils/auth.js +17 -15
- package/build/utils/config.d.ts +2 -3
- package/build/utils/config.js +14 -16
- package/build/utils/file.d.ts +0 -6
- package/build/utils/file.js +1 -43
- package/build/utils/setConstants.js +1 -1
- package/build/utils/spec/utils.spec.js +31 -5
- package/build/utils/utils.d.ts +0 -2
- package/build/utils/utils.js +2 -21
- package/package.json +8 -14
- package/CHANGELOG.md +0 -30
- package/build/commands/compile/internal/config.d.ts +0 -25
- package/build/commands/compile/internal/config.js +0 -259
- package/build/commands/compile/spec/getDependencyPaths.spec.d.ts +0 -1
- package/build/commands/compile/spec/getDependencyPaths.spec.js +0 -263
- package/build/commands/compile/spec/getProgramDependencies.spec.d.ts +0 -1
- package/build/commands/compile/spec/getProgramDependencies.spec.js +0 -403
- package/build/commands/shared/dependencies.d.ts +0 -12
- package/build/commands/shared/dependencies.js +0 -332
- package/build/commands/web/internal/updateLinkHref.d.ts +0 -4
- package/build/commands/web/internal/updateLinkHref.js +0 -18
- package/build/utils/spec/utils.spec.server.d.ts +0 -1
- package/build/utils/spec/utils.spec.server.js +0 -72
|
@@ -41,9 +41,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.getBuildTerm = exports.getBuildInit = void 0;
|
|
43
43
|
var path_1 = __importDefault(require("path"));
|
|
44
|
+
var utils_1 = require("@sasjs/utils");
|
|
44
45
|
var config_1 = require("../../../utils/config");
|
|
45
|
-
var utils_1 = require("../../../utils/utils");
|
|
46
|
-
var utils_2 = require("@sasjs/utils");
|
|
47
46
|
var getBuildInit = function (target) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
47
|
var buildSourceFolder, buildInitContent, configuration;
|
|
49
48
|
var _a, _b;
|
|
@@ -53,7 +52,7 @@ var getBuildInit = function (target) { return __awaiter(void 0, void 0, void 0,
|
|
|
53
52
|
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
54
53
|
buildInitContent = '';
|
|
55
54
|
if (!((_a = target === null || target === void 0 ? void 0 : target.buildConfig) === null || _a === void 0 ? void 0 : _a.initProgram)) return [3 /*break*/, 2];
|
|
56
|
-
return [4 /*yield*/,
|
|
55
|
+
return [4 /*yield*/, utils_1.readFile(utils_1.getAbsolutePath(target.buildConfig.initProgram, buildSourceFolder))];
|
|
57
56
|
case 1:
|
|
58
57
|
buildInitContent = _c.sent();
|
|
59
58
|
return [3 /*break*/, 5];
|
|
@@ -61,7 +60,7 @@ var getBuildInit = function (target) { return __awaiter(void 0, void 0, void 0,
|
|
|
61
60
|
case 3:
|
|
62
61
|
configuration = _c.sent();
|
|
63
62
|
if (!((_b = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _b === void 0 ? void 0 : _b.initProgram)) return [3 /*break*/, 5];
|
|
64
|
-
return [4 /*yield*/,
|
|
63
|
+
return [4 /*yield*/, utils_1.readFile(utils_1.getAbsolutePath(configuration.buildConfig.initProgram, buildSourceFolder))];
|
|
65
64
|
case 4:
|
|
66
65
|
buildInitContent = _c.sent();
|
|
67
66
|
_c.label = 5;
|
|
@@ -81,7 +80,7 @@ var getBuildTerm = function (target) { return __awaiter(void 0, void 0, void 0,
|
|
|
81
80
|
buildSourceFolder = process.sasjsConstants.buildSourceFolder;
|
|
82
81
|
buildTermContent = '';
|
|
83
82
|
if (!((_a = target === null || target === void 0 ? void 0 : target.buildConfig) === null || _a === void 0 ? void 0 : _a.termProgram)) return [3 /*break*/, 2];
|
|
84
|
-
return [4 /*yield*/,
|
|
83
|
+
return [4 /*yield*/, utils_1.readFile(utils_1.getAbsolutePath(target.buildConfig.termProgram, buildSourceFolder))];
|
|
85
84
|
case 1:
|
|
86
85
|
buildTermContent = _c.sent();
|
|
87
86
|
return [3 /*break*/, 5];
|
|
@@ -89,7 +88,7 @@ var getBuildTerm = function (target) { return __awaiter(void 0, void 0, void 0,
|
|
|
89
88
|
case 3:
|
|
90
89
|
configuration = _c.sent();
|
|
91
90
|
if (!((_b = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _b === void 0 ? void 0 : _b.termProgram)) return [3 /*break*/, 5];
|
|
92
|
-
return [4 /*yield*/,
|
|
91
|
+
return [4 /*yield*/, utils_1.readFile(utils_1.getAbsolutePath(configuration.buildConfig.termProgram, buildSourceFolder))];
|
|
93
92
|
case 4:
|
|
94
93
|
buildTermContent = _c.sent();
|
|
95
94
|
_c.label = 5;
|
|
@@ -338,7 +338,7 @@ var compileServiceFolder = function (target, serviceFolder, macroFolders, progra
|
|
|
338
338
|
switch (_a.label) {
|
|
339
339
|
case 0:
|
|
340
340
|
filePath = path_1.default.join(destinationPath, fileName);
|
|
341
|
-
if (!
|
|
341
|
+
if (!utils_1.isTestFile(filePath)) return [3 /*break*/, 2];
|
|
342
342
|
return [4 /*yield*/, compileTestFile_1.compileTestFile(target, filePath, '', false)];
|
|
343
343
|
case 1:
|
|
344
344
|
_a.sent();
|
|
@@ -366,7 +366,7 @@ var compileServiceFolder = function (target, serviceFolder, macroFolders, progra
|
|
|
366
366
|
switch (_a.label) {
|
|
367
367
|
case 0:
|
|
368
368
|
filePath = path_1.default.join(destinationPath, subFolder, fileName);
|
|
369
|
-
if (!
|
|
369
|
+
if (!utils_1.isTestFile(filePath)) return [3 /*break*/, 2];
|
|
370
370
|
return [4 /*yield*/, compileTestFile_1.compileTestFile(target, filePath, '', false)];
|
|
371
371
|
case 1:
|
|
372
372
|
_a.sent();
|
|
@@ -409,7 +409,7 @@ var compileJobFolder = function (target, jobFolder, macroFolders, programFolders
|
|
|
409
409
|
switch (_a.label) {
|
|
410
410
|
case 0:
|
|
411
411
|
filePath = path_1.default.join(destinationPath, fileName);
|
|
412
|
-
if (!
|
|
412
|
+
if (!utils_1.isTestFile(fileName)) return [3 /*break*/, 2];
|
|
413
413
|
return [4 /*yield*/, compileTestFile_1.compileTestFile(target, filePath, '', false)];
|
|
414
414
|
case 1:
|
|
415
415
|
_a.sent();
|
|
@@ -437,7 +437,7 @@ var compileJobFolder = function (target, jobFolder, macroFolders, programFolders
|
|
|
437
437
|
switch (_a.label) {
|
|
438
438
|
case 0:
|
|
439
439
|
filePath = path_1.default.join(destinationPath, subFolder, fileName);
|
|
440
|
-
if (!
|
|
440
|
+
if (!utils_1.isTestFile(filePath)) return [3 /*break*/, 2];
|
|
441
441
|
return [4 /*yield*/, compileTestFile_1.compileTestFile(target, filePath, '', false)];
|
|
442
442
|
case 1:
|
|
443
443
|
_a.sent();
|
|
@@ -62,6 +62,7 @@ var compile_1 = require("./compile");
|
|
|
62
62
|
var path_1 = __importDefault(require("path"));
|
|
63
63
|
var getDestinationPath_1 = require("./internal/getDestinationPath");
|
|
64
64
|
var compileSingleFile_1 = require("./compileSingleFile");
|
|
65
|
+
var utils_2 = require("@sasjs/utils");
|
|
65
66
|
var CompileSubCommand;
|
|
66
67
|
(function (CompileSubCommand) {
|
|
67
68
|
CompileSubCommand["Job"] = "job";
|
|
@@ -121,7 +122,7 @@ var CompileCommand = /** @class */ (function (_super) {
|
|
|
121
122
|
var internal = [value, this.subCommand + "s"];
|
|
122
123
|
if (leafFolderName)
|
|
123
124
|
internal.push(leafFolderName);
|
|
124
|
-
outputPath =
|
|
125
|
+
outputPath = utils_2.getAbsolutePath(internal.join(path_1.default.sep), process.currentDir);
|
|
125
126
|
}
|
|
126
127
|
else {
|
|
127
128
|
outputPath =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Target } from '@sasjs/utils
|
|
1
|
+
import { Target } from '@sasjs/utils';
|
|
2
2
|
export declare function compileSingleFile(target: Target, subCommand: string | undefined, source: string, output: string, insertProgramVar?: boolean): Promise<{
|
|
3
3
|
destinationPath: string;
|
|
4
4
|
}>;
|
|
@@ -42,8 +42,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.compileSingleFile = void 0;
|
|
43
43
|
var path_1 = __importDefault(require("path"));
|
|
44
44
|
var config_1 = require("../../utils/config");
|
|
45
|
-
var utils_1 = require("
|
|
46
|
-
var utils_2 = require("@sasjs/utils");
|
|
45
|
+
var utils_1 = require("@sasjs/utils");
|
|
47
46
|
var compileServiceFile_1 = require("./internal/compileServiceFile");
|
|
48
47
|
var compileJobFile_1 = require("./internal/compileJobFile");
|
|
49
48
|
var identifySasFile_1 = require("./internal/identifySasFile");
|
|
@@ -85,20 +84,20 @@ function compileSingleFile(target, subCommand, source, output, insertProgramVar)
|
|
|
85
84
|
leafFolderName = source.split(path_1.default.sep).pop();
|
|
86
85
|
outputPathParts.pop(), outputPathParts.pop();
|
|
87
86
|
parentOutputFolder = outputPathParts.join(path_1.default.sep);
|
|
88
|
-
return [4 /*yield*/,
|
|
87
|
+
return [4 /*yield*/, utils_1.fileExists(parentOutputFolder)];
|
|
89
88
|
case 4:
|
|
90
89
|
pathExists = _c.sent();
|
|
91
90
|
if (!pathExists) return [3 /*break*/, 6];
|
|
92
|
-
return [4 /*yield*/,
|
|
91
|
+
return [4 /*yield*/, utils_1.deleteFolder(parentOutputFolder)];
|
|
93
92
|
case 5:
|
|
94
93
|
_c.sent();
|
|
95
94
|
_c.label = 6;
|
|
96
|
-
case 6: return [4 /*yield*/,
|
|
95
|
+
case 6: return [4 /*yield*/, utils_1.createFolder(output)];
|
|
97
96
|
case 7:
|
|
98
97
|
_c.sent();
|
|
99
98
|
sourceFileName = sourcePath.split(path_1.default.sep).pop();
|
|
100
99
|
destinationPath = path_1.default.join(output, sourceFileName);
|
|
101
|
-
return [4 /*yield*/,
|
|
100
|
+
return [4 /*yield*/, utils_1.copy(sourcePath, destinationPath)];
|
|
102
101
|
case 8:
|
|
103
102
|
_c.sent();
|
|
104
103
|
sourceFileNameWithoutExt = sourceFileName.split('.')[0];
|
|
@@ -144,7 +143,7 @@ function validateSourcePath(path) {
|
|
|
144
143
|
isSourceFile = /\.sas$/i.test(path);
|
|
145
144
|
if (!isSourceFile)
|
|
146
145
|
return [2 /*return*/, false];
|
|
147
|
-
return [4 /*yield*/,
|
|
146
|
+
return [4 /*yield*/, utils_1.fileExists(path)];
|
|
148
147
|
case 1: return [2 /*return*/, _a.sent()];
|
|
149
148
|
}
|
|
150
149
|
});
|
|
@@ -38,7 +38,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.compareFolders = void 0;
|
|
40
40
|
var utils_1 = require("@sasjs/utils");
|
|
41
|
-
var compileTestFile_1 = require("./compileTestFile");
|
|
42
41
|
var compareFolders = function (sourcePath, destinationPath, exceptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
42
|
var sourcePathExists, destinationPathExists, sourceSubFolders, destinationSubFolders, sourceFiles, destinationFiles, areSubFoldersMatching, missingSubFolders, areFilesMatching, missingFiles;
|
|
44
43
|
return __generator(this, function (_a) {
|
|
@@ -65,7 +64,7 @@ var compareFolders = function (sourcePath, destinationPath, exceptions) { return
|
|
|
65
64
|
case 4:
|
|
66
65
|
destinationSubFolders = (_a.sent());
|
|
67
66
|
return [4 /*yield*/, utils_1.listFilesInFolder(sourcePath).then(function (files) {
|
|
68
|
-
return files.filter(function (file) { return !
|
|
67
|
+
return files.filter(function (file) { return !utils_1.isTestFile(file); });
|
|
69
68
|
})];
|
|
70
69
|
case 5:
|
|
71
70
|
sourceFiles = (_a.sent());
|
|
@@ -45,7 +45,7 @@ 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,
|
|
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)];
|
|
49
49
|
case 1:
|
|
50
50
|
dependencies = _a.sent();
|
|
51
51
|
dependencies = "" + (programVar ? programVar + '\n' : '') + dependencies;
|
|
@@ -43,14 +43,13 @@ var types_1 = require("@sasjs/utils/types");
|
|
|
43
43
|
var error_1 = require("@sasjs/utils/error");
|
|
44
44
|
var loadDependencies_1 = require("./loadDependencies");
|
|
45
45
|
var getServerType_1 = require("./getServerType");
|
|
46
|
-
var compileTestFile_1 = require("./compileTestFile");
|
|
47
46
|
function compileServiceFile(target, filePath, macroFolders, programFolders, programVar) {
|
|
48
47
|
if (programVar === void 0) { programVar = ''; }
|
|
49
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
50
49
|
var dependencies, serverType, preCode;
|
|
51
50
|
return __generator(this, function (_a) {
|
|
52
51
|
switch (_a.label) {
|
|
53
|
-
case 0: return [4 /*yield*/, loadDependencies_1.loadDependencies(target, filePath, macroFolders, programFolders,
|
|
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)];
|
|
54
53
|
case 1:
|
|
55
54
|
dependencies = _a.sent();
|
|
56
55
|
return [4 /*yield*/, getServerType_1.getServerType(target)];
|
|
@@ -71,9 +70,9 @@ function compileServiceFile(target, filePath, macroFolders, programFolders, prog
|
|
|
71
70
|
exports.compileServiceFile = compileServiceFile;
|
|
72
71
|
function getPreCodeForServicePack(serverType) {
|
|
73
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var content, macroCorePath, _a, _b, _c, _d, _e, _f, _g;
|
|
75
|
-
return __generator(this, function (
|
|
76
|
-
switch (
|
|
73
|
+
var content, macroCorePath, _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
74
|
+
return __generator(this, function (_l) {
|
|
75
|
+
switch (_l.label) {
|
|
77
76
|
case 0:
|
|
78
77
|
content = '';
|
|
79
78
|
macroCorePath = config_1.getMacroCorePath();
|
|
@@ -83,20 +82,20 @@ function getPreCodeForServicePack(serverType) {
|
|
|
83
82
|
case types_1.ServerType.Sas9: return [3 /*break*/, 5];
|
|
84
83
|
case types_1.ServerType.Sasjs: return [3 /*break*/, 9];
|
|
85
84
|
}
|
|
86
|
-
return [3 /*break*/,
|
|
85
|
+
return [3 /*break*/, 13];
|
|
87
86
|
case 1:
|
|
88
87
|
_b = content;
|
|
89
88
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
90
89
|
case 2:
|
|
91
|
-
content = _b +
|
|
90
|
+
content = _b + _l.sent();
|
|
92
91
|
_c = content;
|
|
93
92
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
94
93
|
case 3:
|
|
95
|
-
content = _c +
|
|
94
|
+
content = _c + _l.sent();
|
|
96
95
|
_d = content;
|
|
97
96
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/viya/mv_webout.sas")];
|
|
98
97
|
case 4:
|
|
99
|
-
content = _d +
|
|
98
|
+
content = _d + _l.sent();
|
|
100
99
|
content +=
|
|
101
100
|
'/* if calling viya service with _job param, _program will conflict */\n' +
|
|
102
101
|
'/* so we provide instead as __program */\n' +
|
|
@@ -105,28 +104,45 @@ function getPreCodeForServicePack(serverType) {
|
|
|
105
104
|
'%macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
106
105
|
'%mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
107
106
|
'%mend;\n';
|
|
108
|
-
return [3 /*break*/,
|
|
107
|
+
return [3 /*break*/, 14];
|
|
109
108
|
case 5:
|
|
110
109
|
_e = content;
|
|
111
110
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
112
111
|
case 6:
|
|
113
|
-
content = _e +
|
|
112
|
+
content = _e + _l.sent();
|
|
114
113
|
_f = content;
|
|
115
114
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
116
115
|
case 7:
|
|
117
|
-
content = _f +
|
|
116
|
+
content = _f + _l.sent();
|
|
118
117
|
_g = content;
|
|
119
118
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/meta/mm_webout.sas")];
|
|
120
119
|
case 8:
|
|
121
|
-
content = _g +
|
|
120
|
+
content = _g + _l.sent();
|
|
122
121
|
content +=
|
|
123
122
|
' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
124
123
|
' %mm_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
125
124
|
' %mend;\n';
|
|
126
|
-
return [3 /*break*/,
|
|
127
|
-
case 9:
|
|
128
|
-
|
|
125
|
+
return [3 /*break*/, 14];
|
|
126
|
+
case 9:
|
|
127
|
+
_h = content;
|
|
128
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mf_getuser.sas")];
|
|
129
|
+
case 10:
|
|
130
|
+
content = _h + _l.sent();
|
|
131
|
+
_j = content;
|
|
132
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/base/mp_jsonout.sas")];
|
|
129
133
|
case 11:
|
|
134
|
+
content = _j + _l.sent();
|
|
135
|
+
_k = content;
|
|
136
|
+
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/server/ms_webout.sas")];
|
|
137
|
+
case 12:
|
|
138
|
+
content = _k + _l.sent();
|
|
139
|
+
content +=
|
|
140
|
+
' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
141
|
+
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
142
|
+
' %mend;\n';
|
|
143
|
+
return [3 /*break*/, 14];
|
|
144
|
+
case 13: throw new error_1.ServerTypeError();
|
|
145
|
+
case 14:
|
|
130
146
|
content +=
|
|
131
147
|
'/* provide additional debug info */\n' +
|
|
132
148
|
'%global _program;\n' +
|
|
@@ -2,6 +2,4 @@ import { Target } from '@sasjs/utils';
|
|
|
2
2
|
export declare function compileTestFile(target: Target, filePath: string, testVar?: string, saveToRoot?: boolean, removeOriginalFile?: boolean): Promise<void>;
|
|
3
3
|
export declare function moveTestFile(filePath: string): Promise<void>;
|
|
4
4
|
export declare function copyTestMacroFiles(folderAbsolutePath: string): Promise<void>;
|
|
5
|
-
export declare const testFileRegExp: RegExp;
|
|
6
|
-
export declare const isTestFile: (fileName: string) => boolean;
|
|
7
5
|
export declare const compileTestFlow: (target: Target) => Promise<void>;
|
|
@@ -60,7 +60,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
60
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports.compileTestFlow = exports.
|
|
63
|
+
exports.compileTestFlow = exports.copyTestMacroFiles = exports.moveTestFile = exports.compileTestFile = void 0;
|
|
64
64
|
var types_1 = require("../../../types");
|
|
65
65
|
var path_1 = __importDefault(require("path"));
|
|
66
66
|
var utils_1 = require("@sasjs/utils");
|
|
@@ -69,9 +69,8 @@ var file_1 = require("../../../utils/file");
|
|
|
69
69
|
var chalk_1 = __importDefault(require("chalk"));
|
|
70
70
|
var config_1 = require("../../../utils/config");
|
|
71
71
|
var compileServiceFile_1 = require("./compileServiceFile");
|
|
72
|
-
var utils_2 = require("../../../utils/utils");
|
|
73
72
|
var testsBuildFolder = function () {
|
|
74
|
-
return path_1.default.join(process.
|
|
73
|
+
return path_1.default.join(process.projectDir, 'sasjsbuild', 'tests');
|
|
75
74
|
};
|
|
76
75
|
var getFileName = function (filePath) { return path_1.default.parse(filePath).base; };
|
|
77
76
|
function compileTestFile(target, filePath, testVar, saveToRoot, removeOriginalFile) {
|
|
@@ -85,12 +84,12 @@ function compileTestFile(target, filePath, testVar, saveToRoot, removeOriginalFi
|
|
|
85
84
|
case 0:
|
|
86
85
|
_a = loadDependencies_1.loadDependencies;
|
|
87
86
|
_b = [target,
|
|
88
|
-
|
|
87
|
+
utils_1.getAbsolutePath(filePath, process.projectDir)];
|
|
89
88
|
return [4 /*yield*/, config_1.getMacroFolders(target)];
|
|
90
89
|
case 1:
|
|
91
90
|
_b = _b.concat([_c.sent()]);
|
|
92
91
|
return [4 /*yield*/, config_1.getProgramFolders(target)];
|
|
93
|
-
case 2: return [4 /*yield*/, _a.apply(void 0, _b.concat([_c.sent(),
|
|
92
|
+
case 2: return [4 /*yield*/, _a.apply(void 0, _b.concat([_c.sent(), utils_1.SASJsFileType.test]))];
|
|
94
93
|
case 3:
|
|
95
94
|
dependencies = _c.sent();
|
|
96
95
|
return [4 /*yield*/, compileServiceFile_1.getPreCodeForServicePack(target.serverType)];
|
|
@@ -128,7 +127,7 @@ function moveTestFile(filePath) {
|
|
|
128
127
|
switch (_a.label) {
|
|
129
128
|
case 0:
|
|
130
129
|
fileName = filePath.split(path_1.default.sep).pop();
|
|
131
|
-
if (!
|
|
130
|
+
if (!utils_1.isTestFile(fileName))
|
|
132
131
|
return [2 /*return*/];
|
|
133
132
|
destinationPath = filePath.replace('sasjsbuild', 'sasjsbuild/tests');
|
|
134
133
|
testDestinationFolder = destinationPath
|
|
@@ -171,7 +170,7 @@ function copyTestMacroFiles(folderAbsolutePath) {
|
|
|
171
170
|
case 0: return [4 /*yield*/, utils_1.listFilesAndSubFoldersInFolder(folderAbsolutePath)];
|
|
172
171
|
case 1:
|
|
173
172
|
macroFiles = _a.sent();
|
|
174
|
-
macroTestFiles = macroFiles.filter(function (item) { return
|
|
173
|
+
macroTestFiles = macroFiles.filter(function (item) { return utils_1.testFileRegExp.test(item); });
|
|
175
174
|
return [4 /*yield*/, utils_1.asyncForEach(macroTestFiles, function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
176
175
|
var destinationFile;
|
|
177
176
|
return __generator(this, function (_a) {
|
|
@@ -197,9 +196,6 @@ function copyTestMacroFiles(folderAbsolutePath) {
|
|
|
197
196
|
});
|
|
198
197
|
}
|
|
199
198
|
exports.copyTestMacroFiles = copyTestMacroFiles;
|
|
200
|
-
exports.testFileRegExp = /\.test\.(\d+\.)?sas$/i;
|
|
201
|
-
var isTestFile = function (fileName) { return exports.testFileRegExp.test(fileName); };
|
|
202
|
-
exports.isTestFile = isTestFile;
|
|
203
199
|
var compileTestFlow = function (target) { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
200
|
var _a, buildDestinationFolder, buildDestinationTestFolder, testFiles, testFlow, testSetUp, testTearDown, testSetUpFileName_1, testTearDownFileName_1;
|
|
205
201
|
var _b, _c;
|
|
@@ -278,14 +274,14 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
278
274
|
shouldBeCovered = shouldBeCovered.split(path_1.default.sep).pop() || '';
|
|
279
275
|
}
|
|
280
276
|
if (testFlow.tests.find(function (testFile) {
|
|
281
|
-
var testCovering = testFile.replace(
|
|
277
|
+
var testCovering = testFile.replace(utils_1.testFileRegExp, '');
|
|
282
278
|
if (type === 'macros') {
|
|
283
279
|
testCovering = testCovering.split(path_1.default.sep).pop() || '';
|
|
284
280
|
}
|
|
285
281
|
if (testCovering === shouldBeCovered) {
|
|
286
282
|
extraTests = extraTests.filter(function (test) {
|
|
287
|
-
return test.replace(
|
|
288
|
-
testFile.replace(
|
|
283
|
+
return test.replace(utils_1.testFileRegExp, '') !==
|
|
284
|
+
testFile.replace(utils_1.testFileRegExp, '');
|
|
289
285
|
});
|
|
290
286
|
}
|
|
291
287
|
return testCovering === shouldBeCovered;
|
|
@@ -312,7 +308,7 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
312
308
|
return [4 /*yield*/, utils_1.asyncForEach(macroFolders, function (macroFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
309
|
return __generator(this, function (_a) {
|
|
314
310
|
switch (_a.label) {
|
|
315
|
-
case 0: return [4 /*yield*/, collectCoverage(macroFolder, 'macros', function (file) { return !
|
|
311
|
+
case 0: return [4 /*yield*/, collectCoverage(macroFolder, 'macros', function (file) { return !utils_1.testFileRegExp.test(file); })];
|
|
316
312
|
case 1:
|
|
317
313
|
_a.sent();
|
|
318
314
|
return [2 /*return*/];
|
|
@@ -353,7 +349,7 @@ var printTestCoverage = function (testFlow, buildDestinationFolder, target) { re
|
|
|
353
349
|
return __generator(this, function (_a) {
|
|
354
350
|
switch (_a.label) {
|
|
355
351
|
case 0: return [4 /*yield*/, utils_1.listFilesAndSubFoldersInFolder(macroFolder)];
|
|
356
|
-
case 1: return [4 /*yield*/, (_a.sent()).filter(function (file) { return !
|
|
352
|
+
case 1: return [4 /*yield*/, (_a.sent()).filter(function (file) { return !utils_1.isTestFile(file); })];
|
|
357
353
|
case 2:
|
|
358
354
|
macros = _a.sent();
|
|
359
355
|
macroTypeRegExp = new RegExp("^macros" + utils_1.pathSepEscaped);
|
|
@@ -58,8 +58,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
58
58
|
};
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
60
|
exports.getAllJobFolders = void 0;
|
|
61
|
+
var utils_1 = require("@sasjs/utils");
|
|
61
62
|
var config_1 = require("../../../utils/config");
|
|
62
|
-
var utils_1 = require("../../../utils/utils");
|
|
63
63
|
function getAllJobFolders(target) {
|
|
64
64
|
var _a, _b;
|
|
65
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -58,8 +58,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
58
58
|
};
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
60
|
exports.getAllServiceFolders = void 0;
|
|
61
|
+
var utils_1 = require("@sasjs/utils");
|
|
61
62
|
var config_1 = require("../../../utils/config");
|
|
62
|
-
var utils_1 = require("../../../utils/utils");
|
|
63
63
|
function getAllServiceFolders(target) {
|
|
64
64
|
var _a, _b;
|
|
65
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { Target } from '@sasjs/utils';
|
|
2
|
-
export declare function loadDependencies(target: Target, filePath: string, macroFolders: string[], programFolders: string[], type
|
|
3
|
-
export declare const getVars: (varType: 'service' | 'job' | 'test', target: Target) => Promise<string>;
|
|
1
|
+
import { Target, SASJsFileType } from '@sasjs/utils';
|
|
2
|
+
export declare function loadDependencies(target: Target, filePath: string, macroFolders: string[], programFolders: string[], type: SASJsFileType): Promise<string>;
|