Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-12 17:56:03
  4. */
  5. 'use strict'
  6. const fs = require('fs')
  7. const fse = require('fs-extra')
  8. const path = require('path')
  9. const pkgInfo = require('../package.json')
  10. const chalk = require('chalk')
  11. const version = pkgInfo.version
  12. const packagesDir = path.resolve(__dirname, '..', 'packages')
  13. fse.exists(packagesDir, exists => {
  14. if (exists) {
  15. const dirs = fs.readdirSync(path.resolve(__dirname, '..', 'packages')) || []
  16. dirs.forEach(item => {
  17. const filePath = path.resolve(packagesDir, `${item}/package.json`)
  18. fse.exists(filePath, exists => {
  19. if (exists) {
  20. let json = fse.readJsonSync(filePath)
  21. json.version = version
  22. if (json?.peerDependencies?.['@dvgis/dc-base']) {
  23. json.peerDependencies['@dvgis/dc-base'] = '^' + version
  24. }
  25. fse.writeJsonSync(filePath, json, { spaces: '\t' })
  26. // eslint-disable-next-line no-console
  27. console.log(
  28. chalk.green(`change ${item} version to ` + chalk.red(`v${version}`))
  29. )
  30. }
  31. })
  32. })
  33. }
  34. })