From 9df4021d6849afff323d44a529df2f73f521188c Mon Sep 17 00:00:00 2001 From: abearxiong Date: Thu, 12 Mar 2026 14:51:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=92=8C=E5=88=97=E5=87=BA=E5=91=BD=E4=BB=A4=E7=9A=84=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=96=87=E4=BB=B6=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/command/sync/modules/base.ts | 8 +++++++- src/command/sync/sync.ts | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/command/sync/modules/base.ts b/src/command/sync/modules/base.ts index 9fac86f..9641bab 100644 --- a/src/command/sync/modules/base.ts +++ b/src/command/sync/modules/base.ts @@ -20,7 +20,13 @@ const checkAuth = (value: string = '', baseURL: string = '') => { }; const DEFAULT_IGNORE = [ - 'node_modules/**', '.git/**', '.next/**', '.astro/**', '.pack-dist/**', + 'node_modules/**', + '.git/**', + '.next/**', + '.astro/**', + '.pack-dist/**', + "dist/**", + ".swc/**" ]; export class SyncBase { config: Config; diff --git a/src/command/sync/sync.ts b/src/command/sync/sync.ts index 0912f17..1254a6c 100644 --- a/src/command/sync/sync.ts +++ b/src/command/sync/sync.ts @@ -20,9 +20,11 @@ const syncUpload = new Command('upload') .option('-d --dir ', '配置目录') .option('-c --config ', '配置文件的名字', 'kevisual.json') .option('-f --file ', '操作的对应的文件名') + .option('-l --list', '显示上传列表,不上传文件') .description('上传项目, 上传需要和registry的地址同步。') .action(async (opts) => { console.log('上传项目'); + const isUpload = opts.list ? false : true; const sync = new SyncBase({ dir: opts.dir, baseURL: baseURL, configFilename: opts.config }); const syncList = await sync.getSyncList({ getFile: true }); logger.debug(syncList); @@ -58,6 +60,10 @@ const syncUpload = new Command('upload') if (filepath && item.filepath !== filepath.absolute) { continue; } + if (!isUpload) { + console.log('上传列表', item.key, chalk.green(item.url)); + continue + } const res = await upload({ token, file: fs.readFileSync(item.filepath), @@ -127,10 +133,12 @@ const syncList = new Command('list') .option('-d --dir ', '配置目录') .option('-c --config ', '配置文件的名字', 'kevisual.json') .option('-a --all', '显示所有的文件') + .option('-l --local', '显示本地的文件列表') .description('列出同步列表') .action(async (opts) => { const sync = new SyncBase({ dir: opts.dir, baseURL: baseURL, configFilename: opts.config }); - const syncList = await sync.getSyncList(); + let getLocalFile = opts?.local ? true : false; + const syncList = await sync.getSyncList({ getFile: true, getLocalFile }); logger.debug(syncList); logger.info('同步列表\n'); syncList.forEach((item) => {