@sasjs/cli 4.0.4 → 4.0.6

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.
Files changed (43) hide show
  1. package/build/cli.js +2 -5
  2. package/build/commands/add/spec/addCommand.spec.js +7 -0
  3. package/build/commands/build/build.d.ts +1 -1
  4. package/build/commands/build/build.js +9 -14
  5. package/build/commands/build/internal/config.js +14 -21
  6. package/build/commands/build/spec/buildCommand.spec.js +8 -1
  7. package/build/commands/build/spec/compileBuildCommand.spec.js +8 -1
  8. package/build/commands/compile/compile.js +22 -24
  9. package/build/commands/compile/internal/compileTestFile.d.ts +1 -1
  10. package/build/commands/compile/internal/compileTestFile.js +16 -24
  11. package/build/commands/compile/internal/getAllFolders.d.ts +1 -1
  12. package/build/commands/compile/internal/getAllFolders.js +28 -40
  13. package/build/commands/compile/internal/getServerType.js +6 -12
  14. package/build/commands/compile/internal/loadDependencies.d.ts +1 -1
  15. package/build/commands/compile/internal/loadDependencies.js +6 -7
  16. package/build/commands/compile/internal/spec/getAllFolders.spec.js +1 -1
  17. package/build/commands/compile/spec/compile.spec.js +43 -29
  18. package/build/commands/compile/spec/compileCommand.spec.js +11 -3
  19. package/build/commands/compile/spec/loadDependencies.spec.js +11 -6
  20. package/build/commands/context/spec/contextCommand.spec.js +8 -0
  21. package/build/commands/deploy/internal/getDeployScripts.js +4 -15
  22. package/build/commands/deploy/spec/cbd.spec.js +26 -22
  23. package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +9 -2
  24. package/build/commands/deploy/spec/deployCommand.spec.js +7 -0
  25. package/build/commands/docs/docsCommand.js +4 -9
  26. package/build/commands/docs/spec/docsCommand.spec.js +4 -0
  27. package/build/commands/flow/spec/flowCommand.spec.js +7 -11
  28. package/build/commands/folder/spec/folderCommand.spec.js +7 -0
  29. package/build/commands/fs/spec/fsCommand.spec.js +19 -22
  30. package/build/commands/job/spec/jobCommand.spec.js +6 -0
  31. package/build/commands/request/spec/requestCommand.spec.js +7 -11
  32. package/build/commands/run/spec/runCommand.spec.js +7 -11
  33. package/build/commands/servicepack/spec/servicepackCommand.spec.js +7 -11
  34. package/build/commands/testing/spec/testCommand.spec.js +7 -11
  35. package/build/commands/web/spec/web.spec.js +12 -7
  36. package/build/commands/web/spec/webCommand.spec.js +8 -1
  37. package/build/types/command/targetCommand.js +25 -5
  38. package/build/utils/config.js +60 -74
  39. package/build/utils/setConstants.d.ts +2 -3
  40. package/build/utils/setConstants.js +55 -77
  41. package/build/utils/spec/setConstants.spec.js +1 -1
  42. package/build/utils/test.js +32 -17
  43. package/package.json +1 -1
@@ -39,86 +39,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.updateSasjsConstants = exports.setConstants = exports.contextName = void 0;
42
+ exports.setConstants = exports.contextName = void 0;
43
43
  var path_1 = __importDefault(require("path"));
44
- var config_1 = require("./config");
45
44
  var utils_1 = require("./utils");
46
45
  var utils_2 = require("@sasjs/utils");
47
46
  exports.contextName = 'sasjs cli compute context';
48
- var setConstants = function () { return __awaiter(void 0, void 0, void 0, function () {
49
- var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError, sas9GUID;
50
- return __generator(this, function (_b) {
51
- switch (_b.label) {
52
- case 0: return [4 /*yield*/, (0, config_1.getLocalOrGlobalConfig)().catch(function () { return ({
53
- configuration: null,
54
- isLocal: false
55
- }); })];
56
- case 1:
57
- _a = _b.sent(), configuration = _a.configuration, isLocal = _a.isLocal;
58
- buildOutputFolder = (configuration === null || configuration === void 0 ? void 0 : configuration.sasjsBuildFolder) ||
59
- (isLocal ? 'sasjsbuild' : '.sasjs/sasjsbuild');
60
- buildResultsFolder = (configuration === null || configuration === void 0 ? void 0 : configuration.sasjsResultsFolder) ||
61
- (isLocal ? 'sasjsresults' : '.sasjs/sasjsresults');
62
- homeDir = require('os').homedir();
63
- buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
64
- buildSourceDbFolder = path_1.default.join(isLocal ? process.projectDir : homeDir, 'sasjs', 'db');
65
- buildDestinationFolder = (0, utils_2.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
66
- buildDestinationServicesFolder = path_1.default.join(buildDestinationFolder, 'services');
67
- buildDestinationTestFolder = path_1.default.join(buildDestinationFolder, 'tests');
68
- buildDestinationJobsFolder = path_1.default.join(buildDestinationFolder, 'jobs');
69
- buildDestinationDbFolder = path_1.default.join(buildDestinationFolder, 'db');
70
- buildDestinationDocsFolder = path_1.default.join(buildDestinationFolder, 'docs');
71
- return [4 /*yield*/, (0, utils_1.getNodeModulePath)('@sasjs/core')];
72
- case 2:
73
- macroCorePath = _b.sent();
74
- buildDestinationResultsFolder = (0, utils_2.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
75
- buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
76
- sas9CredentialsError = 'The following attributes were not found:' +
77
- '\n* SAS_USERNAME' +
78
- '\n* SAS_PASSWORD' +
79
- '\nPlease run "sasjs auth" for your specified target to apply the correct credentials.';
80
- invalidSasError = 'Url specified does not contain a valid sas program. Please provide valid url.';
81
- sas9GUID = 'pZKd6F95jECvRQlN0LCfdA==';
82
- process.sasjsConstants = {
83
- buildSourceFolder: buildSourceFolder,
84
- buildSourceDbFolder: buildSourceDbFolder,
85
- buildDestinationFolder: buildDestinationFolder,
86
- buildDestinationServicesFolder: buildDestinationServicesFolder,
87
- buildDestinationJobsFolder: buildDestinationJobsFolder,
88
- buildDestinationDbFolder: buildDestinationDbFolder,
89
- buildDestinationDocsFolder: buildDestinationDocsFolder,
90
- buildDestinationResultsFolder: buildDestinationResultsFolder,
91
- buildDestinationResultsLogsFolder: buildDestinationResultsLogsFolder,
92
- buildDestinationTestFolder: buildDestinationTestFolder,
93
- macroCorePath: macroCorePath,
94
- contextName: exports.contextName,
95
- sas9CredentialsError: sas9CredentialsError,
96
- invalidSasError: invalidSasError,
97
- sas9GUID: sas9GUID
98
- };
99
- return [2 /*return*/];
100
- }
47
+ var setConstants = function (isLocal, target, configuration) {
48
+ if (isLocal === void 0) { isLocal = true; }
49
+ return __awaiter(void 0, void 0, void 0, function () {
50
+ var buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError, sas9GUID;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0:
54
+ buildOutputFolder = (target === null || target === void 0 ? void 0 : target.sasjsBuildFolder) ||
55
+ (configuration === null || configuration === void 0 ? void 0 : configuration.sasjsBuildFolder) ||
56
+ (isLocal ? 'sasjsbuild' : '.sasjs/sasjsbuild');
57
+ buildResultsFolder = (target === null || target === void 0 ? void 0 : target.sasjsResultsFolder) ||
58
+ (configuration === null || configuration === void 0 ? void 0 : configuration.sasjsResultsFolder) ||
59
+ (isLocal ? 'sasjsresults' : '.sasjs/sasjsresults');
60
+ homeDir = require('os').homedir();
61
+ buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
62
+ buildSourceDbFolder = path_1.default.join(isLocal ? process.projectDir : homeDir, 'sasjs', 'db');
63
+ buildDestinationFolder = (0, utils_2.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
64
+ buildDestinationServicesFolder = path_1.default.join(buildDestinationFolder, 'services');
65
+ buildDestinationTestFolder = path_1.default.join(buildDestinationFolder, 'tests');
66
+ buildDestinationJobsFolder = path_1.default.join(buildDestinationFolder, 'jobs');
67
+ buildDestinationDbFolder = path_1.default.join(buildDestinationFolder, 'db');
68
+ buildDestinationDocsFolder = path_1.default.join(buildDestinationFolder, 'docs');
69
+ return [4 /*yield*/, (0, utils_1.getNodeModulePath)('@sasjs/core')];
70
+ case 1:
71
+ macroCorePath = _a.sent();
72
+ buildDestinationResultsFolder = (0, utils_2.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
73
+ buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
74
+ sas9CredentialsError = 'The following attributes were not found:' +
75
+ '\n* SAS_USERNAME' +
76
+ '\n* SAS_PASSWORD' +
77
+ '\nPlease run "sasjs auth" for your specified target to apply the correct credentials.';
78
+ invalidSasError = 'Url specified does not contain a valid sas program. Please provide valid url.';
79
+ sas9GUID = 'pZKd6F95jECvRQlN0LCfdA==';
80
+ process.sasjsConstants = {
81
+ buildSourceFolder: buildSourceFolder,
82
+ buildSourceDbFolder: buildSourceDbFolder,
83
+ buildDestinationFolder: buildDestinationFolder,
84
+ buildDestinationServicesFolder: buildDestinationServicesFolder,
85
+ buildDestinationJobsFolder: buildDestinationJobsFolder,
86
+ buildDestinationDbFolder: buildDestinationDbFolder,
87
+ buildDestinationDocsFolder: buildDestinationDocsFolder,
88
+ buildDestinationResultsFolder: buildDestinationResultsFolder,
89
+ buildDestinationResultsLogsFolder: buildDestinationResultsLogsFolder,
90
+ buildDestinationTestFolder: buildDestinationTestFolder,
91
+ macroCorePath: macroCorePath,
92
+ contextName: exports.contextName,
93
+ sas9CredentialsError: sas9CredentialsError,
94
+ invalidSasError: invalidSasError,
95
+ sas9GUID: sas9GUID
96
+ };
97
+ return [2 /*return*/];
98
+ }
99
+ });
101
100
  });
102
- }); };
103
- exports.setConstants = setConstants;
104
- var updateSasjsConstants = function (target, isLocal) {
105
- var homeDir = require('os').homedir();
106
- if (target.sasjsBuildFolder) {
107
- var buildOutputFolder = target.sasjsBuildFolder;
108
- var buildDestinationFolder = (0, utils_2.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
109
- process.sasjsConstants.buildDestinationFolder = buildDestinationFolder;
110
- process.sasjsConstants.buildDestinationServicesFolder = path_1.default.join(buildDestinationFolder, 'services');
111
- process.sasjsConstants.buildDestinationTestFolder = path_1.default.join(buildDestinationFolder, 'tests');
112
- process.sasjsConstants.buildDestinationJobsFolder = path_1.default.join(buildDestinationFolder, 'jobs');
113
- process.sasjsConstants.buildDestinationDbFolder = path_1.default.join(buildDestinationFolder, 'db');
114
- process.sasjsConstants.buildDestinationDocsFolder = path_1.default.join(buildDestinationFolder, 'docs');
115
- }
116
- if (target.sasjsResultsFolder) {
117
- var buildResultsFolder = target.sasjsResultsFolder;
118
- var buildDestinationResultsFolder = (0, utils_2.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
119
- process.sasjsConstants.buildDestinationResultsFolder =
120
- buildDestinationResultsFolder;
121
- process.sasjsConstants.buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
122
- }
123
101
  };
124
- exports.updateSasjsConstants = updateSasjsConstants;
102
+ exports.setConstants = setConstants;
@@ -157,7 +157,7 @@ describe('setConstants', function () {
157
157
  })];
158
158
  });
159
159
  }); });
160
- return [4 /*yield*/, (0, setConstants_1.setConstants)()];
160
+ return [4 /*yield*/, (0, setConstants_1.setConstants)(false)];
161
161
  case 1:
162
162
  _a.sent();
163
163
  verifySasjsConstants(undefined, false, false);
@@ -66,57 +66,72 @@ var create_1 = require("../commands/create/create");
66
66
  var setConstants_1 = require("./setConstants");
67
67
  var node_1 = __importDefault(require("@sasjs/adapter/node"));
68
68
  var createTestApp = function (parentFolder, appName) { return __awaiter(void 0, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- switch (_a.label) {
69
+ var _a;
70
+ return __generator(this, function (_b) {
71
+ switch (_b.label) {
71
72
  case 0:
72
73
  process.projectDir = parentFolder;
73
74
  return [4 /*yield*/, (0, create_1.create)(appName, '')];
74
75
  case 1:
75
- _a.sent();
76
+ _b.sent();
76
77
  process.projectDir = path_1.default.join(parentFolder, appName);
77
78
  process.currentDir = process.projectDir;
78
- return [4 /*yield*/, (0, setConstants_1.setConstants)()];
79
+ _a = process;
80
+ return [4 /*yield*/, (0, config_1.getLocalConfig)()];
79
81
  case 2:
80
- _a.sent();
82
+ _a.sasjsConfig = _b.sent();
83
+ return [4 /*yield*/, (0, setConstants_1.setConstants)()];
84
+ case 3:
85
+ _b.sent();
81
86
  return [2 /*return*/];
82
87
  }
83
88
  });
84
89
  }); };
85
90
  exports.createTestApp = createTestApp;
86
91
  var createTestJobsApp = function (parentFolder, appName) { return __awaiter(void 0, void 0, void 0, function () {
87
- return __generator(this, function (_a) {
88
- switch (_a.label) {
92
+ var _a;
93
+ return __generator(this, function (_b) {
94
+ switch (_b.label) {
89
95
  case 0:
90
96
  process.projectDir = parentFolder;
91
97
  return [4 /*yield*/, (0, create_1.create)(appName, 'jobs')];
92
98
  case 1:
93
- _a.sent();
99
+ _b.sent();
94
100
  process.projectDir = path_1.default.join(parentFolder, appName);
95
101
  process.currentDir = process.projectDir;
96
- return [4 /*yield*/, (0, setConstants_1.setConstants)()];
102
+ _a = process;
103
+ return [4 /*yield*/, (0, config_1.getLocalConfig)()];
97
104
  case 2:
98
- _a.sent();
99
- return [4 /*yield*/, (0, exports.updateTarget)({ serverUrl: 'https://example.com' }, 'viya')];
105
+ _a.sasjsConfig = _b.sent();
106
+ return [4 /*yield*/, (0, setConstants_1.setConstants)()];
100
107
  case 3:
101
- _a.sent();
108
+ _b.sent();
109
+ return [4 /*yield*/, (0, exports.updateTarget)({ serverUrl: 'https://example.com' }, 'viya')];
110
+ case 4:
111
+ _b.sent();
102
112
  return [2 /*return*/];
103
113
  }
104
114
  });
105
115
  }); };
106
116
  exports.createTestJobsApp = createTestJobsApp;
107
117
  var createTestMinimalApp = function (parentFolder, appName) { return __awaiter(void 0, void 0, void 0, function () {
108
- return __generator(this, function (_a) {
109
- switch (_a.label) {
118
+ var _a;
119
+ return __generator(this, function (_b) {
120
+ switch (_b.label) {
110
121
  case 0:
111
122
  process.projectDir = parentFolder;
112
123
  return [4 /*yield*/, (0, create_1.create)(appName, 'minimal')];
113
124
  case 1:
114
- _a.sent();
125
+ _b.sent();
115
126
  process.projectDir = path_1.default.join(parentFolder, appName);
116
127
  process.currentDir = process.projectDir;
117
- return [4 /*yield*/, (0, setConstants_1.setConstants)()];
128
+ _a = process;
129
+ return [4 /*yield*/, (0, config_1.getLocalConfig)()];
118
130
  case 2:
119
- _a.sent();
131
+ _a.sasjsConfig = _b.sent();
132
+ return [4 /*yield*/, (0, setConstants_1.setConstants)()];
133
+ case 3:
134
+ _b.sent();
120
135
  return [2 /*return*/];
121
136
  }
122
137
  });
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "typescript": "4.9.5",
103
103
  "util": "0.12.4"
104
104
  },
105
- "version": "4.0.4"
105
+ "version": "4.0.6"
106
106
  }