@sasjs/cli 3.8.8 → 3.10.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/build/build.js +33 -45
- package/build/commands/compile/compile.d.ts +2 -1
- package/build/commands/compile/compile.js +15 -12
- package/build/commands/compile/compileSingleFile.js +5 -3
- package/build/commands/compile/internal/compileJobFile.d.ts +2 -1
- package/build/commands/compile/internal/compileJobFile.js +2 -2
- package/build/commands/compile/internal/compileServiceFile.d.ts +2 -1
- package/build/commands/compile/internal/compileServiceFile.js +2 -2
- package/build/commands/compile/internal/compileTestFile.js +4 -2
- package/build/commands/compile/internal/loadDependencies.d.ts +3 -2
- package/build/commands/compile/internal/loadDependencies.js +37 -16
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +2 -2
- package/build/commands/compile/spec/compileJobFile.spec.js +6 -4
- package/build/commands/compile/spec/compileServiceFile.spec.js +6 -4
- package/build/commands/compile/spec/loadDependencies.spec.js +38 -32
- package/build/commands/deploy/deploy.js +44 -39
- package/build/commands/docs/generateDocs.js +3 -7
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/request/request.js +28 -4
- package/build/commands/web/web.js +34 -24
- package/build/utils/spec/removeComments.spec.d.ts +1 -1
- package/build/utils/spec/removeComments.spec.js +2 -1
- package/build/utils/utils.d.ts +0 -1
- package/build/utils/utils.js +2 -4
- package/package.json +2 -2
|
@@ -56,56 +56,66 @@ var exampleStreamConfig = {
|
|
|
56
56
|
streamServiceName: 'clickme'
|
|
57
57
|
};
|
|
58
58
|
function createWebAppServices(target) {
|
|
59
|
-
var _a;
|
|
59
|
+
var _a, _b;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var buildDestinationServicesFolder, streamConfig,
|
|
62
|
-
return __generator(this, function (
|
|
63
|
-
switch (
|
|
61
|
+
var buildDestinationServicesFolder, streamConfig, _c, webSourcePathFull, indexHtmlPath, destinationPath, assetPathMap, indexHtml;
|
|
62
|
+
return __generator(this, function (_d) {
|
|
63
|
+
switch (_d.label) {
|
|
64
64
|
case 0:
|
|
65
65
|
buildDestinationServicesFolder = process.sasjsConstants.buildDestinationServicesFolder;
|
|
66
66
|
return [4 /*yield*/, (0, config_1.getStreamConfig)(target)];
|
|
67
67
|
case 1:
|
|
68
|
-
streamConfig =
|
|
68
|
+
streamConfig = _d.sent();
|
|
69
69
|
return [4 /*yield*/, validateStreamConfig(streamConfig)];
|
|
70
70
|
case 2:
|
|
71
|
-
|
|
72
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Compiling web app services for target ".concat(target.name, "..."));
|
|
71
|
+
_c = _d.sent(), webSourcePathFull = _c.webSourcePathFull, indexHtmlPath = _c.indexHtmlPath;
|
|
73
72
|
return [4 /*yield*/, createBuildDestinationFolder()];
|
|
74
73
|
case 3:
|
|
75
|
-
|
|
74
|
+
_d.sent();
|
|
76
75
|
destinationPath = path_1.default.join(buildDestinationServicesFolder, streamConfig.streamWebFolder);
|
|
77
|
-
return [4 /*yield*/, createTargetDestinationFolder(destinationPath)
|
|
76
|
+
return [4 /*yield*/, createTargetDestinationFolder(destinationPath)
|
|
77
|
+
// For server type SASjs, just need to copy webSourcePath
|
|
78
|
+
// to streamWebFolder, no need to create service files.
|
|
79
|
+
];
|
|
78
80
|
case 4:
|
|
79
|
-
|
|
81
|
+
_d.sent();
|
|
82
|
+
if (!(target.serverType === utils_1.ServerType.Sasjs)) return [3 /*break*/, 6];
|
|
83
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Copying web app files for target ".concat(target.name, "..."));
|
|
84
|
+
return [4 /*yield*/, (0, utils_1.copy)(webSourcePathFull, destinationPath)];
|
|
85
|
+
case 5:
|
|
86
|
+
_d.sent();
|
|
87
|
+
return [2 /*return*/];
|
|
88
|
+
case 6:
|
|
89
|
+
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Compiling web app services for target ".concat(target.name, "..."));
|
|
80
90
|
return [4 /*yield*/, (0, createAssetServices_1.createAssetServices)(target, destinationPath, streamConfig).then(function (map) {
|
|
81
91
|
var indexHtmlIndex = map.findIndex(function (assetPath) { return assetPath.source === 'index.html'; });
|
|
82
92
|
map.splice(indexHtmlIndex, 1);
|
|
83
93
|
return map;
|
|
84
94
|
})];
|
|
85
|
-
case
|
|
86
|
-
assetPathMap =
|
|
95
|
+
case 7:
|
|
96
|
+
assetPathMap = _d.sent();
|
|
87
97
|
return [4 /*yield*/, (0, utils_1.readFile)(indexHtmlPath).then(function (content) { return new jsdom_1.default.JSDOM(content); })];
|
|
88
|
-
case
|
|
89
|
-
indexHtml =
|
|
98
|
+
case 8:
|
|
99
|
+
indexHtml = _d.sent();
|
|
90
100
|
return [4 /*yield*/, (0, updateAllTags_1.updateAllTags)(indexHtml, {
|
|
91
101
|
webSourcePathFull: webSourcePathFull,
|
|
92
102
|
destinationPath: destinationPath,
|
|
93
103
|
serverType: target.serverType,
|
|
94
104
|
assetPathMap: assetPathMap
|
|
95
105
|
})];
|
|
96
|
-
case
|
|
97
|
-
|
|
98
|
-
if (!(target.serverType === utils_1.ServerType.SasViya)) return [3 /*break*/,
|
|
106
|
+
case 9:
|
|
107
|
+
_d.sent();
|
|
108
|
+
if (!(target.serverType === utils_1.ServerType.SasViya)) return [3 /*break*/, 11];
|
|
99
109
|
indexHtml.window.document.body.innerHTML += adjustIframeScript_1.adjustIframeScript;
|
|
100
110
|
return [4 /*yield*/, createClickMeFile(indexHtml.serialize(), streamConfig.streamServiceName)];
|
|
101
|
-
case 8:
|
|
102
|
-
_c.sent();
|
|
103
|
-
return [3 /*break*/, 11];
|
|
104
|
-
case 9: return [4 /*yield*/, createClickMeService(indexHtml.serialize(), streamConfig.streamServiceName)];
|
|
105
111
|
case 10:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
case 11: return [
|
|
112
|
+
_d.sent();
|
|
113
|
+
return [3 /*break*/, 13];
|
|
114
|
+
case 11: return [4 /*yield*/, createClickMeService(indexHtml.serialize(), streamConfig.streamServiceName)];
|
|
115
|
+
case 12:
|
|
116
|
+
_d.sent();
|
|
117
|
+
_d.label = 13;
|
|
118
|
+
case 13: return [2 /*return*/];
|
|
109
119
|
}
|
|
110
120
|
});
|
|
111
121
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const sampleSasProgram
|
|
1
|
+
export declare const sampleSasProgram: string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sampleSasProgram = void 0;
|
|
4
4
|
var utils_1 = require("../utils");
|
|
5
|
+
var utils_2 = require("@sasjs/utils");
|
|
5
6
|
describe('removeComments', function () {
|
|
6
7
|
test('should remove block comment', function () {
|
|
7
8
|
var text = "/* test\n123\n456\n789 */";
|
|
@@ -43,4 +44,4 @@ describe('removeComments', function () {
|
|
|
43
44
|
expect((0, utils_1.removeComments)(text)).toEqual(text);
|
|
44
45
|
});
|
|
45
46
|
});
|
|
46
|
-
exports.sampleSasProgram = "/**\n @file mv_createfolder.sas\n @brief Creates a viya folder if that foloder does not already exist\n @details Expects oauth token in a global macro variable (default\n ACCESS_TOKEN).\n\n options mprint;\n %mv_createfolder(path=/Public)\n\n\n @param path= The full path of the folder to be created\n @param access_token_var= The global macro variable to contain the access token\n @param grant_type= valid values are \"password\" or \"authorization_code\" (unquoted).\n The default is authorization_code.\n\n\n @version VIYA V.03.04\n @author Allan Bowe\n @source https://github.com/sasjs/core\n\n
|
|
47
|
+
exports.sampleSasProgram = "/**\n @file mv_createfolder.sas\n @brief Creates a viya folder if that foloder does not already exist\n @details Expects oauth token in a global macro variable (default\n ACCESS_TOKEN).\n\n options mprint;\n %mv_createfolder(path=/Public)\n\n\n @param path= The full path of the folder to be created\n @param access_token_var= The global macro variable to contain the access token\n @param grant_type= valid values are \"password\" or \"authorization_code\" (unquoted).\n The default is authorization_code.\n\n\n @version VIYA V.03.04\n @author Allan Bowe\n @source https://github.com/sasjs/core\n\n ".concat(utils_2.DependencyHeader.Macro, "\n @li mf_abort.sas\n @li mf_getuniquefileref.sas\n @li mf_getuniquelibref.sas\n @li mf_isblank.sas\n\n**/\n\n/* This is a comment\nthat spans\nmultiple lines */\n\n%macro mv_createfolder(path=\n ,access_token_var=ACCESS_TOKEN\n ,grant_type=authorization_code\n);");
|
package/build/utils/utils.d.ts
CHANGED
|
@@ -34,5 +34,4 @@ export declare function getAdapterInstance(target: Target): SASjs;
|
|
|
34
34
|
export declare function displaySasjsRunnerError(username: string): void;
|
|
35
35
|
export declare const loadEnvVariables: (fileName: string) => Promise<void>;
|
|
36
36
|
export declare function prefixAppLoc(appLoc?: string, path?: string): string | null;
|
|
37
|
-
export declare const isWindows: () => boolean;
|
|
38
37
|
export declare const terminateProcess: (status: number) => never;
|
package/build/utils/utils.js
CHANGED
|
@@ -86,7 +86,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
86
86
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
87
87
|
};
|
|
88
88
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
|
-
exports.terminateProcess = exports.
|
|
89
|
+
exports.terminateProcess = exports.prefixAppLoc = exports.loadEnvVariables = exports.displaySasjsRunnerError = exports.getAdapterInstance = exports.checkNodeVersion = exports.millisecondsToDdHhMmSs = exports.arrToObj = exports.parseLogLines = exports.executeShellScript = exports.getUniqServicesObj = exports.removeComments = exports.setupDoxygen = exports.setupGhooks = exports.setupGitIgnore = exports.setupNpmProject = exports.createTemplateApp = exports.createMinimalApp = exports.createAngularApp = exports.createReactApp = exports.diff = exports.inExistingProject = void 0;
|
|
90
90
|
var shelljs_1 = __importDefault(require("shelljs"));
|
|
91
91
|
var path_1 = __importDefault(require("path"));
|
|
92
92
|
var ora_1 = __importDefault(require("ora"));
|
|
@@ -414,7 +414,7 @@ function executeShellScript(filePath, logFilePath) {
|
|
|
414
414
|
return __generator(this, function (_b) {
|
|
415
415
|
switch (_b.label) {
|
|
416
416
|
case 0:
|
|
417
|
-
shellCommand = (0,
|
|
417
|
+
shellCommand = (0, utils_1.isWindows)() ? "sh ".concat(filePath) : "bash ".concat(filePath);
|
|
418
418
|
result = shelljs_1.default.exec(shellCommand, { silent: true });
|
|
419
419
|
if (!result.code) return [3 /*break*/, 1];
|
|
420
420
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error("Error: ".concat(result.stderr));
|
|
@@ -555,8 +555,6 @@ function prefixAppLoc(appLoc, path) {
|
|
|
555
555
|
.join(' ');
|
|
556
556
|
}
|
|
557
557
|
exports.prefixAppLoc = prefixAppLoc;
|
|
558
|
-
var isWindows = function () { return process.platform === 'win32'; };
|
|
559
|
-
exports.isWindows = isWindows;
|
|
560
558
|
var terminateProcess = function (status) {
|
|
561
559
|
var _a;
|
|
562
560
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Process will be terminated with the status code ".concat(status, "."));
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@sasjs/adapter": "^3.7.14",
|
|
51
51
|
"@sasjs/core": "4.15.3",
|
|
52
52
|
"@sasjs/lint": "1.11.2",
|
|
53
|
-
"@sasjs/utils": "2.
|
|
53
|
+
"@sasjs/utils": "2.38.1",
|
|
54
54
|
"chalk": "4.1.2",
|
|
55
55
|
"csv-stringify": "5.6.5",
|
|
56
56
|
"dotenv": "10.0.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typescript": "4.5.4",
|
|
95
95
|
"util": "0.12.4"
|
|
96
96
|
},
|
|
97
|
-
"version": "3.
|
|
97
|
+
"version": "3.10.0"
|
|
98
98
|
}
|