@microsoft/azure-data-factory-utilities
Version:
Azure Data Factory utilities library
47 lines (46 loc) • 1.66 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateNodeVersion = exports.escapeArgIfNeeded = exports.processArguments = exports.printToConsole = void 0;
function printToConsole(message) {
// eslint-disable-next-line no-console
console.log(message);
}
exports.printToConsole = printToConsole;
function processArguments(program) {
var args = processArgumentsInternal(program);
return args.map(function (a) { return escapeArgIfNeeded(a); });
}
exports.processArguments = processArguments;
function escapeArgIfNeeded(arg) {
return arg.includes(' ') ? "\"".concat(arg, "\"") : arg;
}
exports.escapeArgIfNeeded = escapeArgIfNeeded;
function validateNodeVersion() {
var supportedVersions = [20, 22];
if (process.versions.node !== void 0) {
// eslint-disable-next-line radix
var majorVersion = parseInt(process.versions.node.split('.')[0]);
if (!supportedVersions.includes(majorVersion)) {
console.warn("##[warning]Using unsupported node version: ".concat(process.versions.node, ", use version 20.x or 22.x to avoid running into failures."));
}
}
}
exports.validateNodeVersion = validateNodeVersion;
function processArgumentsInternal(program) {
var options = program.opts();
var offset = 2;
if (options.nodeoptions) {
offset += 2;
}
if (options.url) {
offset += 2;
}
if (options.path) {
offset += 2;
}
if (options.preview) {
offset += 1;
printToConsole('Using preview options');
}
return process.argv.slice(offset);
}
;