@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.
@@ -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, _b, webSourcePathFull, indexHtmlPath, destinationPath, assetPathMap, indexHtml;
62
- return __generator(this, function (_c) {
63
- switch (_c.label) {
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 = _c.sent();
68
+ streamConfig = _d.sent();
69
69
  return [4 /*yield*/, validateStreamConfig(streamConfig)];
70
70
  case 2:
71
- _b = _c.sent(), webSourcePathFull = _b.webSourcePathFull, indexHtmlPath = _b.indexHtmlPath;
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
- _c.sent();
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
- _c.sent();
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 5:
86
- assetPathMap = _c.sent();
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 6:
89
- indexHtml = _c.sent();
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 7:
97
- _c.sent();
98
- if (!(target.serverType === utils_1.ServerType.SasViya)) return [3 /*break*/, 9];
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
- _c.sent();
107
- _c.label = 11;
108
- case 11: return [2 /*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 = "/**\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 <h4> SAS Macros </h4>\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);";
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 <h4> SAS Macros </h4>\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);";
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);");
@@ -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;
@@ -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.isWindows = 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;
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, exports.isWindows)() ? "sh ".concat(filePath) : "bash ".concat(filePath);
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.36.0",
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.8.8"
97
+ "version": "3.10.0"
98
98
  }