@navikt/aksel
Version:
Aksel command line interface. Codemods and other utilities for Aksel users.
45 lines (44 loc) • 2.02 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = __importDefault(require("chalk"));
const commander_1 = require("commander");
const index_1 = require("./codemod/index");
const darkside_1 = require("./darkside");
const help_1 = require("./help");
const version_1 = require("./version");
run();
function run() {
return __awaiter(this, void 0, void 0, function* () {
const program = new commander_1.Command();
program.version(version_1.VERSION, "-v, --version");
program.allowUnknownOption().helpOption(false);
program.parse();
const args = program.args;
if (args.length === 0 || args[0] === "help") {
(0, help_1.helpCommand)();
return;
}
if (args[0] === "codemod") {
if (args.includes("v8-tokens")) {
(0, darkside_1.darksideCommand)();
return;
}
(0, index_1.codemodCommand)();
return;
}
console.info(chalk_1.default.red(`Unknown command: ${args[0]}.\nRun ${chalk_1.default.cyan("npx @navikt/aksel help")} for all available commands.`));
});
}