@sasjs/cli 3.10.2 → 3.12.1
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/commands/add/addTarget.js +4 -9
- package/build/commands/create/spec/angularAppFiles.js +5 -0
- package/build/commands/create/spec/create.spec.js +9 -0
- package/build/commands/create/spec/reactAppFiles.js +11 -0
- package/build/commands/deploy/deploy.js +5 -5
- package/build/commands/deploy/spec/cbd.spec.js +9 -2
- package/build/utils/test.d.ts +1 -0
- package/build/utils/test.js +18 -1
- package/build/utils/utils.js +18 -14
- package/package.json +3 -3
|
@@ -60,7 +60,7 @@ var addCredential_1 = require("./addCredential");
|
|
|
60
60
|
function addTarget(insecure) {
|
|
61
61
|
var _a, _b, _c;
|
|
62
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var _d, scope, serverType, name, appLoc, serverUrl, existingTarget,
|
|
63
|
+
var _d, scope, serverType, name, appLoc, serverUrl, existingTarget, targetJson, target, filePath, _e, _f, serverName, repositoryName, userName, password, _g, contextName, updatedViyaTarget, updatedSasjsTarget, isDefault;
|
|
64
64
|
return __generator(this, function (_h) {
|
|
65
65
|
switch (_h.label) {
|
|
66
66
|
case 0:
|
|
@@ -69,10 +69,9 @@ function addTarget(insecure) {
|
|
|
69
69
|
return [4 /*yield*/, (0, input_1.getCommonFields)()];
|
|
70
70
|
case 1:
|
|
71
71
|
_d = _h.sent(), scope = _d.scope, serverType = _d.serverType, name = _d.name, appLoc = _d.appLoc, serverUrl = _d.serverUrl, existingTarget = _d.existingTarget;
|
|
72
|
-
saveWithDefaultValues = !existingTarget;
|
|
73
72
|
targetJson = __assign(__assign({}, existingTarget), { name: name, serverType: serverType, serverUrl: serverUrl, appLoc: appLoc });
|
|
74
73
|
target = new types_1.Target(targetJson);
|
|
75
|
-
return [4 /*yield*/, (0, saveConfig_1.saveConfig)(scope, target, false,
|
|
74
|
+
return [4 /*yield*/, (0, saveConfig_1.saveConfig)(scope, target, false, false)];
|
|
76
75
|
case 2:
|
|
77
76
|
filePath = _h.sent();
|
|
78
77
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Target configuration has been saved to ".concat(filePath, " ."));
|
|
@@ -98,11 +97,7 @@ function addTarget(insecure) {
|
|
|
98
97
|
case 6:
|
|
99
98
|
_g = _h.sent(), contextName = _g.contextName, updatedViyaTarget = _g.target;
|
|
100
99
|
targetJson = {
|
|
101
|
-
contextName: contextName
|
|
102
|
-
deployConfig: {
|
|
103
|
-
deployServicePack: true,
|
|
104
|
-
deployScripts: []
|
|
105
|
-
}
|
|
100
|
+
contextName: contextName
|
|
106
101
|
};
|
|
107
102
|
targetJson = __assign(__assign({}, updatedViyaTarget.toJson(false)), targetJson);
|
|
108
103
|
return [3 /*break*/, 10];
|
|
@@ -115,7 +110,7 @@ function addTarget(insecure) {
|
|
|
115
110
|
case 10: return [4 /*yield*/, (0, input_1.getIsDefault)()];
|
|
116
111
|
case 11:
|
|
117
112
|
isDefault = _h.sent();
|
|
118
|
-
return [4 /*yield*/, (0, saveConfig_1.saveConfig)(scope, new types_1.Target(targetJson), isDefault,
|
|
113
|
+
return [4 /*yield*/, (0, saveConfig_1.saveConfig)(scope, new types_1.Target(targetJson), isDefault, false)];
|
|
119
114
|
case 12:
|
|
120
115
|
filePath = _h.sent();
|
|
121
116
|
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Target configuration has been saved to ".concat(filePath));
|
|
@@ -140,6 +140,9 @@ describe('sasjs create', function () {
|
|
|
140
140
|
_a.sent();
|
|
141
141
|
return [4 /*yield*/, verifyCreateWeb('.', 'react')];
|
|
142
142
|
case 4:
|
|
143
|
+
_a.sent();
|
|
144
|
+
return [4 /*yield*/, (0, test_1.verifyGitNotPresent)(process.projectDir)];
|
|
145
|
+
case 5:
|
|
143
146
|
_a.sent();
|
|
144
147
|
return [2 /*return*/];
|
|
145
148
|
}
|
|
@@ -164,6 +167,9 @@ describe('sasjs create', function () {
|
|
|
164
167
|
_a.sent();
|
|
165
168
|
return [4 /*yield*/, verifyCreateWeb('test-react-app', 'react')];
|
|
166
169
|
case 4:
|
|
170
|
+
_a.sent();
|
|
171
|
+
return [4 /*yield*/, (0, test_1.verifyGitNotPresent)(process.projectDir)];
|
|
172
|
+
case 5:
|
|
167
173
|
_a.sent();
|
|
168
174
|
return [2 /*return*/];
|
|
169
175
|
}
|
|
@@ -212,6 +218,9 @@ describe('sasjs create', function () {
|
|
|
212
218
|
_a.sent();
|
|
213
219
|
return [4 /*yield*/, verifyCreateWeb('test-angular-app', 'angular')];
|
|
214
220
|
case 4:
|
|
221
|
+
_a.sent();
|
|
222
|
+
return [4 /*yield*/, (0, test_1.verifyGitNotPresent)(process.projectDir)];
|
|
223
|
+
case 5:
|
|
215
224
|
_a.sent();
|
|
216
225
|
return [2 /*return*/];
|
|
217
226
|
}
|
|
@@ -330,11 +330,12 @@ function deployToSas9(deployScriptName, target, linesToExecute, logFolder, strea
|
|
|
330
330
|
* Deploys app to `SASJS` server.
|
|
331
331
|
* @param {Target} target- the target having deploy configuration.
|
|
332
332
|
* @param {object} sasjs - optional configuration object of SAS adapter.
|
|
333
|
+
* @param {object} streamConfig - optional config for deploying streaming app.
|
|
333
334
|
*/
|
|
334
335
|
function deployToSasjs(target, sasjs, streamConfig) {
|
|
335
336
|
var _a, _b, _c;
|
|
336
337
|
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, e_2, result,
|
|
338
|
+
var buildDestinationFolder, finalFilePathJSON, jsonContent, payload, authConfig, e_2, result, webAppStreamUrl;
|
|
338
339
|
return __generator(this, function (_d) {
|
|
339
340
|
switch (_d.label) {
|
|
340
341
|
case 0:
|
|
@@ -363,7 +364,7 @@ function deployToSasjs(target, sasjs, streamConfig) {
|
|
|
363
364
|
e_2 = _d.sent();
|
|
364
365
|
return [3 /*break*/, 5];
|
|
365
366
|
case 5: return [4 /*yield*/, sasjs
|
|
366
|
-
.deployToSASjs(payload, undefined, authConfig)
|
|
367
|
+
.deployToSASjs(payload, undefined, streamConfig, authConfig)
|
|
367
368
|
.catch(function (err) {
|
|
368
369
|
var _a;
|
|
369
370
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error(err);
|
|
@@ -376,9 +377,8 @@ function deployToSasjs(target, sasjs, streamConfig) {
|
|
|
376
377
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Payload example:\n".concat(JSON.stringify(result.example, null, 2)));
|
|
377
378
|
}
|
|
378
379
|
}
|
|
379
|
-
if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
|
|
380
|
-
|
|
381
|
-
webAppStreamUrl = "".concat(target.serverUrl, "/AppStream").concat(appLoc);
|
|
380
|
+
if ((streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) && (result === null || result === void 0 ? void 0 : result.streamServiceName)) {
|
|
381
|
+
webAppStreamUrl = "".concat(target.serverUrl, "/AppStream/").concat(result.streamServiceName);
|
|
382
382
|
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Web app is available at ".concat(webAppStreamUrl));
|
|
383
383
|
}
|
|
384
384
|
return [2 /*return*/];
|
|
@@ -78,7 +78,7 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
78
78
|
});
|
|
79
79
|
}); });
|
|
80
80
|
it("should deploy compile and build to sasjs/server", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
-
var sasjs, customTarget, macroCorePath, mf_getuser, mp_jsonout, ms_webout, webout;
|
|
81
|
+
var sasjs, customTarget, macroCorePath, mf_getuser, mp_jsonout, ms_webout, webout, streamConfig;
|
|
82
82
|
return __generator(this, function (_a) {
|
|
83
83
|
switch (_a.label) {
|
|
84
84
|
case 0:
|
|
@@ -125,6 +125,13 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
125
125
|
' ,showmeta=&showmeta\n' +
|
|
126
126
|
' )' +
|
|
127
127
|
' %mend;\n';
|
|
128
|
+
streamConfig = {
|
|
129
|
+
assetPaths: [],
|
|
130
|
+
streamServiceName: 'clickme',
|
|
131
|
+
streamWeb: false,
|
|
132
|
+
streamWebFolder: '',
|
|
133
|
+
webSourcePath: ''
|
|
134
|
+
};
|
|
128
135
|
expect(sasjs.deployToSASjs).toHaveBeenCalledWith({
|
|
129
136
|
members: [
|
|
130
137
|
{
|
|
@@ -152,7 +159,7 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
152
159
|
]
|
|
153
160
|
}
|
|
154
161
|
]
|
|
155
|
-
}, undefined, undefined);
|
|
162
|
+
}, undefined, streamConfig, undefined);
|
|
156
163
|
return [2 /*return*/];
|
|
157
164
|
}
|
|
158
165
|
});
|
package/build/utils/test.d.ts
CHANGED
|
@@ -21,3 +21,4 @@ export declare const verifyDotFiles: (docsFolder: string) => Promise<void>;
|
|
|
21
21
|
export declare const verifyDotFilesNotGenerated: (docsFolder: string) => Promise<void>;
|
|
22
22
|
export declare const verifyCompiledService: (compiledContent: string, macrosToTest: string[], checkInit?: boolean, checkTerm?: boolean) => Promise<void>;
|
|
23
23
|
export declare const verifyCompiledJob: (compiledContent: string, macrosToTest: string[], checkInit?: boolean, checkTerm?: boolean) => Promise<void>;
|
|
24
|
+
export declare const verifyGitNotPresent: (folder: string) => Promise<void>;
|
package/build/utils/test.js
CHANGED
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.verifyCompiledJob = exports.verifyCompiledService = exports.verifyDotFilesNotGenerated = exports.verifyDotFiles = exports.verifyDocs = exports.updateConfig = exports.updateTarget = exports.removeAllTargetsFromConfigs = exports.verifyPackageJsonContent = exports.verifyFolder = exports.mockProcessExit = exports.verifyStep = exports.createTestGlobalTarget = exports.generateTestTarget = exports.removeTestServerFolder = exports.removeTestApp = exports.createTestMinimalApp = exports.createTestJobsApp = exports.createTestApp = void 0;
|
|
53
|
+
exports.verifyGitNotPresent = exports.verifyCompiledJob = exports.verifyCompiledService = exports.verifyDotFilesNotGenerated = exports.verifyDotFiles = exports.verifyDocs = exports.updateConfig = exports.updateTarget = exports.removeAllTargetsFromConfigs = exports.verifyPackageJsonContent = exports.verifyFolder = exports.mockProcessExit = exports.verifyStep = exports.createTestGlobalTarget = exports.generateTestTarget = exports.removeTestServerFolder = exports.removeTestApp = exports.createTestMinimalApp = exports.createTestJobsApp = exports.createTestApp = void 0;
|
|
54
54
|
var path_1 = __importDefault(require("path"));
|
|
55
55
|
var dotenv_1 = __importDefault(require("dotenv"));
|
|
56
56
|
var utils_1 = require("@sasjs/utils");
|
|
@@ -629,3 +629,20 @@ var verifyCompile = function (compiledContent, macrosToTest, checkInit, checkTer
|
|
|
629
629
|
return [2 /*return*/];
|
|
630
630
|
});
|
|
631
631
|
}); };
|
|
632
|
+
var verifyGitNotPresent = function (folder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
633
|
+
var gitFolderOrModules;
|
|
634
|
+
return __generator(this, function (_a) {
|
|
635
|
+
switch (_a.label) {
|
|
636
|
+
case 0: return [4 /*yield*/, (0, utils_1.listFilesAndSubFoldersInFolder)(folder, true)];
|
|
637
|
+
case 1:
|
|
638
|
+
gitFolderOrModules = (_a.sent()).filter(function (sub) {
|
|
639
|
+
return /\.git$/.test(sub) ||
|
|
640
|
+
new RegExp(".git".concat(utils_1.pathSepEscaped)).test(sub) ||
|
|
641
|
+
/\.gitmodules/.test(sub);
|
|
642
|
+
});
|
|
643
|
+
expect(gitFolderOrModules.length).toEqual(0);
|
|
644
|
+
return [2 /*return*/];
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}); };
|
|
648
|
+
exports.verifyGitNotPresent = verifyGitNotPresent;
|
package/build/utils/utils.js
CHANGED
|
@@ -191,8 +191,19 @@ function createApp(folderPath, repoUrl, installDependencies) {
|
|
|
191
191
|
var spinner = (0, ora_1.default)("Creating SASjs project in ".concat(folderPath, "."));
|
|
192
192
|
spinner.start();
|
|
193
193
|
var gitBranch = repoUrl.includes('template_sasonly') ? 'master' : 'main';
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
var gitVersion = (shelljs_1.default
|
|
195
|
+
.exec("git version", { silent: true })
|
|
196
|
+
.stdout.match(/(?<!git version)\d+\.\d+\.\d+/) || '')[0].replace(/\./g, '');
|
|
197
|
+
// NOTE: git version 2.13 and greater are using '--recurse-submodules' instead of '--recurse' attribute to clone submodules
|
|
198
|
+
shelljs_1.default.exec("cd \"".concat(folderPath, "\" && git clone --recurse").concat(parseInt(gitVersion) > 2130 ? '-submodules' : '', " --depth 1 -b ").concat(gitBranch, " ").concat(repoUrl, " ."), { silent: true });
|
|
199
|
+
deleteGitFolder(folderPath);
|
|
200
|
+
shelljs_1.default.rm('-f', [path_1.default.join(folderPath, '.gitmodules')]);
|
|
201
|
+
if (repoUrl.includes('react-seed-app')) {
|
|
202
|
+
deleteGitFolder(path_1.default.join(folderPath, 'public', 'docs'));
|
|
203
|
+
}
|
|
204
|
+
else if (repoUrl.includes('angular-seed-app')) {
|
|
205
|
+
deleteGitFolder(path_1.default.join(folderPath, 'docs'));
|
|
206
|
+
}
|
|
196
207
|
spinner.stop();
|
|
197
208
|
if (installDependencies) {
|
|
198
209
|
spinner.text = 'Installing dependencies...';
|
|
@@ -203,6 +214,9 @@ function createApp(folderPath, repoUrl, installDependencies) {
|
|
|
203
214
|
spinner.stop();
|
|
204
215
|
}
|
|
205
216
|
}
|
|
217
|
+
var deleteGitFolder = function (folderPath) {
|
|
218
|
+
return shelljs_1.default.rm('-rf', path_1.default.join(folderPath, '.git'));
|
|
219
|
+
};
|
|
206
220
|
function setupNpmProject(folderName) {
|
|
207
221
|
return __awaiter(this, void 0, void 0, function () {
|
|
208
222
|
var folderPath;
|
|
@@ -241,7 +255,7 @@ exports.setupNpmProject = setupNpmProject;
|
|
|
241
255
|
function setupGitIgnore(folderName) {
|
|
242
256
|
var _a, _b;
|
|
243
257
|
return __awaiter(this, void 0, void 0, function () {
|
|
244
|
-
var gitIgnoreFilePath, gitIgnoreExists, gitIgnoreContent, newgitIgnoreContent, regExpSasjsBuild, regExpSasjsResults, regExpNodeModules
|
|
258
|
+
var gitIgnoreFilePath, gitIgnoreExists, gitIgnoreContent, newgitIgnoreContent, regExpSasjsBuild, regExpSasjsResults, regExpNodeModules;
|
|
245
259
|
return __generator(this, function (_c) {
|
|
246
260
|
switch (_c.label) {
|
|
247
261
|
case 0:
|
|
@@ -278,17 +292,7 @@ function setupGitIgnore(folderName) {
|
|
|
278
292
|
_c.sent();
|
|
279
293
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.success('.gitignore file has been created.');
|
|
280
294
|
_c.label = 7;
|
|
281
|
-
case 7:
|
|
282
|
-
folderPath = path_1.default.join(process.projectDir, folderName);
|
|
283
|
-
return [4 /*yield*/, (0, utils_1.folderExists)(path_1.default.join(folderPath, '.git'))];
|
|
284
|
-
case 8:
|
|
285
|
-
gitDirectoryExists = _c.sent();
|
|
286
|
-
if (!gitDirectoryExists) {
|
|
287
|
-
shelljs_1.default.exec("cd ".concat(folderName, " && git init"), {
|
|
288
|
-
silent: true
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
return [2 /*return*/];
|
|
295
|
+
case 7: return [2 /*return*/];
|
|
292
296
|
}
|
|
293
297
|
});
|
|
294
298
|
});
|
package/package.json
CHANGED
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@sasjs/adapter": "
|
|
50
|
+
"@sasjs/adapter": "3.8.0",
|
|
51
51
|
"@sasjs/core": "4.15.3",
|
|
52
52
|
"@sasjs/lint": "1.11.2",
|
|
53
|
-
"@sasjs/utils": "2.
|
|
53
|
+
"@sasjs/utils": "2.40.1",
|
|
54
54
|
"chalk": "4.1.2",
|
|
55
55
|
"csv-stringify": "5.6.5",
|
|
56
56
|
"dotenv": "10.0.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typescript": "4.5.4",
|
|
95
95
|
"util": "0.12.4"
|
|
96
96
|
},
|
|
97
|
-
"version": "3.
|
|
97
|
+
"version": "3.12.1"
|
|
98
98
|
}
|