Skip to content

Commit

Permalink
更新代码
Browse files Browse the repository at this point in the history
- ⚙️ 更新 `auto check -u` 命令运行后还输出更新前日志
- ⚙️ 更新依赖版本
  • Loading branch information
biaov committed May 28, 2024
1 parent 6a09e31 commit f4440dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mine-auto-cli",
"private": false,
"version": "2.4.2",
"version": "2.4.3",
"exports": "./dist/index.js",
"main": "./dist/index.js",
"type": "module",
Expand Down Expand Up @@ -52,7 +52,7 @@
],
"dependencies": {
"chalk": "^5.3.0",
"commander": "^12.0.0",
"commander": "^12.1.0",
"js-yaml": "^4.1.0",
"log-symbols": "^6.0.0",
"ora": "^8.0.1",
Expand All @@ -71,4 +71,4 @@
"typescript": "^5.4.5",
"vite": "^5.2.11"
}
}
}
11 changes: 6 additions & 5 deletions src/commander/commands/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ const simplifyUpgrade = async ({ update }: Record<string, boolean>) => {
if (!existsSync(packagePath)) return error('package.json 文件不存在')

const newUpdate = update || userConfig.check

const packageJsonString = readFileSync(packagePath).toString()
const packageJson: Record<string, any> = JSON.parse(packageJsonString)
const keys = ['dependencies', 'devDependencies', 'optionalDependencies']
Expand Down Expand Up @@ -204,12 +205,12 @@ const simplifyUpgrade = async ({ update }: Record<string, boolean>) => {
writeFileSync(packagePath, JSON.stringify(newPackages, null, 2))
success('文件 package.json 已更新')
info()
} else {
/**
* 输出包信息
*/
outVersionLog(versionLogs)
}

/**
* 输出包信息
*/
outVersionLog(versionLogs)
}

program.command('check').option('-u, --update', `更新 package.json 依赖内容`, false).description('升级 package.json 依赖版本').action(simplifyUpgrade)

0 comments on commit f4440dc

Please sign in to comment.