@sasjs/cli 3.6.7 → 3.7.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.
- package/CHANGELOG.md +30 -0
- package/README.md +9 -11
- package/build/commands/build/build.js +19 -34
- package/build/commands/deploy/deploy.js +2 -4
- package/build/commands/job/internal/execute/sasjs.d.ts +1 -0
- package/build/commands/testing/spec/testing.spec.server.js +505 -309
- package/build/commands/testing/test.d.ts +1 -0
- package/build/commands/testing/test.js +150 -125
- package/package.json +4 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
Since March 7th, 2020, the changelog is managed by github releases. See [https://github.com/sasjs/cli/releases](https://github.com/sasjs/cli/releases).
|
|
4
|
+
|
|
5
|
+
## Changes Prior to March 7th 2020
|
|
6
|
+
|
|
7
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
8
|
+
|
|
9
|
+
<a name="1.0.4"></a>
|
|
10
|
+
## [1.0.4](https://gitlab.com/macropeople/sasjs-cli/compare/v1.0.3...v1.0.4) (2020-03-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* redo comment stripping logic ([84a1a91](https://gitlab.com/macropeople/sasjs-cli/commit/84a1a91))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<a name="1.0.3"></a>
|
|
20
|
+
## [1.0.3](https://gitlab.com/macropeople/sasjs-cli/compare/v1.0.2...v1.0.3) (2020-03-07)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<a name="1.0.2"></a>
|
|
25
|
+
## [1.0.2](https://gitlab.com/macropeople/sasjs-cli/compare/v1.0.1...v1.0.2) (2020-03-07)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<a name="1.0.1"></a>
|
|
30
|
+
## 1.0.1 (2020-03-07)
|
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# SASjs CLI
|
|
2
|
+
|
|
2
3
|
[![npm package][npm-image]][npm-url]
|
|
3
4
|
[![Github Workflow][githubworkflow-image]][githubworkflow-url]
|
|
4
5
|
[]()
|
|
@@ -9,15 +10,14 @@
|
|
|
9
10
|
[](https://github.com/sasjs/cli/issues)
|
|
10
11
|
[](https://gitpod.io/#https://github.com/sasjs/cli)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
[npm-
|
|
14
|
-
[
|
|
15
|
-
[githubworkflow-
|
|
16
|
-
[githubworkflow-url]:https://github.com/sasjs/cli/blob/main/.github/workflows/run-tests.yml
|
|
13
|
+
[npm-image]: https://img.shields.io/npm/v/@sasjs/cli.svg
|
|
14
|
+
[npm-url]: http://npmjs.org/package/@sasjs/cli
|
|
15
|
+
[githubworkflow-image]: https://github.com/sasjs/cli/actions/workflows/run-tests.yml/badge.svg
|
|
16
|
+
[githubworkflow-url]: https://github.com/sasjs/cli/blob/main/.github/workflows/run-tests.yml
|
|
17
17
|
|
|
18
18
|
`@sasjs/cli` is a Command-Line Interface to assist with creating, building, and deploying Data Science projects and HTML5 Web Applications on the SAS platform (both SAS 9 and Viya). Features include:
|
|
19
19
|
|
|
20
|
-
- Scaffold a new SAS App in seconds
|
|
20
|
+
- Scaffold a new SAS App in seconds (`sasjs create myApp -t jobs`)
|
|
21
21
|
- Compile / Build SAS Jobs, Services & Macros _locally_ and deploy / execute _remotely_, in isolation from other developers (`sasjs cbd`)
|
|
22
22
|
- No dependency on the server filesystem
|
|
23
23
|
- Trigger Viya Jobs & Flows (`sasjs job execute` / `sasjs flow execute`)
|
|
@@ -40,19 +40,18 @@ A quick demonstration of using it to compile, build and deploy a set of SAS Viya
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
You can also use the tool without deploying through NPX as follows:
|
|
43
|
+
|
|
43
44
|
```
|
|
44
45
|
npx @sasjs/cli <command>
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
## Documentation
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
Additional documentation can be found on the [SASjs CLI documentation](https://cli.sasjs.io) site.
|
|
51
|
-
|
|
50
|
+
Additional documentation can be found on the [SASjs CLI documentation](https://cli.sasjs.io) site.
|
|
52
51
|
|
|
53
52
|
## Notes
|
|
54
53
|
|
|
55
|
-
Running `npm i -g @sasjs/cli@latest` does not always upgrade properly.
|
|
54
|
+
Running `npm i -g @sasjs/cli@latest` does not always upgrade properly. This is due to a known bug in npm, which is fixed in npm 7.
|
|
56
55
|
|
|
57
56
|
If you are running NPM in version 6 or below, you can try running `npm update -g @sasjs/cli` instead, or - the sledgehammer approach - delete the files from the NPM folder and then do a fresh install.
|
|
58
57
|
|
|
@@ -62,7 +61,6 @@ If you find this library useful, please leave a star and help us grow our star g
|
|
|
62
61
|
|
|
63
62
|

|
|
64
63
|
|
|
65
|
-
|
|
66
64
|
## Contributors ✨
|
|
67
65
|
|
|
68
66
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
@@ -294,23 +294,21 @@ function getCreateFileScript(serverType) {
|
|
|
294
294
|
});
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
function getWebServiceScriptInvocation(serverType,
|
|
298
|
-
if (filePath === void 0) { filePath = ''; }
|
|
297
|
+
function getWebServiceScriptInvocation(serverType, isSASFile, encoded) {
|
|
299
298
|
if (isSASFile === void 0) { isSASFile = true; }
|
|
300
299
|
if (encoded === void 0) { encoded = false; }
|
|
301
|
-
var loc = filePath === '' ? 'services' : 'tests';
|
|
302
300
|
var encodedParam = encoded ? ', intype=BASE64' : '';
|
|
303
301
|
switch (serverType) {
|
|
304
302
|
case utils_1.ServerType.SasViya:
|
|
305
303
|
return isSASFile
|
|
306
|
-
? "%mv_createwebservice(path=&appLoc
|
|
307
|
-
: "%mv_createfile(path=&appLoc
|
|
304
|
+
? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
|
|
305
|
+
: "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
|
|
308
306
|
case utils_1.ServerType.Sas9:
|
|
309
|
-
return "%mm_createwebservice(path=&appLoc
|
|
307
|
+
return "%mm_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)";
|
|
310
308
|
case utils_1.ServerType.Sasjs:
|
|
311
309
|
return isSASFile
|
|
312
|
-
? "%mv_createwebservice(path=&appLoc
|
|
313
|
-
: "%mv_createfile(path=&appLoc
|
|
310
|
+
? "%mv_createwebservice(path=&appLoc/&path, name=&service, code=sascode ,replace=yes)"
|
|
311
|
+
: "%mv_createfile(path=&appLoc/&path, name=&filename, inref=filecode".concat(encodedParam, ")");
|
|
314
312
|
default:
|
|
315
313
|
throw new error_1.ServerTypeError();
|
|
316
314
|
}
|
|
@@ -340,7 +338,7 @@ function getFolderContent(serverType) {
|
|
|
340
338
|
var _a, content, contentJSON;
|
|
341
339
|
return __generator(this, function (_b) {
|
|
342
340
|
switch (_b.label) {
|
|
343
|
-
case 0: return [4 /*yield*/, getContentFor(
|
|
341
|
+
case 0: return [4 /*yield*/, getContentFor(buildDestinationFolder, path_1.default.join(buildDestinationFolder, subFolder), serverType)];
|
|
344
342
|
case 1:
|
|
345
343
|
_a = _b.sent(), content = _a.content, contentJSON = _a.contentJSON;
|
|
346
344
|
folderContent += "\n".concat(content);
|
|
@@ -383,28 +381,19 @@ function getDependencies(filePaths) {
|
|
|
383
381
|
});
|
|
384
382
|
});
|
|
385
383
|
}
|
|
386
|
-
function getContentFor(rootDirectory, folderPath, serverType
|
|
387
|
-
if (testPath === void 0) { testPath = undefined; }
|
|
384
|
+
function getContentFor(rootDirectory, folderPath, serverType) {
|
|
388
385
|
return __awaiter(this, void 0, void 0, function () {
|
|
389
|
-
var folderName,
|
|
386
|
+
var folderName, content, contentJSON, files, subFolders;
|
|
390
387
|
var _this = this;
|
|
391
388
|
return __generator(this, function (_a) {
|
|
392
389
|
switch (_a.label) {
|
|
393
390
|
case 0:
|
|
394
391
|
folderName = path_1.default.basename(folderPath);
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
? ''
|
|
401
|
-
: testPath !== undefined
|
|
402
|
-
? testPath
|
|
403
|
-
: folderPath
|
|
404
|
-
.replace(rootDirectory, '')
|
|
405
|
-
.substr(1)
|
|
406
|
-
.split(path_1.default.sep)
|
|
407
|
-
.join('/'), ";\n");
|
|
392
|
+
content = "\n%let path=".concat(folderPath
|
|
393
|
+
.replace(rootDirectory, '')
|
|
394
|
+
.substr(1)
|
|
395
|
+
.split(path_1.default.sep)
|
|
396
|
+
.join('/'), ";\n");
|
|
408
397
|
contentJSON = {
|
|
409
398
|
name: folderName,
|
|
410
399
|
type: 'folder',
|
|
@@ -423,7 +412,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
|
|
|
423
412
|
return [4 /*yield*/, (0, utils_1.readFile)(filePath)];
|
|
424
413
|
case 1:
|
|
425
414
|
fileContent = _a.sent();
|
|
426
|
-
transformedContent = getServiceText(file, fileContent, serverType
|
|
415
|
+
transformedContent = getServiceText(file, fileContent, serverType);
|
|
427
416
|
content += "\n".concat(transformedContent, "\n");
|
|
428
417
|
contentJSON.members.push({
|
|
429
418
|
name: file.replace(/.sas$/, ''),
|
|
@@ -455,11 +444,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
|
|
|
455
444
|
var _a, childContent, childContentJSON;
|
|
456
445
|
return __generator(this, function (_b) {
|
|
457
446
|
switch (_b.label) {
|
|
458
|
-
case 0: return [4 /*yield*/, getContentFor(rootDirectory, path_1.default.join(folderPath, subFolder), serverType
|
|
459
|
-
? testPath === ''
|
|
460
|
-
? subFolder
|
|
461
|
-
: "".concat(testPath, "/").concat(subFolder)
|
|
462
|
-
: undefined)];
|
|
447
|
+
case 0: return [4 /*yield*/, getContentFor(rootDirectory, path_1.default.join(folderPath, subFolder), serverType)];
|
|
463
448
|
case 1:
|
|
464
449
|
_a = _b.sent(), childContent = _a.content, childContentJSON = _a.contentJSON;
|
|
465
450
|
contentJSON.members.push(childContentJSON);
|
|
@@ -475,7 +460,7 @@ function getContentFor(rootDirectory, folderPath, serverType, testPath) {
|
|
|
475
460
|
});
|
|
476
461
|
});
|
|
477
462
|
}
|
|
478
|
-
function getServiceText(serviceFileName, fileContent, serverType
|
|
463
|
+
function getServiceText(serviceFileName, fileContent, serverType) {
|
|
479
464
|
var serviceName = serviceFileName.replace(/.sas$/, '');
|
|
480
465
|
var sourceCodeLines = getLines((0, utils_2.removeComments)(fileContent));
|
|
481
466
|
var content = "";
|
|
@@ -486,14 +471,14 @@ function getServiceText(serviceFileName, fileContent, serverType, testPath) {
|
|
|
486
471
|
}
|
|
487
472
|
});
|
|
488
473
|
return "%let service=".concat(serviceName, ";\nfilename sascode temp lrecl=32767;\ndata _null_;\nfile sascode;\n").concat(content, "\n\nrun;\n").concat(serverType !== utils_1.ServerType.Sasjs
|
|
489
|
-
? getWebServiceScriptInvocation(serverType
|
|
474
|
+
? getWebServiceScriptInvocation(serverType)
|
|
490
475
|
: '', "\nfilename sascode clear;\n");
|
|
491
476
|
}
|
|
492
477
|
function getFileText(fileName, fileContent, serverType) {
|
|
493
478
|
var fileExtension = path_1.default.extname(fileName).substring(1).toUpperCase();
|
|
494
479
|
var _a = getWebFileContent(fileContent, fileExtension), content = _a.content, maxLineLength = _a.maxLineLength;
|
|
495
480
|
return "%let filename=".concat(fileName, ";\nfilename filecode temp lrecl=").concat(maxLineLength, ";\ndata _null_;\nfile filecode;\n").concat(content, "\n\nrun;\n").concat(serverType !== utils_1.ServerType.Sasjs
|
|
496
|
-
? getWebServiceScriptInvocation(serverType,
|
|
481
|
+
? getWebServiceScriptInvocation(serverType, false, true)
|
|
497
482
|
: '', "\nfilename filecode clear;\n");
|
|
498
483
|
}
|
|
499
484
|
function getWebFileContent(filecontent, type) {
|
|
@@ -90,7 +90,7 @@ function deploy(target, isLocal, sasjs) {
|
|
|
90
90
|
buildDestinationFolder = process.sasjsConstants.buildDestinationFolder;
|
|
91
91
|
logFilePath = buildDestinationFolder;
|
|
92
92
|
if (!(target.serverType === utils_2.ServerType.Sasjs)) return [3 /*break*/, 5];
|
|
93
|
-
return [4 /*yield*/, deployToSasjs(target,
|
|
93
|
+
return [4 /*yield*/, deployToSasjs(target, sasjs)];
|
|
94
94
|
case 4:
|
|
95
95
|
_k.sent();
|
|
96
96
|
return [3 /*break*/, 7];
|
|
@@ -323,11 +323,9 @@ function deployToSas9(deployScriptName, target, linesToExecute, logFolder, strea
|
|
|
323
323
|
/**
|
|
324
324
|
* Deploys app to `SASJS` server.
|
|
325
325
|
* @param {Target} target- the target having deploy configuration.
|
|
326
|
-
* @param {boolean} isLocal- flag indicating if specified target is
|
|
327
|
-
* from local sasjsconfig or global sasjsconfig file.
|
|
328
326
|
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
329
327
|
*/
|
|
330
|
-
function deployToSasjs(target,
|
|
328
|
+
function deployToSasjs(target, sasjs) {
|
|
331
329
|
var _a, _b;
|
|
332
330
|
return __awaiter(this, void 0, void 0, function () {
|
|
333
331
|
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, e_2, result;
|