You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
633 B
17 lines
633 B
import fs from 'node:fs'
|
|
import path, { dirname } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = dirname(__filename)
|
|
|
|
const packagePath = path.resolve(__dirname, 'package.json')
|
|
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8'))
|
|
|
|
// 读取命令行参数(默认使用 'DT300W')
|
|
// eslint-disable-next-line node/prefer-global/process
|
|
const deviceType = process.argv[2] || 'DT300W'
|
|
|
|
packageJson.device = deviceType
|
|
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2))
|
|
console.log(`Version updated to: ${deviceType}`)
|