@sasjs/cli 3.12.1 → 3.12.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.
|
@@ -324,6 +324,7 @@ function recreateBuildFolder() {
|
|
|
324
324
|
});
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
+
// REFACTOR: combine compileServiceFolder and compileJobFolder
|
|
327
328
|
var compileServiceFolder = function (target, serviceFolder, macroFolders, programFolders, compileTree) { return __awaiter(void 0, void 0, void 0, function () {
|
|
328
329
|
var destinationPath, subFolders, filesNamesInPath;
|
|
329
330
|
return __generator(this, function (_a) {
|
|
@@ -333,9 +334,30 @@ var compileServiceFolder = function (target, serviceFolder, macroFolders, progra
|
|
|
333
334
|
return [4 /*yield*/, (0, utils_1.listSubFoldersInFolder)(destinationPath)];
|
|
334
335
|
case 1:
|
|
335
336
|
subFolders = _a.sent();
|
|
336
|
-
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(destinationPath)
|
|
337
|
+
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(destinationPath)
|
|
338
|
+
// Checks if file in sasjsbuild folder exists in source folder.
|
|
339
|
+
// If not, it means that the file shouldn't be compiled.
|
|
340
|
+
];
|
|
337
341
|
case 2:
|
|
338
342
|
filesNamesInPath = _a.sent();
|
|
343
|
+
// Checks if file in sasjsbuild folder exists in source folder.
|
|
344
|
+
// If not, it means that the file shouldn't be compiled.
|
|
345
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(filesNamesInPath, function (fileName, i) { return __awaiter(void 0, void 0, void 0, function () {
|
|
346
|
+
return __generator(this, function (_a) {
|
|
347
|
+
switch (_a.label) {
|
|
348
|
+
case 0: return [4 /*yield*/, (0, utils_1.fileExists)(path_1.default.join(serviceFolder, fileName))];
|
|
349
|
+
case 1:
|
|
350
|
+
if (!(_a.sent())) {
|
|
351
|
+
filesNamesInPath.splice(i, 1);
|
|
352
|
+
}
|
|
353
|
+
return [2 /*return*/];
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}); })];
|
|
357
|
+
case 3:
|
|
358
|
+
// Checks if file in sasjsbuild folder exists in source folder.
|
|
359
|
+
// If not, it means that the file shouldn't be compiled.
|
|
360
|
+
_a.sent();
|
|
339
361
|
return [4 /*yield*/, (0, utils_1.asyncForEach)(filesNamesInPath, function (fileName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
340
362
|
var filePath;
|
|
341
363
|
return __generator(this, function (_a) {
|
|
@@ -355,7 +377,7 @@ var compileServiceFolder = function (target, serviceFolder, macroFolders, progra
|
|
|
355
377
|
}
|
|
356
378
|
});
|
|
357
379
|
}); })];
|
|
358
|
-
case
|
|
380
|
+
case 4:
|
|
359
381
|
_a.sent();
|
|
360
382
|
return [4 /*yield*/, (0, utils_1.asyncForEach)(subFolders, function (subFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
361
383
|
var fileNames;
|
|
@@ -389,7 +411,7 @@ var compileServiceFolder = function (target, serviceFolder, macroFolders, progra
|
|
|
389
411
|
}
|
|
390
412
|
});
|
|
391
413
|
}); })];
|
|
392
|
-
case
|
|
414
|
+
case 5:
|
|
393
415
|
_a.sent();
|
|
394
416
|
compileTree.saveTree();
|
|
395
417
|
return [2 /*return*/];
|
|
@@ -405,9 +427,30 @@ var compileJobFolder = function (target, jobFolder, macroFolders, programFolders
|
|
|
405
427
|
return [4 /*yield*/, (0, utils_1.listSubFoldersInFolder)(destinationPath)];
|
|
406
428
|
case 1:
|
|
407
429
|
subFolders = _a.sent();
|
|
408
|
-
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(destinationPath)
|
|
430
|
+
return [4 /*yield*/, (0, utils_1.listFilesInFolder)(destinationPath)
|
|
431
|
+
// Checks if file in sasjsbuild folder exists in source folder.
|
|
432
|
+
// If not, it means that the file shouldn't be compiled.
|
|
433
|
+
];
|
|
409
434
|
case 2:
|
|
410
435
|
filesNamesInPath = _a.sent();
|
|
436
|
+
// Checks if file in sasjsbuild folder exists in source folder.
|
|
437
|
+
// If not, it means that the file shouldn't be compiled.
|
|
438
|
+
return [4 /*yield*/, (0, utils_1.asyncForEach)(filesNamesInPath, function (fileName, i) { return __awaiter(void 0, void 0, void 0, function () {
|
|
439
|
+
return __generator(this, function (_a) {
|
|
440
|
+
switch (_a.label) {
|
|
441
|
+
case 0: return [4 /*yield*/, (0, utils_1.fileExists)(path_1.default.join(jobFolder, fileName))];
|
|
442
|
+
case 1:
|
|
443
|
+
if (!(_a.sent())) {
|
|
444
|
+
filesNamesInPath.splice(i, 1);
|
|
445
|
+
}
|
|
446
|
+
return [2 /*return*/];
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
}); })];
|
|
450
|
+
case 3:
|
|
451
|
+
// Checks if file in sasjsbuild folder exists in source folder.
|
|
452
|
+
// If not, it means that the file shouldn't be compiled.
|
|
453
|
+
_a.sent();
|
|
411
454
|
return [4 /*yield*/, (0, utils_1.asyncForEach)(filesNamesInPath, function (fileName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
412
455
|
var filePath;
|
|
413
456
|
return __generator(this, function (_a) {
|
|
@@ -427,7 +470,7 @@ var compileJobFolder = function (target, jobFolder, macroFolders, programFolders
|
|
|
427
470
|
}
|
|
428
471
|
});
|
|
429
472
|
}); })];
|
|
430
|
-
case
|
|
473
|
+
case 4:
|
|
431
474
|
_a.sent();
|
|
432
475
|
return [4 /*yield*/, (0, utils_1.asyncForEach)(subFolders, function (subFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
433
476
|
var fileNames;
|
|
@@ -461,7 +504,7 @@ var compileJobFolder = function (target, jobFolder, macroFolders, programFolders
|
|
|
461
504
|
}
|
|
462
505
|
});
|
|
463
506
|
}); })];
|
|
464
|
-
case
|
|
507
|
+
case 5:
|
|
465
508
|
_a.sent();
|
|
466
509
|
return [2 /*return*/];
|
|
467
510
|
}
|
|
@@ -739,10 +739,10 @@ describe('sasjs compile outside project', function () {
|
|
|
739
739
|
return [4 /*yield*/, (0, config_1.saveGlobalRcFile)('')];
|
|
740
740
|
case 1:
|
|
741
741
|
_a.sent();
|
|
742
|
-
process.projectDir = '';
|
|
743
742
|
return [4 /*yield*/, (0, utils_2.setConstants)()];
|
|
744
743
|
case 2:
|
|
745
744
|
_a.sent();
|
|
745
|
+
process.projectDir = '';
|
|
746
746
|
process.currentDir = path_1.default.join(__dirname, appName);
|
|
747
747
|
return [4 /*yield*/, (0, utils_1.createFolder)(process.currentDir)];
|
|
748
748
|
case 3:
|
|
@@ -785,6 +785,38 @@ describe('sasjs compile outside project', function () {
|
|
|
785
785
|
}
|
|
786
786
|
});
|
|
787
787
|
}); });
|
|
788
|
+
it('should compile without duplicates', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
789
|
+
var testServicePath, appPath, command, compiledTestService;
|
|
790
|
+
var _a;
|
|
791
|
+
return __generator(this, function (_b) {
|
|
792
|
+
switch (_b.label) {
|
|
793
|
+
case 0:
|
|
794
|
+
testServicePath = path_1.default.join('services', 'admin', 'test.sas');
|
|
795
|
+
appPath = path_1.default.join(__dirname, appName);
|
|
796
|
+
return [4 /*yield*/, (0, test_1.createTestApp)(__dirname, appName)];
|
|
797
|
+
case 1:
|
|
798
|
+
_b.sent();
|
|
799
|
+
return [4 /*yield*/, (0, utils_1.createFile)(path_1.default.join(appPath, 'sasjs', 'targets', 'viya', testServicePath), '')];
|
|
800
|
+
case 2:
|
|
801
|
+
_b.sent();
|
|
802
|
+
command = new compileCommand_1.CompileCommand([
|
|
803
|
+
'node',
|
|
804
|
+
'sasjs',
|
|
805
|
+
'compile',
|
|
806
|
+
'-t',
|
|
807
|
+
'viya'
|
|
808
|
+
]);
|
|
809
|
+
return [4 /*yield*/, command.executeCompile()];
|
|
810
|
+
case 3:
|
|
811
|
+
_b.sent();
|
|
812
|
+
return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(appPath, 'sasjsbuild', testServicePath))];
|
|
813
|
+
case 4:
|
|
814
|
+
compiledTestService = _b.sent();
|
|
815
|
+
expect((_a = compiledTestService.match(/^\*\sService start;$/gm)) === null || _a === void 0 ? void 0 : _a.length).toEqual(1);
|
|
816
|
+
return [2 /*return*/];
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
}); });
|
|
788
820
|
});
|
|
789
821
|
});
|
|
790
822
|
var prefixConfigWithPath = function (prefixPath) { return ({
|
package/package.json
CHANGED