sherry-plugin-core
Version:
core plugin for Sherry
28 lines (25 loc) • 1.14 kB
JavaScript
const { handleError } = require('sherry')
module.exports = (api, opts) => {
api.registerCommand(cli => {
cli
.command('<generator> [outDir]', 'Run a generator')
.action(async (generator, outDir = process.cwd(), flags) => {
const start = options => api.sherry
.setOptions(options).run()
.catch(error => handleError(error))
opts.process && await opts.process({
generator,
outDir,
...flags
}, start)
})
.option('--npm-client <name>', 'Use a specific npm client (\'yarn\', \'npm\' or other custom clients, e.g. cnpm)')
.option('--registry <registry>', 'Use a custom registry for npm and yarn')
.option('--git-origin <gitOrigin>', 'Use a custom git origin for pulling generators in git')
.option('--git-protocol <protocol>', 'Protocol to pull git repo, can be http(s) or ssh (defaults to https)')
.option('-o, --out-dir', 'Custom output directory')
.option('-u, --update', 'Update cached generator')
.option('-y, --yes', 'Use the default options')
.option('--debug', 'Running in debug mode')
})
}