@sasjs/cli 4.0.3 → 4.0.4
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.
|
@@ -95,7 +95,8 @@ var getDocConfig_1 = require("./internal/getDocConfig");
|
|
|
95
95
|
function generateDocs(target, config, outDirectory) {
|
|
96
96
|
var _a, _b;
|
|
97
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var _c, serverUrl, newOutDirectory, enableLineage, doxyContentFromConfig, _d, macroCoreFolders, macroFolders, programFolders, serviceFolders, jobFolders, combinedFolders, PROJECT_NAME, PROJECT_BRIEF, packageJsonContent, packageJson, e_1, doxyContent, doxyParams, doxyConfigPath, spinner, pathExists, _e, stderr, code, foldersListForDot;
|
|
98
|
+
var _c, serverUrl, newOutDirectory, enableLineage, doxyContentFromConfig, _d, macroCoreFolders, macroFolders, programFolders, serviceFolders, jobFolders, combinedFolders, PROJECT_NAME, PROJECT_BRIEF, packageJsonContent, packageJson, e_1, doxyContent, layoutFilePath, LAYOUT_FILE, doxyParams, doxyConfigPath, spinner, pathExists, _e, stderr, code, foldersListForDot;
|
|
99
|
+
var _this = this;
|
|
99
100
|
return __generator(this, function (_f) {
|
|
100
101
|
switch (_f.label) {
|
|
101
102
|
case 0:
|
|
@@ -132,6 +133,29 @@ function generateDocs(target, config, outDirectory) {
|
|
|
132
133
|
doxyContent = __assign({ favIcon: 'favicon.ico', footer: 'new_footer.html', header: 'new_header.html', layout: 'DoxygenLayout.xml', logo: 'logo.png', readMe: '../../README.md', stylesheet: 'new_stylesheet.css', path: path_1.default.join(process.projectDir, 'sasjs', 'doxy') }, doxyContentFromConfig);
|
|
133
134
|
if (doxyContentFromConfig === null || doxyContentFromConfig === void 0 ? void 0 : doxyContentFromConfig.path)
|
|
134
135
|
doxyContent.path = (0, utils_1.getAbsolutePath)(doxyContentFromConfig.path, process.projectDir);
|
|
136
|
+
layoutFilePath = path_1.default.join(doxyContent.path, doxyContent.layout);
|
|
137
|
+
return [4 /*yield*/, (0, utils_1.readFile)(layoutFilePath).then(function (content) { return __awaiter(_this, void 0, void 0, function () {
|
|
138
|
+
var testString, replaced, timeStamp, tmpFilePath;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
switch (_a.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
if (enableLineage)
|
|
143
|
+
return [2 /*return*/, layoutFilePath
|
|
144
|
+
// if enableLineage is false, create a tmp layout file without lineage tab
|
|
145
|
+
];
|
|
146
|
+
testString = "<tab type=\"user\" url=\"data_lineage.svg\" title=\"Lineage\"/>";
|
|
147
|
+
replaced = content.replace(testString, '');
|
|
148
|
+
timeStamp = (0, utils_1.generateTimestamp)();
|
|
149
|
+
tmpFilePath = path_1.default.join(doxyContent.path, "".concat(timeStamp, "-DoxygenLayout.xml"));
|
|
150
|
+
return [4 /*yield*/, (0, utils_1.createFile)(tmpFilePath, replaced)];
|
|
151
|
+
case 1:
|
|
152
|
+
_a.sent();
|
|
153
|
+
return [2 /*return*/, tmpFilePath];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); })];
|
|
157
|
+
case 5:
|
|
158
|
+
LAYOUT_FILE = _f.sent();
|
|
135
159
|
doxyParams = setVariableCmd({
|
|
136
160
|
DOXY_HTML_OUTPUT: newOutDirectory,
|
|
137
161
|
DOXY_INPUT: "\"".concat(path_1.default.join(doxyContent.path, doxyContent.readMe), "\" ").concat(combinedFolders),
|
|
@@ -139,47 +163,59 @@ function generateDocs(target, config, outDirectory) {
|
|
|
139
163
|
HTML_EXTRA_STYLESHEET: "\"".concat(path_1.default.join(doxyContent.path, doxyContent.stylesheet), "\""),
|
|
140
164
|
HTML_FOOTER: path_1.default.join(doxyContent.path, doxyContent.footer),
|
|
141
165
|
HTML_HEADER: path_1.default.join(doxyContent.path, doxyContent.header),
|
|
142
|
-
LAYOUT_FILE:
|
|
166
|
+
LAYOUT_FILE: LAYOUT_FILE,
|
|
143
167
|
PROJECT_BRIEF: PROJECT_BRIEF,
|
|
144
168
|
PROJECT_LOGO: path_1.default.join(doxyContent.path, doxyContent.logo),
|
|
145
169
|
PROJECT_NAME: PROJECT_NAME
|
|
146
170
|
});
|
|
147
171
|
return [4 /*yield*/, getDoxyConfigPath(doxyContent.path)];
|
|
148
|
-
case
|
|
172
|
+
case 6:
|
|
149
173
|
doxyConfigPath = _f.sent();
|
|
150
174
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Using ".concat(doxyConfigPath, " as Doxygen Configuration."));
|
|
151
175
|
spinner = (0, ora_1.default)(chalk_1.default.greenBright('Generating docs', chalk_1.default.cyanBright(newOutDirectory)));
|
|
152
176
|
if (process.env.LOG_LEVEL !== utils_1.LogLevel.Debug)
|
|
153
177
|
spinner.start();
|
|
154
178
|
return [4 /*yield*/, (0, utils_1.fileExists)(newOutDirectory)];
|
|
155
|
-
case
|
|
179
|
+
case 7:
|
|
156
180
|
pathExists = _f.sent();
|
|
157
|
-
if (!pathExists) return [3 /*break*/,
|
|
181
|
+
if (!pathExists) return [3 /*break*/, 9];
|
|
158
182
|
return [4 /*yield*/, (0, utils_1.deleteFolder)(newOutDirectory)];
|
|
159
|
-
case
|
|
183
|
+
case 8:
|
|
160
184
|
_f.sent();
|
|
161
|
-
_f.label =
|
|
162
|
-
case
|
|
163
|
-
case
|
|
185
|
+
_f.label = 9;
|
|
186
|
+
case 9: return [4 /*yield*/, (0, utils_1.createFolder)(newOutDirectory)];
|
|
187
|
+
case 10:
|
|
164
188
|
_f.sent();
|
|
165
189
|
_e = shelljs_1.default.exec("".concat(doxyParams, " doxygen \"").concat(doxyConfigPath, "\""), {
|
|
166
190
|
silent: process.env.LOG_LEVEL !== utils_1.LogLevel.Debug
|
|
167
191
|
}), stderr = _e.stderr, code = _e.code;
|
|
168
192
|
if (process.env.LOG_LEVEL !== utils_1.LogLevel.Debug)
|
|
169
193
|
spinner.stop();
|
|
194
|
+
if (!!enableLineage) return [3 /*break*/, 12];
|
|
195
|
+
// when enable lineage is false, we are creating a tmp DoxygenLayout.xml file
|
|
196
|
+
// this is same a original but just with removed tab for lineage
|
|
197
|
+
// therefor, we are removing this tmp file once the shell command for doxygen is completed
|
|
198
|
+
return [4 /*yield*/, (0, utils_1.deleteFile)(LAYOUT_FILE)];
|
|
199
|
+
case 11:
|
|
200
|
+
// when enable lineage is false, we are creating a tmp DoxygenLayout.xml file
|
|
201
|
+
// this is same a original but just with removed tab for lineage
|
|
202
|
+
// therefor, we are removing this tmp file once the shell command for doxygen is completed
|
|
203
|
+
_f.sent();
|
|
204
|
+
_f.label = 12;
|
|
205
|
+
case 12:
|
|
170
206
|
if (code !== 0) {
|
|
171
207
|
if (stderr.startsWith('error: ')) {
|
|
172
208
|
throw new Error("\n".concat(stderr));
|
|
173
209
|
}
|
|
174
210
|
throw new Error("The Doxygen application is not installed or configured. This external tool is used by 'sasjs doc'.\n".concat(stderr, "\nPlease download and install from here: https://www.doxygen.nl/download.html#srcbin"));
|
|
175
211
|
}
|
|
176
|
-
if (!enableLineage) return [3 /*break*/,
|
|
212
|
+
if (!enableLineage) return [3 /*break*/, 14];
|
|
177
213
|
foldersListForDot = __spreadArray([], __read(new Set(__spreadArray(__spreadArray([], __read(serviceFolders), false), __read(jobFolders), false))), false);
|
|
178
214
|
return [4 /*yield*/, (0, createDotFiles_1.createDotFiles)(foldersListForDot, newOutDirectory, serverUrl)];
|
|
179
|
-
case
|
|
215
|
+
case 13:
|
|
180
216
|
_f.sent();
|
|
181
|
-
_f.label =
|
|
182
|
-
case
|
|
217
|
+
_f.label = 14;
|
|
218
|
+
case 14: return [2 /*return*/, { outDirectory: newOutDirectory }];
|
|
183
219
|
}
|
|
184
220
|
});
|
|
185
221
|
});
|
package/package.json
CHANGED