@backstage/cli
Version:
CLI for developing Backstage plugins and apps
111 lines (104 loc) • 4.19 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var factory = require('../../wiring/factory.cjs.js');
var yargs = require('yargs');
var commander = require('commander');
var lazy = require('../../lib/lazy.cjs.js');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
var yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
const configOption = [
"--config <path>",
"Config files to load instead of app-config.yaml",
(opt, opts) => opts ? [...opts, opt] : [opt],
Array()
];
var index = factory.createCliPlugin({
pluginId: "config",
init: async (reg) => {
reg.addCommand({
path: ["config:docs"],
description: "Browse the configuration reference documentation",
execute: async ({ args }) => {
const command = new commander.Command();
const defaultCommand = command.option(
"--package <name>",
"Only include the schema that applies to the given package"
).description("Browse the configuration reference documentation").action(lazy.lazy(() => import('./commands/docs.cjs.js'), "default"));
await defaultCommand.parseAsync(args, { from: "user" });
}
});
reg.addCommand({
path: ["config", "docs"],
description: "Browse the configuration reference documentation",
execute: async ({ args, info }) => {
await new commander.Command(info.usage).option(
"--package <name>",
"Only include the schema that applies to the given package"
).description(info.description).action(lazy.lazy(() => import('./commands/docs.cjs.js'), "default")).parseAsync(args, { from: "user" });
}
});
reg.addCommand({
path: ["config:print"],
description: "Print the app configuration for the current package",
execute: async ({ args, info }) => {
const argv = await yargs__default.default.options({
package: { type: "string" },
lax: { type: "boolean" },
frontend: { type: "boolean" },
"with-secrets": { type: "boolean" },
format: { type: "string" },
config: { type: "string", array: true, default: [] }
}).usage("$0", info.description).help().parse(args);
await lazy.lazy(() => import('./commands/print.cjs.js'), "default")(argv);
}
});
reg.addCommand({
path: ["config:check"],
description: "Validate that the given configuration loads and matches schema",
execute: async ({ args }) => {
const argv = await yargs__default.default.options({
package: { type: "string" },
lax: { type: "boolean" },
frontend: { type: "boolean" },
deprecated: { type: "boolean" },
strict: { type: "boolean" },
config: {
type: "string",
array: true,
default: []
}
}).help().parse(args);
await lazy.lazy(() => import('./commands/validate.cjs.js'), "default")(argv);
}
});
reg.addCommand({
path: ["config:schema"],
description: "Print the JSON schema for the given configuration",
execute: async ({ args }) => {
const argv = await yargs__default.default.options({
package: { type: "string" },
format: { type: "string" },
merge: { type: "boolean" },
"no-merge": { type: "boolean" }
}).help().parse(args);
await lazy.lazy(() => import('./commands/schema.cjs.js'), "default")(argv);
}
});
reg.addCommand({
path: ["config", "schema"],
description: "Print the JSON schema for the given configuration",
execute: async ({ args }) => {
const argv = await yargs__default.default.options({
package: { type: "string" },
format: { type: "string" },
merge: { type: "boolean" },
"no-merge": { type: "boolean" }
}).help().parse(args);
await lazy.lazy(() => import('./commands/schema.cjs.js'), "default")(argv);
}
});
}
});
exports.configOption = configOption;
exports.default = index;
//# sourceMappingURL=index.cjs.js.map