打包库时自动更新版本号

This commit is contained in:
街角小林
2024-01-03 17:56:35 +08:00
parent 3a6a2544b2
commit a488b436ee
3 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
const path = require('path')
const fs = require('fs')
const pkg = require('../../simple-mind-map/package.json')
const file = path.resolve('../simple-mind-map/full.js')
let content = fs.readFileSync(file, 'utf-8')
content = content.replace(
/(MindMap.version\s*=\s*)[^\n]+(\n)/,
`$1'${pkg.version}'$2`
)
fs.writeFileSync(file, content)