Skip to content

Commit

Permalink
feat: new and upgrade command add --time option
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin committed Oct 16, 2024
1 parent 2708941 commit 4f06497
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/generator/new-action/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const main = async () => {
.option('--solution <solution>', 'solution', '')
.option('--config <config>', 'config', '{}')
.option('--root-path <rootPath>', 'project root path', '')
.option('--debug', 'using debug mode to log something', false)
.option('--time', 'show run generator time log', false)
.action(async params => {
if (!params.solution) {
params.solution = getSolutionByDependance();
Expand Down
1 change: 1 addition & 0 deletions packages/toolkit/upgrade/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function defineCommand(program: Command) {
undefined,
)
.option('-d,--debug', i18n.t(localeKeys.command.debug), false)
.option('--time', i18n.t(localeKeys.command.time), false)
.option('--cwd <cwd>', i18n.t(localeKeys.command.cwd), '')
.option('--no-need-install', i18n.t(localeKeys.command.noNeedInstall))
.action(async params => {
Expand Down
1 change: 1 addition & 0 deletions packages/toolkit/upgrade/src/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export const EN_LOCALE = {
noNeedInstall: 'not run install command',
config:
'specify the configuration file, which can be a relative or absolute path',
time: 'show run generator time log',
},
};
1 change: 1 addition & 0 deletions packages/toolkit/upgrade/src/locale/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const ZH_LOCALE = {
noNeedInstall: '无需安装依赖',
cwd: '项目路径',
config: '指定配置文件路径,可以为相对路径或绝对路径',
time: '展示生成器时间日志信息',
},
};
3 changes: 3 additions & 0 deletions packages/toolkit/upgrade/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ora } from '@modern-js/codesmith-utils/ora';
export interface Options {
cwd?: string;
debug?: boolean;
time?: boolean;
distTag?: string;
registry?: string;
needInstall?: boolean;
Expand All @@ -15,6 +16,7 @@ export async function upgradeAction(options: Options) {
const {
cwd = process.cwd(),
debug = false,
time = false,
distTag,
registry,
needInstall,
Expand All @@ -23,6 +25,7 @@ export async function upgradeAction(options: Options) {

const smith = new CodeSmith({
debug,
time,
});

smith.logger?.timing('🕒 Run Upgrade Tools');
Expand Down

0 comments on commit 4f06497

Please sign in to comment.