消毒机设备
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
632 B

  1. import fs from 'node:fs'
  2. import path, { dirname } from 'node:path'
  3. import { fileURLToPath } from 'node:url'
  4. const __filename = fileURLToPath(import.meta.url)
  5. const __dirname = dirname(__filename)
  6. const packagePath = path.resolve(__dirname, 'package.json')
  7. const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8'))
  8. // 读取命令行参数(默认使用 'DT300W')
  9. // eslint-disable-next-line node/prefer-global/process
  10. const deviceType = process.argv[2] || 'DT300W'
  11. packageJson.device = deviceType
  12. fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2))
  13. console.log(`device updated to: ${deviceType}`)