import { Command } from '@modern-js/utils'; import { createAction } from './createAction'; import { getLocaleLanguage } from './utils'; import { i18n, localeKeys } from './locale'; export default function () { // initial cli language i18n.changeLanguage({ locale: getLocaleLanguage() }); const program = new Command(); program .usage('[projectDir]') .description(i18n.t(localeKeys.command.description)) .argument('[projectDir]') .option('-c, --config ', i18n.t(localeKeys.command.config), '{}') .option('--mwa', i18n.t(localeKeys.command.mwa), false) .option('--module', i18n.t(localeKeys.command.module), false) .option('--monorepo', i18n.t(localeKeys.command.monorepo), false) .option( '-p, --plugin ', i18n.t(localeKeys.command.plugin), (val: string, memo: string[]) => { memo.push(val); return memo; }, [], ) .option('--dist-tag ', i18n.t(localeKeys.command.distTag), '') .option('--registry ', i18n.t(localeKeys.command.registry), '') .option('-d,--debug', i18n.t(localeKeys.command.debug), false) .action(createAction); program.parse(process.argv); }