@sasjs/cli 4.0.5 → 4.0.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/build/commands/build/build.d.ts +1 -1
- package/build/commands/build/build.js +9 -14
- package/build/commands/compile/compile.js +6 -6
- package/build/commands/compile/internal/compileTestFile.d.ts +1 -1
- package/build/commands/compile/internal/compileTestFile.js +4 -4
- package/build/commands/compile/internal/getAllFolders.d.ts +1 -1
- package/build/commands/compile/internal/loadDependencies.d.ts +1 -1
- package/build/commands/compile/internal/loadDependencies.js +1 -1
- package/build/commands/docs/docsCommand.js +4 -9
- package/build/utils/config.js +19 -14
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServerType, Target } from '@sasjs/utils';
|
|
2
2
|
export declare function build(target: Target): Promise<void>;
|
|
3
3
|
export declare function getWebServiceScriptInvocation(serverType: ServerType, isSASFile?: boolean, encoded?: boolean): string;
|
|
4
4
|
export declare function getBuildVars(target: Target): Promise<string>;
|
|
@@ -87,17 +87,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
87
87
|
};
|
|
88
88
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
89
|
exports.getBuildVars = exports.getWebServiceScriptInvocation = exports.build = void 0;
|
|
90
|
-
var path_1 = __importDefault(require("path"));
|
|
91
90
|
var utils_1 = require("@sasjs/utils");
|
|
92
91
|
var error_1 = require("@sasjs/utils/error");
|
|
93
|
-
var
|
|
92
|
+
var path_1 = __importDefault(require("path"));
|
|
93
|
+
var types_1 = require("@sasjs/utils/types");
|
|
94
|
+
var compressAndSave_1 = require("../../utils/compressAndSave");
|
|
94
95
|
var config_1 = require("../../utils/config");
|
|
96
|
+
var file_1 = require("../../utils/file");
|
|
95
97
|
var compile_1 = require("../compile/compile");
|
|
98
|
+
var loadDependencies_1 = require("../compile/internal/loadDependencies");
|
|
96
99
|
var config_2 = require("./internal/config");
|
|
97
100
|
var getLaunchPageCode_1 = require("./internal/getLaunchPageCode");
|
|
98
|
-
var types_1 = require("@sasjs/utils/types");
|
|
99
|
-
var compressAndSave_1 = require("../../utils/compressAndSave");
|
|
100
|
-
var loadDependencies_1 = require("../compile/internal/loadDependencies");
|
|
101
101
|
function build(target) {
|
|
102
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
103
|
var _a;
|
|
@@ -515,15 +515,10 @@ function getBuildVars(target) {
|
|
|
515
515
|
return __awaiter(this, void 0, void 0, function () {
|
|
516
516
|
var targetBuildVars, configuration, commonBuildVars;
|
|
517
517
|
return __generator(this, function (_e) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
case 1:
|
|
523
|
-
configuration = _e.sent();
|
|
524
|
-
commonBuildVars = (_d = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _c === void 0 ? void 0 : _c.macroVars) !== null && _d !== void 0 ? _d : {};
|
|
525
|
-
return [2 /*return*/, convertVarsToSasFormat(__assign(__assign({}, commonBuildVars), targetBuildVars))];
|
|
526
|
-
}
|
|
518
|
+
targetBuildVars = (_b = (_a = target === null || target === void 0 ? void 0 : target.buildConfig) === null || _a === void 0 ? void 0 : _a.macroVars) !== null && _b !== void 0 ? _b : {};
|
|
519
|
+
configuration = process.sasjsConfig;
|
|
520
|
+
commonBuildVars = (_d = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.buildConfig) === null || _c === void 0 ? void 0 : _c.macroVars) !== null && _d !== void 0 ? _d : {};
|
|
521
|
+
return [2 /*return*/, convertVarsToSasFormat(__assign(__assign({}, commonBuildVars), targetBuildVars))];
|
|
527
522
|
});
|
|
528
523
|
});
|
|
529
524
|
}
|
|
@@ -74,20 +74,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
74
74
|
};
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
76
|
exports.compileJobsServicesTests = exports.copyFilesToBuildFolder = exports.compile = void 0;
|
|
77
|
+
var utils_1 = require("@sasjs/utils");
|
|
78
|
+
var types_1 = require("@sasjs/utils/types");
|
|
77
79
|
var path_1 = __importDefault(require("path"));
|
|
78
80
|
var config_1 = require("../../utils/config");
|
|
79
|
-
var utils_1 = require("@sasjs/utils");
|
|
80
|
-
var web_1 = require("../web/web");
|
|
81
81
|
var file_1 = require("../../utils/file");
|
|
82
|
-
var
|
|
83
|
-
var checkCompileStatus_1 = require("./internal/checkCompileStatus");
|
|
82
|
+
var web_1 = require("../web/web");
|
|
84
83
|
var compileModule = __importStar(require("./compile"));
|
|
85
|
-
var
|
|
84
|
+
var checkCompileStatus_1 = require("./internal/checkCompileStatus");
|
|
86
85
|
var compileFile_1 = require("./internal/compileFile");
|
|
86
|
+
var getAllFolders_1 = require("./internal/getAllFolders");
|
|
87
87
|
var compileTestFile_1 = require("./internal/compileTestFile");
|
|
88
|
+
var copySyncFolder_1 = require("./internal/copySyncFolder");
|
|
88
89
|
var getDestinationPath_1 = require("./internal/getDestinationPath");
|
|
89
90
|
var loadDependencies_1 = require("./internal/loadDependencies");
|
|
90
|
-
var copySyncFolder_1 = require("./internal/copySyncFolder");
|
|
91
91
|
function compile(target, forceCompile) {
|
|
92
92
|
var _a, _b;
|
|
93
93
|
if (forceCompile === void 0) { forceCompile = false; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { CompileTree, Configuration, Target } from '@sasjs/utils';
|
|
1
2
|
import { TestFlow } from '../../../types';
|
|
2
|
-
import { Target, Configuration, CompileTree } from '@sasjs/utils';
|
|
3
3
|
export declare function compileTestFile(target: Target, filePath: string, testVar: string | undefined, saveToRoot: boolean | undefined, removeOriginalFile: boolean | undefined, compileTree: CompileTree): Promise<void>;
|
|
4
4
|
export declare function copyTestMacroFiles(folderAbsolutePath: string): Promise<void>;
|
|
5
5
|
export declare const compileTestFlow: (target: Target, config?: Configuration) => Promise<TestFlow | undefined>;
|
|
@@ -65,13 +65,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
65
65
|
};
|
|
66
66
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
67
|
exports.compileTestFlow = exports.copyTestMacroFiles = exports.compileTestFile = void 0;
|
|
68
|
-
var types_1 = require("../../../types");
|
|
69
|
-
var path_1 = __importDefault(require("path"));
|
|
70
68
|
var utils_1 = require("@sasjs/utils");
|
|
71
|
-
var loadDependencies_1 = require("./loadDependencies");
|
|
72
|
-
var file_1 = require("../../../utils/file");
|
|
73
69
|
var chalk_1 = __importDefault(require("chalk"));
|
|
70
|
+
var path_1 = __importDefault(require("path"));
|
|
71
|
+
var types_1 = require("../../../types");
|
|
74
72
|
var config_1 = require("../../../utils/config");
|
|
73
|
+
var file_1 = require("../../../utils/file");
|
|
74
|
+
var loadDependencies_1 = require("./loadDependencies");
|
|
75
75
|
var getFileName = function (filePath) { return path_1.default.parse(filePath).base; };
|
|
76
76
|
function compileTestFile(target, filePath, testVar, saveToRoot, removeOriginalFile, compileTree) {
|
|
77
77
|
if (testVar === void 0) { testVar = ''; }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CompileTree, SASJsFileType, Target } from '@sasjs/utils';
|
|
2
2
|
export declare function loadDependencies(target: Target, filePath: string, macroFolders: string[], programFolders: string[], type: SASJsFileType, compileTree: CompileTree): Promise<string>;
|
|
3
3
|
export declare const getCompileTree: (target: Target) => CompileTree;
|
|
@@ -41,8 +41,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.getCompileTree = exports.loadDependencies = void 0;
|
|
43
43
|
var utils_1 = require("@sasjs/utils");
|
|
44
|
-
var config_1 = require("../../../utils/config");
|
|
45
44
|
var path_1 = __importDefault(require("path"));
|
|
45
|
+
var config_1 = require("../../../utils/config");
|
|
46
46
|
function loadDependencies(target, filePath, macroFolders, programFolders, type, compileTree) {
|
|
47
47
|
var _a;
|
|
48
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -55,7 +55,6 @@ exports.DocsCommand = void 0;
|
|
|
55
55
|
var __1 = require("..");
|
|
56
56
|
var command_1 = require("../../types/command");
|
|
57
57
|
var targetCommand_1 = require("../../types/command/targetCommand");
|
|
58
|
-
var utils_1 = require("../../utils");
|
|
59
58
|
var DocSubCommand;
|
|
60
59
|
(function (DocSubCommand) {
|
|
61
60
|
DocSubCommand["Init"] = "init";
|
|
@@ -137,9 +136,7 @@ var DocsCommand = /** @class */ (function (_super) {
|
|
|
137
136
|
case 0: return [4 /*yield*/, this.getTargetInfo()];
|
|
138
137
|
case 1:
|
|
139
138
|
target = (_a.sent()).target;
|
|
140
|
-
|
|
141
|
-
case 2:
|
|
142
|
-
config = _a.sent();
|
|
139
|
+
config = process.sasjsConfig;
|
|
143
140
|
return [4 /*yield*/, (0, __1.generateDocs)(target, config, this.parsed.outDirectory)
|
|
144
141
|
.then(function (res) {
|
|
145
142
|
var _a;
|
|
@@ -151,7 +148,7 @@ var DocsCommand = /** @class */ (function (_super) {
|
|
|
151
148
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error generating docs: ', err);
|
|
152
149
|
return command_1.ReturnCode.InternalError;
|
|
153
150
|
})];
|
|
154
|
-
case
|
|
151
|
+
case 2:
|
|
155
152
|
returnCode = _a.sent();
|
|
156
153
|
return [2 /*return*/, returnCode];
|
|
157
154
|
}
|
|
@@ -166,9 +163,7 @@ var DocsCommand = /** @class */ (function (_super) {
|
|
|
166
163
|
case 0: return [4 /*yield*/, this.getTargetInfo()];
|
|
167
164
|
case 1:
|
|
168
165
|
target = (_a.sent()).target;
|
|
169
|
-
|
|
170
|
-
case 2:
|
|
171
|
-
config = _a.sent();
|
|
166
|
+
config = process.sasjsConfig;
|
|
172
167
|
return [4 /*yield*/, (0, __1.generateDot)(target, config, this.parsed.outDirectory)
|
|
173
168
|
.then(function (res) {
|
|
174
169
|
var _a;
|
|
@@ -180,7 +175,7 @@ var DocsCommand = /** @class */ (function (_super) {
|
|
|
180
175
|
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error generating docs: ', err);
|
|
181
176
|
return command_1.ReturnCode.InternalError;
|
|
182
177
|
})];
|
|
183
|
-
case
|
|
178
|
+
case 2:
|
|
184
179
|
returnCode = _a.sent();
|
|
185
180
|
return [2 /*return*/, returnCode];
|
|
186
181
|
}
|
package/build/utils/config.js
CHANGED
|
@@ -879,26 +879,31 @@ function getAuthConfig(target) {
|
|
|
879
879
|
}
|
|
880
880
|
exports.getAuthConfig = getAuthConfig;
|
|
881
881
|
var saveTokens = function (targetName, client, secret, access_token, refresh_token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
882
|
-
var
|
|
883
|
-
var _a, _b, _c
|
|
884
|
-
return __generator(this, function (
|
|
885
|
-
switch (
|
|
886
|
-
case 0: return [4 /*yield*/, getLocalConfig()
|
|
882
|
+
var isLocalTarget, envFileContent, envFilePath, globalConfig, target, targetJson;
|
|
883
|
+
var _a, _b, _c;
|
|
884
|
+
return __generator(this, function (_d) {
|
|
885
|
+
switch (_d.label) {
|
|
886
|
+
case 0: return [4 /*yield*/, getLocalConfig()
|
|
887
|
+
.then(function (localConfig) { var _a; return (_a = localConfig.targets) === null || _a === void 0 ? void 0 : _a.some(function (t) { return t.name === targetName; }); })
|
|
888
|
+
.catch(function () {
|
|
889
|
+
var _a;
|
|
890
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info('Local sasjsconfig.json file could not be found! Now finding target in global .sasjsrc file');
|
|
891
|
+
return false;
|
|
892
|
+
})];
|
|
887
893
|
case 1:
|
|
888
|
-
|
|
889
|
-
isLocalTarget = (_a = localConfig.targets) === null || _a === void 0 ? void 0 : _a.some(function (t) { return t.name === targetName; });
|
|
894
|
+
isLocalTarget = _d.sent();
|
|
890
895
|
if (!isLocalTarget) return [3 /*break*/, 3];
|
|
891
896
|
envFileContent = "CLIENT=".concat(client, "\nSECRET=").concat(secret, "\nACCESS_TOKEN=").concat(access_token, "\nREFRESH_TOKEN=").concat(refresh_token, "\n");
|
|
892
897
|
envFilePath = path_1.default.join(process.projectDir, ".env.".concat(targetName));
|
|
893
898
|
return [4 /*yield*/, (0, utils_1.createFile)(envFilePath, envFileContent)];
|
|
894
899
|
case 2:
|
|
895
|
-
|
|
896
|
-
(
|
|
900
|
+
_d.sent();
|
|
901
|
+
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Environment file saved at ".concat(envFilePath));
|
|
897
902
|
return [3 /*break*/, 6];
|
|
898
903
|
case 3: return [4 /*yield*/, getGlobalRcFile()];
|
|
899
904
|
case 4:
|
|
900
|
-
globalConfig =
|
|
901
|
-
target = (
|
|
905
|
+
globalConfig = _d.sent();
|
|
906
|
+
target = (_b = globalConfig.targets) === null || _b === void 0 ? void 0 : _b.find(function (t) { return t.name === targetName; });
|
|
902
907
|
if (!target) {
|
|
903
908
|
throw new Error(ERROR_MESSAGE(targetName).NOT_FOUND_TARGET_NAME);
|
|
904
909
|
}
|
|
@@ -906,9 +911,9 @@ var saveTokens = function (targetName, client, secret, access_token, refresh_tok
|
|
|
906
911
|
targetJson.authConfig = { client: client, secret: secret, access_token: access_token, refresh_token: refresh_token };
|
|
907
912
|
return [4 /*yield*/, saveToGlobalConfig(new utils_1.Target(targetJson), globalConfig.defaultTarget === targetName)];
|
|
908
913
|
case 5:
|
|
909
|
-
|
|
910
|
-
(
|
|
911
|
-
|
|
914
|
+
_d.sent();
|
|
915
|
+
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.success("Target saved to global .sasjsrc file at ~/.sasjsrc.");
|
|
916
|
+
_d.label = 6;
|
|
912
917
|
case 6: return [2 /*return*/];
|
|
913
918
|
}
|
|
914
919
|
});
|
package/package.json
CHANGED