@sasjs/cli 3.12.6 → 3.13.2
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/cli.js +3 -3
- package/build/commands/build/build.js +12 -10
- package/build/commands/compile/internal/compileServiceFile.js +1 -2
- package/build/utils/config.d.ts +0 -1
- package/build/utils/config.js +1 -3
- package/build/utils/setConstants.js +14 -21
- package/build/utils/spec/setConstants.spec.js +54 -10
- package/build/utils/utils.d.ts +1 -0
- package/build/utils/utils.js +34 -1
- package/package.json +2 -4
package/build/cli.js
CHANGED
|
@@ -48,13 +48,13 @@ function cli(args) {
|
|
|
48
48
|
case 0: return [4 /*yield*/, (0, utils_1.setProjectDir)(args)];
|
|
49
49
|
case 1:
|
|
50
50
|
_a.sent();
|
|
51
|
-
return [4 /*yield*/, (
|
|
51
|
+
return [4 /*yield*/, instantiateLogger()];
|
|
52
52
|
case 2:
|
|
53
53
|
_a.sent();
|
|
54
|
-
return [4 /*yield*/, (0, utils_1.
|
|
54
|
+
return [4 /*yield*/, (0, utils_1.setConstants)()];
|
|
55
55
|
case 3:
|
|
56
56
|
_a.sent();
|
|
57
|
-
return [4 /*yield*/,
|
|
57
|
+
return [4 /*yield*/, (0, utils_1.loadProjectEnvVariables)()];
|
|
58
58
|
case 4:
|
|
59
59
|
_a.sent();
|
|
60
60
|
command = (0, parse_1.parse)(args);
|
|
@@ -144,7 +144,7 @@ function createFinalSasFiles(target) {
|
|
|
144
144
|
return [4 /*yield*/, (0, config_2.getBuildTerm)(target)];
|
|
145
145
|
case 5:
|
|
146
146
|
buildTerm = _j.sent();
|
|
147
|
-
macroCorePath =
|
|
147
|
+
macroCorePath = process.sasjsConstants.macroCorePath;
|
|
148
148
|
return [4 /*yield*/, (0, utils_1.getDependencyPaths)("".concat(buildTerm, "\n").concat(buildInit), macroFolders, macroCorePath)];
|
|
149
149
|
case 6:
|
|
150
150
|
dependencyFilePaths = _j.sent();
|
|
@@ -205,7 +205,7 @@ function getBuildInfo(target, streamWeb) {
|
|
|
205
205
|
return [4 /*yield*/, getCreateWebServiceScript(serverType)];
|
|
206
206
|
case 2:
|
|
207
207
|
createWebServiceScript = _a.sent();
|
|
208
|
-
macroCorePath =
|
|
208
|
+
macroCorePath = process.sasjsConstants.macroCorePath;
|
|
209
209
|
buildConfig += "".concat(createWebServiceScript, "\n");
|
|
210
210
|
return [4 /*yield*/, (0, utils_1.getDependencyPaths)(buildConfig, macroFolders, macroCorePath)];
|
|
211
211
|
case 3:
|
|
@@ -222,7 +222,7 @@ function getBuildInfo(target, streamWeb) {
|
|
|
222
222
|
];
|
|
223
223
|
case 5:
|
|
224
224
|
dependencyFilePathsForCreateFile = _a.sent();
|
|
225
|
-
return [4 /*yield*/, (0, utils_1.readFile)("".concat(
|
|
225
|
+
return [4 /*yield*/, (0, utils_1.readFile)("".concat(process.sasjsConstants.macroCorePath, "/base/mp_replace.sas"))];
|
|
226
226
|
case 6:
|
|
227
227
|
gsubScript = _a.sent();
|
|
228
228
|
buildConfig += "".concat(gsubScript, "\n");
|
|
@@ -244,10 +244,11 @@ function getBuildInfo(target, streamWeb) {
|
|
|
244
244
|
}
|
|
245
245
|
function getCreateWebServiceScript(serverType) {
|
|
246
246
|
return __awaiter(this, void 0, void 0, function () {
|
|
247
|
-
var _a;
|
|
247
|
+
var macroCorePath, _a;
|
|
248
248
|
return __generator(this, function (_b) {
|
|
249
249
|
switch (_b.label) {
|
|
250
250
|
case 0:
|
|
251
|
+
macroCorePath = process.sasjsConstants.macroCorePath;
|
|
251
252
|
_a = serverType;
|
|
252
253
|
switch (_a) {
|
|
253
254
|
case utils_1.ServerType.SasViya: return [3 /*break*/, 1];
|
|
@@ -255,15 +256,15 @@ function getCreateWebServiceScript(serverType) {
|
|
|
255
256
|
case utils_1.ServerType.Sasjs: return [3 /*break*/, 5];
|
|
256
257
|
}
|
|
257
258
|
return [3 /*break*/, 7];
|
|
258
|
-
case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat(
|
|
259
|
+
case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createwebservice.sas"))];
|
|
259
260
|
case 2: return [2 /*return*/, _b.sent()];
|
|
260
|
-
case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat(
|
|
261
|
+
case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/meta/mm_createwebservice.sas"))
|
|
261
262
|
// FIXME: use sasjs/mv_createwebservice.sas ones created
|
|
262
263
|
];
|
|
263
264
|
case 4: return [2 /*return*/, _b.sent()
|
|
264
265
|
// FIXME: use sasjs/mv_createwebservice.sas ones created
|
|
265
266
|
];
|
|
266
|
-
case 5: return [4 /*yield*/, (0, utils_1.readFile)("".concat(
|
|
267
|
+
case 5: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createwebservice.sas"))];
|
|
267
268
|
case 6: return [2 /*return*/, _b.sent()];
|
|
268
269
|
case 7: throw new error_1.ServerTypeError();
|
|
269
270
|
}
|
|
@@ -272,23 +273,24 @@ function getCreateWebServiceScript(serverType) {
|
|
|
272
273
|
}
|
|
273
274
|
function getCreateFileScript(serverType) {
|
|
274
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
|
-
var _a;
|
|
276
|
+
var macroCorePath, _a;
|
|
276
277
|
return __generator(this, function (_b) {
|
|
277
278
|
switch (_b.label) {
|
|
278
279
|
case 0:
|
|
280
|
+
macroCorePath = process.sasjsConstants.macroCorePath;
|
|
279
281
|
_a = serverType;
|
|
280
282
|
switch (_a) {
|
|
281
283
|
case utils_1.ServerType.SasViya: return [3 /*break*/, 1];
|
|
282
284
|
case utils_1.ServerType.Sasjs: return [3 /*break*/, 3];
|
|
283
285
|
}
|
|
284
286
|
return [3 /*break*/, 5];
|
|
285
|
-
case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat(
|
|
287
|
+
case 1: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createfile.sas"))
|
|
286
288
|
// FIXME: use sasjs/mv_createfile.sas ones created
|
|
287
289
|
];
|
|
288
290
|
case 2: return [2 /*return*/, _b.sent()
|
|
289
291
|
// FIXME: use sasjs/mv_createfile.sas ones created
|
|
290
292
|
];
|
|
291
|
-
case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat(
|
|
293
|
+
case 3: return [4 /*yield*/, (0, utils_1.readFile)("".concat(macroCorePath, "/viya/mv_createfile.sas"))];
|
|
292
294
|
case 4: return [2 /*return*/, _b.sent()];
|
|
293
295
|
case 5: throw new error_1.ServerTypeError([utils_1.ServerType.SasViya, utils_1.ServerType.Sasjs]);
|
|
294
296
|
}
|
|
@@ -37,7 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getPreCodeForServicePack = exports.compileServiceFile = void 0;
|
|
40
|
-
var config_1 = require("../../../utils/config");
|
|
41
40
|
var utils_1 = require("@sasjs/utils");
|
|
42
41
|
var types_1 = require("@sasjs/utils/types");
|
|
43
42
|
var error_1 = require("@sasjs/utils/error");
|
|
@@ -75,7 +74,7 @@ function getPreCodeForServicePack(serverType) {
|
|
|
75
74
|
switch (_l.label) {
|
|
76
75
|
case 0:
|
|
77
76
|
content = '';
|
|
78
|
-
macroCorePath =
|
|
77
|
+
macroCorePath = process.sasjsConstants.macroCorePath;
|
|
79
78
|
_a = serverType;
|
|
80
79
|
switch (_a) {
|
|
81
80
|
case types_1.ServerType.SasViya: return [3 /*break*/, 1];
|
package/build/utils/config.d.ts
CHANGED
|
@@ -52,7 +52,6 @@ export declare function getMacroFolders(target?: Target): Promise<string[]>;
|
|
|
52
52
|
* @param {Target} target- the target to check stream configuration for.
|
|
53
53
|
*/
|
|
54
54
|
export declare function getStreamConfig(target?: Target): Promise<StreamConfig>;
|
|
55
|
-
export declare const getMacroCorePath: () => string;
|
|
56
55
|
/**
|
|
57
56
|
* Sanitizes app location string.
|
|
58
57
|
* @param {string} appLoc - app location
|
package/build/utils/config.js
CHANGED
|
@@ -75,7 +75,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
75
75
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
76
76
|
};
|
|
77
77
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
78
|
-
exports.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.getAccessToken = exports.getAuthConfig = exports.getProjectRoot = exports.sanitizeAppLoc = exports.
|
|
78
|
+
exports.getTestTearDown = exports.getTestSetUp = exports.overrideEnvVariables = exports.getAccessToken = exports.getAuthConfig = exports.getProjectRoot = exports.sanitizeAppLoc = exports.getStreamConfig = exports.getMacroFolders = exports.getBinaryFolders = exports.getProgramFolders = exports.getFolders = exports.saveToLocalConfig = exports.saveLocalConfigFile = exports.getLocalOrGlobalConfig = exports.getLocalConfig = exports.removeFromLocalConfig = exports.removeFromGlobalConfig = exports.saveToGlobalConfig = exports.saveGlobalRcFile = exports.getLocalRcFile = exports.getGlobalRcFile = exports.findTargetInConfiguration = exports.getConfiguration = void 0;
|
|
79
79
|
var node_1 = __importDefault(require("@sasjs/adapter/node"));
|
|
80
80
|
var utils_1 = require("@sasjs/utils");
|
|
81
81
|
var auth_1 = require("./auth");
|
|
@@ -727,8 +727,6 @@ function getStreamConfig(target) {
|
|
|
727
727
|
});
|
|
728
728
|
}
|
|
729
729
|
exports.getStreamConfig = getStreamConfig;
|
|
730
|
-
var getMacroCorePath = function () { return process.sasjsConstants.macroCorePath; };
|
|
731
|
-
exports.getMacroCorePath = getMacroCorePath;
|
|
732
730
|
/**
|
|
733
731
|
* Sanitizes app location string.
|
|
734
732
|
* @param {string} appLoc - app location
|
|
@@ -41,45 +41,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.setConstants = exports.contextName = void 0;
|
|
43
43
|
var path_1 = __importDefault(require("path"));
|
|
44
|
-
var get_installed_path_1 = require("get-installed-path");
|
|
45
44
|
var config_1 = require("./config");
|
|
46
|
-
var utils_1 = require("
|
|
45
|
+
var utils_1 = require("./utils");
|
|
46
|
+
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
|
-
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath,
|
|
50
|
-
var
|
|
51
|
-
return __generator(this, function (
|
|
52
|
-
switch (
|
|
49
|
+
var _a, configuration, isLocal, buildOutputFolder, buildResultsFolder, homeDir, buildSourceFolder, buildSourceDbFolder, buildDestinationFolder, buildDestinationServicesFolder, buildDestinationTestFolder, buildDestinationJobsFolder, buildDestinationDbFolder, buildDestinationDocsFolder, macroCorePath, buildDestinationResultsFolder, buildDestinationResultsLogsFolder, sas9CredentialsError, invalidSasError;
|
|
50
|
+
var _b, _c;
|
|
51
|
+
return __generator(this, function (_d) {
|
|
52
|
+
switch (_d.label) {
|
|
53
53
|
case 0: return [4 /*yield*/, (0, config_1.getLocalOrGlobalConfig)().catch(function () { return ({
|
|
54
54
|
configuration: null,
|
|
55
55
|
isLocal: false
|
|
56
56
|
}); })];
|
|
57
57
|
case 1:
|
|
58
|
-
_a =
|
|
59
|
-
buildOutputFolder = ((
|
|
58
|
+
_a = _d.sent(), configuration = _a.configuration, isLocal = _a.isLocal;
|
|
59
|
+
buildOutputFolder = ((_b = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _b === void 0 ? void 0 : _b.buildOutputFolder) ||
|
|
60
60
|
(isLocal ? 'sasjsbuild' : '.sasjs/sasjsbuild');
|
|
61
|
-
buildResultsFolder = ((
|
|
61
|
+
buildResultsFolder = ((_c = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _c === void 0 ? void 0 : _c.buildResultsFolder) ||
|
|
62
62
|
(isLocal ? 'sasjsresults' : '.sasjs/sasjsresults');
|
|
63
63
|
homeDir = require('os').homedir();
|
|
64
64
|
buildSourceFolder = path_1.default.join(isLocal ? process.projectDir : homeDir);
|
|
65
65
|
buildSourceDbFolder = path_1.default.join(isLocal ? process.projectDir : homeDir, 'sasjs', 'db');
|
|
66
|
-
buildDestinationFolder = (0,
|
|
66
|
+
buildDestinationFolder = (0, utils_2.getAbsolutePath)(buildOutputFolder, isLocal ? process.projectDir : homeDir);
|
|
67
67
|
buildDestinationServicesFolder = path_1.default.join(buildDestinationFolder, 'services');
|
|
68
68
|
buildDestinationTestFolder = path_1.default.join(buildDestinationFolder, 'tests');
|
|
69
69
|
buildDestinationJobsFolder = path_1.default.join(buildDestinationFolder, 'jobs');
|
|
70
70
|
buildDestinationDbFolder = path_1.default.join(buildDestinationFolder, 'db');
|
|
71
71
|
buildDestinationDocsFolder = path_1.default.join(buildDestinationFolder, 'docs');
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return [4 /*yield*/, (0, get_installed_path_1.getInstalledPath)('@sasjs/core', { local: true })];
|
|
77
|
-
case 3:
|
|
78
|
-
_b = _e.sent();
|
|
79
|
-
_e.label = 4;
|
|
80
|
-
case 4:
|
|
81
|
-
macroCorePath = _b;
|
|
82
|
-
buildDestinationResultsFolder = (0, utils_1.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
|
|
72
|
+
return [4 /*yield*/, (0, utils_1.getNodeModulePath)('@sasjs/core')];
|
|
73
|
+
case 2:
|
|
74
|
+
macroCorePath = _d.sent();
|
|
75
|
+
buildDestinationResultsFolder = (0, utils_2.getAbsolutePath)(buildResultsFolder, isLocal ? process.projectDir : homeDir);
|
|
83
76
|
buildDestinationResultsLogsFolder = path_1.default.join(buildDestinationResultsFolder, 'logs');
|
|
84
77
|
sas9CredentialsError = 'The following attributes were not found:' +
|
|
85
78
|
'\n* SAS_USERNAME' +
|
|
@@ -58,10 +58,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
58
58
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
59
|
};
|
|
60
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
-
var utils_1 = require("@sasjs/utils");
|
|
62
61
|
var path_1 = __importDefault(require("path"));
|
|
63
62
|
var configUtils = __importStar(require("../config"));
|
|
64
63
|
var setConstants_1 = require("../setConstants");
|
|
64
|
+
var fileModule = __importStar(require("@sasjs/utils/file"));
|
|
65
65
|
describe('setConstants', function () {
|
|
66
66
|
var config;
|
|
67
67
|
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -71,17 +71,20 @@ describe('setConstants', function () {
|
|
|
71
71
|
case 0:
|
|
72
72
|
;
|
|
73
73
|
_b = (_a = JSON).parse;
|
|
74
|
-
return [4 /*yield*/,
|
|
74
|
+
return [4 /*yield*/, fileModule.readFile(path_1.default.join(__dirname, '..', '..', 'config.json'))];
|
|
75
75
|
case 1:
|
|
76
76
|
(config = _b.apply(_a, [_c.sent()]).config);
|
|
77
77
|
return [2 /*return*/];
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
}); });
|
|
81
|
-
test('should set
|
|
81
|
+
test('should set constants inside appFolder when @sasjs/core dependency is present', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
var appFolder, hasSasjsCore;
|
|
82
83
|
return __generator(this, function (_a) {
|
|
83
84
|
switch (_a.label) {
|
|
84
85
|
case 0:
|
|
86
|
+
appFolder = ['some', 'app', 'folder'].join(path_1.default.sep);
|
|
87
|
+
process.projectDir = appFolder;
|
|
85
88
|
jest
|
|
86
89
|
.spyOn(configUtils, 'getLocalOrGlobalConfig')
|
|
87
90
|
.mockImplementation(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -92,7 +95,42 @@ describe('setConstants', function () {
|
|
|
92
95
|
})];
|
|
93
96
|
});
|
|
94
97
|
}); });
|
|
95
|
-
process
|
|
98
|
+
jest.spyOn(process, 'cwd').mockImplementation(function () { return appFolder; });
|
|
99
|
+
hasSasjsCore = true;
|
|
100
|
+
jest
|
|
101
|
+
.spyOn(fileModule, 'folderExists')
|
|
102
|
+
.mockImplementation(function (path) { return Promise.resolve(hasSasjsCore); });
|
|
103
|
+
return [4 /*yield*/, (0, setConstants_1.setConstants)()];
|
|
104
|
+
case 1:
|
|
105
|
+
_a.sent();
|
|
106
|
+
verifySasjsConstants(process.projectDir, hasSasjsCore);
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); });
|
|
111
|
+
test('should set constants inside appFolder when @sasjs/core dependency is not present', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var appFolder;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
appFolder = ['some', 'app', 'folder'].join(path_1.default.sep);
|
|
117
|
+
process.projectDir = appFolder;
|
|
118
|
+
jest
|
|
119
|
+
.spyOn(configUtils, 'getLocalOrGlobalConfig')
|
|
120
|
+
.mockImplementation(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
return [2 /*return*/, Promise.resolve({
|
|
123
|
+
configuration: config,
|
|
124
|
+
isLocal: true
|
|
125
|
+
})];
|
|
126
|
+
});
|
|
127
|
+
}); });
|
|
128
|
+
jest.spyOn(process, 'cwd').mockImplementation(function () { return appFolder; });
|
|
129
|
+
jest
|
|
130
|
+
.spyOn(fileModule, 'folderExists')
|
|
131
|
+
.mockImplementation(function (folderPath) {
|
|
132
|
+
return Promise.resolve(folderPath !== path_1.default.join(appFolder, 'node_modules', '@sasjs', 'core'));
|
|
133
|
+
});
|
|
96
134
|
return [4 /*yield*/, (0, setConstants_1.setConstants)()];
|
|
97
135
|
case 1:
|
|
98
136
|
_a.sent();
|
|
@@ -101,7 +139,7 @@ describe('setConstants', function () {
|
|
|
101
139
|
}
|
|
102
140
|
});
|
|
103
141
|
}); });
|
|
104
|
-
test('should set
|
|
142
|
+
test('should set constants outside appFolder', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
143
|
return __generator(this, function (_a) {
|
|
106
144
|
switch (_a.label) {
|
|
107
145
|
case 0:
|
|
@@ -124,7 +162,8 @@ describe('setConstants', function () {
|
|
|
124
162
|
});
|
|
125
163
|
}); });
|
|
126
164
|
});
|
|
127
|
-
var verifySasjsConstants = function (appFolder) {
|
|
165
|
+
var verifySasjsConstants = function (appFolder, hasSasjsCore) {
|
|
166
|
+
if (hasSasjsCore === void 0) { hasSasjsCore = false; }
|
|
128
167
|
var prefixAppFolder = appFolder !== null && appFolder !== void 0 ? appFolder : require('os').homedir();
|
|
129
168
|
var sasjsConstants = process.sasjsConstants;
|
|
130
169
|
expect(sasjsConstants.buildSourceFolder).toEqual(prefixAppFolder);
|
|
@@ -137,8 +176,13 @@ var verifySasjsConstants = function (appFolder) {
|
|
|
137
176
|
expect(sasjsConstants.buildDestinationResultsFolder).toEqual([prefixAppFolder, 'sasjsresults'].join(path_1.default.sep));
|
|
138
177
|
expect(sasjsConstants.buildDestinationResultsLogsFolder).toEqual([prefixAppFolder, 'sasjsresults', 'logs'].join(path_1.default.sep));
|
|
139
178
|
expect(sasjsConstants.buildDestinationTestFolder).toEqual([prefixAppFolder, 'sasjsbuild', 'tests'].join(path_1.default.sep));
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
179
|
+
var corePath = hasSasjsCore
|
|
180
|
+
? 'core'
|
|
181
|
+
: path_1.default.join('cli', 'node_modules', '@sasjs', 'core');
|
|
182
|
+
if (appFolder) {
|
|
183
|
+
expect(sasjsConstants.macroCorePath).toEqual(path_1.default.join(prefixAppFolder, 'node_modules', '@sasjs', corePath));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
expect(sasjsConstants.macroCorePath).toEqual(expect.toEndWith(corePath));
|
|
187
|
+
}
|
|
144
188
|
};
|
package/build/utils/utils.d.ts
CHANGED
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.isSASjsProject = 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;
|
|
89
|
+
exports.getNodeModulePath = exports.isSASjsProject = 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"));
|
|
@@ -605,3 +605,36 @@ var isSASjsProject = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
605
605
|
});
|
|
606
606
|
}); };
|
|
607
607
|
exports.isSASjsProject = isSASjsProject;
|
|
608
|
+
var getNodeModulePath = function (module) { return __awaiter(void 0, void 0, void 0, function () {
|
|
609
|
+
var projectPath, cliDepsPath, cliLocalPath, cliGlobalPath;
|
|
610
|
+
return __generator(this, function (_a) {
|
|
611
|
+
switch (_a.label) {
|
|
612
|
+
case 0:
|
|
613
|
+
projectPath = path_1.default.join(process.cwd(), 'node_modules', module);
|
|
614
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(projectPath)];
|
|
615
|
+
case 1:
|
|
616
|
+
if (_a.sent())
|
|
617
|
+
return [2 /*return*/, projectPath
|
|
618
|
+
// Check if module is present in @sasjs/cli located in project's dependencies
|
|
619
|
+
];
|
|
620
|
+
cliDepsPath = path_1.default.join('@sasjs', 'cli', 'node_modules');
|
|
621
|
+
cliLocalPath = path_1.default.join(process.cwd(), 'node_modules', cliDepsPath, module);
|
|
622
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(cliLocalPath)];
|
|
623
|
+
case 2:
|
|
624
|
+
if (_a.sent())
|
|
625
|
+
return [2 /*return*/, cliLocalPath
|
|
626
|
+
// Check if module is present in global @sasjs/cli
|
|
627
|
+
];
|
|
628
|
+
cliGlobalPath = path_1.default.join(shelljs_1.default.exec("npm root -g", { silent: true }).stdout.replace(/\n/, ''), cliDepsPath, module);
|
|
629
|
+
return [4 /*yield*/, (0, utils_1.folderExists)(cliGlobalPath)];
|
|
630
|
+
case 3:
|
|
631
|
+
if (_a.sent())
|
|
632
|
+
return [2 /*return*/, cliGlobalPath
|
|
633
|
+
// Return default value
|
|
634
|
+
];
|
|
635
|
+
// Return default value
|
|
636
|
+
return [2 /*return*/, ''];
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}); };
|
|
640
|
+
exports.getNodeModulePath = getNodeModulePath;
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@sasjs/adapter": "3.8.5",
|
|
51
|
-
"@sasjs/core": "4.15
|
|
51
|
+
"@sasjs/core": "4.18.15",
|
|
52
52
|
"@sasjs/lint": "1.11.2",
|
|
53
53
|
"@sasjs/utils": "2.42.0",
|
|
54
54
|
"chalk": "4.1.2",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"dotenv": "10.0.0",
|
|
57
57
|
"esm": "3.2.25",
|
|
58
58
|
"find": "0.3.0",
|
|
59
|
-
"get-installed-path": "4.0.8",
|
|
60
59
|
"js-base64": "3.7.2",
|
|
61
60
|
"jsdom": "19.0.0",
|
|
62
61
|
"jwt-decode": "3.1.2",
|
|
@@ -74,7 +73,6 @@
|
|
|
74
73
|
"@babel/preset-env": "7.15.6",
|
|
75
74
|
"@babel/preset-typescript": "7.15.0",
|
|
76
75
|
"@types/find": "0.2.1",
|
|
77
|
-
"@types/get-installed-path": "4.0.1",
|
|
78
76
|
"@types/jest": "27.0.2",
|
|
79
77
|
"@types/jsdom": "16.2.13",
|
|
80
78
|
"@types/lodash.groupby": "4.6.6",
|
|
@@ -95,5 +93,5 @@
|
|
|
95
93
|
"typescript": "4.5.4",
|
|
96
94
|
"util": "0.12.4"
|
|
97
95
|
},
|
|
98
|
-
"version": "3.
|
|
96
|
+
"version": "3.13.2"
|
|
99
97
|
}
|