UNPKG

@backstage/cli

Version:

CLI for developing Backstage plugins and apps

83 lines (78 loc) 2.84 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var factory = require('../../wiring/factory.cjs.js'); var commander = require('commander'); var lazy = require('../../lib/lazy.cjs.js'); function registerPackageLintCommand(command) { command.arguments("[directories...]"); command.option("--fix", "Attempt to automatically fix violations"); command.option( "--format <format>", "Lint report output format", "eslint-formatter-friendly" ); command.option( "--output-file <path>", "Write the lint report to a file instead of stdout" ); command.option( "--max-warnings <number>", "Fail if more than this number of warnings. -1 allows warnings. (default: -1)" ); command.description("Lint a package"); command.action(lazy.lazy(() => import('./commands/package/lint.cjs.js'), "default")); } var index = factory.createCliPlugin({ pluginId: "lint", init: async (reg) => { reg.addCommand({ path: ["package", "lint"], description: "Lint a package", execute: async ({ args }) => { const command = new commander.Command(); registerPackageLintCommand(command); await command.parseAsync(args, { from: "user" }); } }); reg.addCommand({ path: ["repo", "lint"], description: "Lint a repository", execute: async ({ args }) => { const command = new commander.Command(); registerPackageLintCommand(command.command("package").command("lint")); command.option("--fix", "Attempt to automatically fix violations"); command.option( "--format <format>", "Lint report output format", "eslint-formatter-friendly" ); command.option( "--output-file <path>", "Write the lint report to a file instead of stdout" ); command.option( "--successCache", "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run" ); command.option( "--successCacheDir <path>", "Set the success cache location, (default: node_modules/.cache/backstage-cli)" ); command.option( "--since <ref>", "Only lint packages that changed since the specified ref" ); command.option( "--max-warnings <number>", "Fail if more than this number of warnings. -1 allows warnings. (default: -1)" ); command.description("Lint a repository"); command.action(lazy.lazy(() => import('./commands/repo/lint.cjs.js'), "command")); await command.parseAsync(args, { from: "user" }); } }); } }); exports.default = index; exports.registerPackageLintCommand = registerPackageLintCommand; //# sourceMappingURL=index.cjs.js.map