feat:新增账单导出、支付宝账单导入

This commit is contained in:
2026-03-12 15:09:25 +08:00
parent e70b87a212
commit 6c209d8781
9 changed files with 886 additions and 69 deletions

View File

@@ -1,5 +1,4 @@
/* 自定义发布脚本:接管 npm version + Android 版本同步 + git 提交与打 tag */
const { execSync } = require('child_process')
const { execSync } = require('child_process')
const fs = require('fs')
const path = require('path')
@@ -10,23 +9,34 @@ const run = (cmd) => {
execSync(cmd, { stdio: 'inherit', cwd: rootDir })
}
const read = (cmd) => execSync(cmd, { cwd: rootDir, encoding: 'utf8' }).trim()
const readJson = (file) =>
JSON.parse(fs.readFileSync(path.join(rootDir, file), 'utf8'))
const ensureReleaseReady = () => {
const branch = read('git branch --show-current')
if (branch !== 'main') {
throw new Error(`release 只能在 main 分支执行,当前分支:${branch}`)
}
const status = read('git status --short')
if (status) {
throw new Error('release 前请先提交或清理当前改动,工作区必须保持干净')
}
}
const main = () => {
const type = process.argv[2] || 'patch' // patch / minor / major
const type = process.argv[2] || 'patch'
ensureReleaseReady()
// 1仅更新 version 字段,不让 npm 自动 commit / tag.npmrc 已全局禁止,但这里再显式加一层保险)
run(`npm version ${type} --no-git-tag-version`)
// 2同步 Android 版本versionCode / versionName
run('npm run version:sync')
// 3读取新版本号
const pkg = readJson('package.json')
const version = pkg.version
// 4只提交与版本相关的文件避免误提交其它开发中的改动
const filesToAdd = [
'package.json',
'package-lock.json',
@@ -34,7 +44,6 @@ const main = () => {
]
run(`git add ${filesToAdd.join(' ')}`)
// 5提交并打 tag
run(`git commit -m "chore: release v${version}"`)
run(`git tag v${version}`)
@@ -42,4 +51,3 @@ const main = () => {
}
main()

View File

@@ -1,5 +1,4 @@
/* 同步前端 package.json 的版本号到 Android 工程versionCode / versionName */
const fs = require('fs')
const fs = require('fs')
const path = require('path')
const rootDir = path.resolve(__dirname, '..')
@@ -16,7 +15,7 @@ const calcVersionCode = (version) => {
const [major = 0, minor = 0, patch = 0] = String(version)
.split('.')
.map((n) => Number.parseInt(n, 10) || 0)
// 简单规则MMmmpp → 1.2.3 => 10203足够覆盖 099 范围
return major * 10000 + minor * 100 + patch
}
@@ -49,4 +48,3 @@ const main = () => {
}
main()