@sasjs/cli 3.28.0 → 4.0.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.
|
@@ -441,7 +441,6 @@ describe('sasjs compile single file', function () {
|
|
|
441
441
|
});
|
|
442
442
|
});
|
|
443
443
|
var defaultBuildConfig = {
|
|
444
|
-
buildOutputFolder: '.sasjs/sasjsbuild',
|
|
445
444
|
buildOutputFileName: 'test.sas',
|
|
446
445
|
initProgram: '',
|
|
447
446
|
termProgram: '',
|
|
@@ -655,7 +654,8 @@ describe('sasjs compile outside project', function () {
|
|
|
655
654
|
destinationPath = path_1.default.join(buildOutputFolder, 'services', 'services', 'example1.sas');
|
|
656
655
|
parentOutputFolder = path_1.default.join(__dirname, 'random-folder');
|
|
657
656
|
return [4 /*yield*/, (0, test_1.updateConfig)({
|
|
658
|
-
|
|
657
|
+
sasjsBuildFolder: buildOutputFolder,
|
|
658
|
+
buildConfig: defaultBuildConfig
|
|
659
659
|
}, false)];
|
|
660
660
|
case 1:
|
|
661
661
|
_a.sent();
|
|
@@ -705,7 +705,8 @@ describe('sasjs compile outside project', function () {
|
|
|
705
705
|
destinationPath = path_1.default.join(buildOutputFolder, 'services', 'services', 'example1.sas');
|
|
706
706
|
parentOutputFolder = path_1.default.join(homedir, appName);
|
|
707
707
|
return [4 /*yield*/, (0, test_1.updateConfig)({
|
|
708
|
-
|
|
708
|
+
sasjsBuildFolder: appName + '/random-folder',
|
|
709
|
+
buildConfig: defaultBuildConfig
|
|
709
710
|
}, false)];
|
|
710
711
|
case 1:
|
|
711
712
|
_a.sent();
|
|
@@ -261,13 +261,18 @@ var FSCommand = /** @class */ (function (_super) {
|
|
|
261
261
|
var folderPath, outputPath, programContent;
|
|
262
262
|
return __generator(this, function (_a) {
|
|
263
263
|
switch (_a.label) {
|
|
264
|
-
case 0:
|
|
264
|
+
case 0:
|
|
265
|
+
// NOTE: call getTargetInfo() method once, so that process.sasjsConstants could be updated based on target config
|
|
266
|
+
return [4 /*yield*/, this.getTargetInfo()];
|
|
267
|
+
case 1:
|
|
268
|
+
// NOTE: call getTargetInfo() method once, so that process.sasjsConstants could be updated based on target config
|
|
269
|
+
_a.sent();
|
|
265
270
|
folderPath = this.localFolder;
|
|
266
271
|
return [4 /*yield*/, this.getOutputPath()];
|
|
267
|
-
case
|
|
272
|
+
case 2:
|
|
268
273
|
outputPath = _a.sent();
|
|
269
274
|
return [4 /*yield*/, (0, utils_2.generateCompileProgram)(folderPath)];
|
|
270
|
-
case
|
|
275
|
+
case 3:
|
|
271
276
|
programContent = _a.sent();
|
|
272
277
|
return [4 /*yield*/, (0, utils_2.createFile)(outputPath, programContent)
|
|
273
278
|
.then(function () {
|
|
@@ -279,7 +284,7 @@ var FSCommand = /** @class */ (function (_super) {
|
|
|
279
284
|
(0, utils_1.displayError)(err, 'An error has occurred when creating program file.');
|
|
280
285
|
return command_1.ReturnCode.InternalError;
|
|
281
286
|
})];
|
|
282
|
-
case
|
|
287
|
+
case 4: return [2 /*return*/, _a.sent()];
|
|
283
288
|
}
|
|
284
289
|
});
|
|
285
290
|
});
|
|
@@ -99,6 +99,7 @@ var TargetCommand = /** @class */ (function (_super) {
|
|
|
99
99
|
return [4 /*yield*/, (0, utils_1.findTargetInConfiguration)(targetName)
|
|
100
100
|
.then(function (res) {
|
|
101
101
|
_this._targetInfo = res;
|
|
102
|
+
(0, utils_1.updateSasjsConstants)(res.target, res.isLocal);
|
|
102
103
|
return res;
|
|
103
104
|
})
|
|
104
105
|
.catch(function (err) {
|
|
@@ -39,7 +39,7 @@ 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.setConstants = exports.contextName = void 0;
|
|
42
|
+
exports.updateSasjsConstants = exports.setConstants = exports.contextName = void 0;
|
|
43
43
|
var path_1 = __importDefault(require("path"));
|
|
44
44
|
var config_1 = require("./config");
|
|
45
45
|
var utils_1 = require("./utils");
|
|
@@ -47,18 +47,17 @@ var utils_2 = require("@sasjs/utils");
|
|
|
47
47
|
exports.contextName = 'sasjs cli compute context';
|
|
48
48
|
var setConstants = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
49
|
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError, sas9GUID;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
switch (_d.label) {
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
switch (_b.label) {
|
|
53
52
|
case 0: return [4 /*yield*/, (0, config_1.getLocalOrGlobalConfig)().catch(function () { return ({
|
|
54
53
|
configuration: null,
|
|
55
54
|
isLocal: false
|
|
56
55
|
}); })];
|
|
57
56
|
case 1:
|
|
58
|
-
_a =
|
|
59
|
-
buildOutputFolder = (
|
|
57
|
+
_a = _b.sent(), configuration = _a.configuration, isLocal = _a.isLocal;
|
|
58
|
+
buildOutputFolder = (configuration === null || configuration === void 0 ? void 0 : configuration.sasjsBuildFolder) ||
|
|
60
59
|
(isLocal ? 'sasjsbuild' : '.sasjs/sasjsbuild');
|
|
61
|
-
buildResultsFolder = (
|
|
60
|
+
buildResultsFolder = (configuration === null || configuration === void 0 ? void 0 : configuration.sasjsResultsFolder) ||
|
|
62
61
|
(isLocal ? 'sasjsresults' : '.sasjs/sasjsresults');
|
|
63
62
|
homeDir = require('os').homedir();
|
|
64
63
|
buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
|
|
@@ -71,7 +70,7 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
71
70
|
buildDestinationDocsFolder = path_1.default.join(buildDestinationFolder, 'docs');
|
|
72
71
|
return [4 /*yield*/, (0, utils_1.getNodeModulePath)('@sasjs/core')];
|
|
73
72
|
case 2:
|
|
74
|
-
macroCorePath =
|
|
73
|
+
macroCorePath = _b.sent();
|
|
75
74
|
buildDestinationResultsFolder = (0, utils_2.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
|
|
76
75
|
buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
|
|
77
76
|
sas9CredentialsError = 'The following attributes were not found:' +
|
|
@@ -102,3 +101,24 @@ var setConstants = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
102
101
|
});
|
|
103
102
|
}); };
|
|
104
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
|
+
};
|
|
124
|
+
exports.updateSasjsConstants = updateSasjsConstants;
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@sasjs/adapter": "4.1.3",
|
|
54
54
|
"@sasjs/core": "4.45.4",
|
|
55
55
|
"@sasjs/lint": "2.2.2",
|
|
56
|
-
"@sasjs/utils": "3.0
|
|
56
|
+
"@sasjs/utils": "3.1.0",
|
|
57
57
|
"adm-zip": "0.5.9",
|
|
58
58
|
"chalk": "4.1.2",
|
|
59
59
|
"dotenv": "10.0.0",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"typescript": "4.5.4",
|
|
101
101
|
"util": "0.12.4"
|
|
102
102
|
},
|
|
103
|
-
"version": "
|
|
103
|
+
"version": "4.0.0"
|
|
104
104
|
}
|