@sasjs/cli
Version:
Command line interface for SASjs
51 lines (50 loc) • 3.03 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDocConfig = void 0;
/**
* Returns doc related config from root-level and Target-specfic(having precedence)
* @param {Configuration} config- from which doc related config will be extracted
* @param {Target} target- the target for doc config.
* @param {string} outDirectory- the name of the output folder, provided using command.
*/
function getDocConfig(target, config, outDirectory) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
var buildDestinationDocsFolder = process.sasjsConstants.buildDestinationDocsFolder;
if (!outDirectory) {
outDirectory =
((_a = target === null || target === void 0 ? void 0 : target.docConfig) === null || _a === void 0 ? void 0 : _a.outDirectory) ||
((_b = config === null || config === void 0 ? void 0 : config.docConfig) === null || _b === void 0 ? void 0 : _b.outDirectory) ||
buildDestinationDocsFolder;
}
var serverUrl = '';
serverUrl = ((_c = config === null || config === void 0 ? void 0 : config.docConfig) === null || _c === void 0 ? void 0 : _c.dataControllerUrl)
? config.docConfig.dataControllerUrl.split('#')[0] + '#/view/viewer/'
: '';
serverUrl = ((_d = target === null || target === void 0 ? void 0 : target.docConfig) === null || _d === void 0 ? void 0 : _d.dataControllerUrl)
? target.docConfig.dataControllerUrl.split('#')[0] + '#/view/viewer/'
: serverUrl;
var enableLineage = (_h = (_f = (_e = target === null || target === void 0 ? void 0 : target.docConfig) === null || _e === void 0 ? void 0 : _e.enableLineage) !== null && _f !== void 0 ? _f : (_g = config === null || config === void 0 ? void 0 : config.docConfig) === null || _g === void 0 ? void 0 : _g.enableLineage) !== null && _h !== void 0 ? _h : true;
var doxyContent = __assign(__assign({}, (_j = config === null || config === void 0 ? void 0 : config.docConfig) === null || _j === void 0 ? void 0 : _j.doxyContent), (_k = target === null || target === void 0 ? void 0 : target.docConfig) === null || _k === void 0 ? void 0 : _k.doxyContent);
if ((_l = doxyContent.path) === null || _l === void 0 ? void 0 : _l.startsWith('//')) {
throw new Error('UNC paths are not supported.\nPlease map to a network drive, or migrate the project to an existing path (with a drive letter).');
}
return {
target: target,
serverUrl: serverUrl,
newOutDirectory: outDirectory,
enableLineage: enableLineage,
doxyContent: doxyContent
};
}
exports.getDocConfig = getDocConfig;