UNPKG

create-foxglove-extension

Version:

Create and package Foxglove extensions

53 lines (52 loc) 2.3 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const __1 = require(".."); const log_1 = require("../log"); function main(task) { task.catch(log_1.fatal); } commander_1.program.usage("<command> [options]"); commander_1.program .command("build") .description("Build an extension, preparing it for packaging or installation") .addOption(new commander_1.Option("--mode [mode]", "Build mode").choices(["development", "production"])) .option("--cwd [cwd]", "Directory to run the build command in") .action(({ mode, cwd }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment main((0, __1.buildCommand)({ mode, cwd })); }); commander_1.program .command("package") .description("Packages an extension") .option("-o, --out [path]", "Output .foxe extension file to [path] location") .option("--cwd [cwd]", "Directory to run the package command in") .action(({ out, cwd }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment main((0, __1.packageCommand)({ packagePath: out, cwd })); }); commander_1.program .command("install") .description("Locally installs an extension") .option("--cwd [cwd]", "Directory to run the install command in") .action(({ cwd }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment main((0, __1.installCommand)({ cwd })); }); commander_1.program .command("publish") .description("Create an extensions.json entry for a released extension. This can be added to the https://github.com/foxglove/extension-registry repository") .option("--foxe <foxe>", "URL of the published .foxe file") .option("--cwd [cwd]", "Directory containing the extension package.json file") .option("--version [version]", "Version of the published .foxe file") .option("--readme [readme]", "URL of the extension README.md file") .option("--changelog [changelog]", "URL of the extension CHANGELOG.md file") .action((options) => { main((0, __1.publishCommand)(options)); }); commander_1.program.on("command:*", ([_cmd]) => { commander_1.program.outputHelp({ error: true }); process.exit(1); }); commander_1.program.parse(process.argv);