mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-17 04:40:03 -06:00
21 lines
620 B
JavaScript
21 lines
620 B
JavaScript
// make sure generators are using the latest version of plugins
|
|
|
|
const fs = require('fs')
|
|
const globby = require('globby')
|
|
|
|
;(async () => {
|
|
const paths = await globby(['packages/@vue/cli/lib/generators/**/*.js'])
|
|
paths
|
|
.filter(p => !/\/files\//.test(p))
|
|
.forEach(processFile)
|
|
})()
|
|
|
|
function processFile (filePath) {
|
|
const file = fs.readFileSync(filePath, 'utf-8')
|
|
const updated = file.replace(/'(@vue\/cli-[\w-]+)': '\^\d+\.\d+\.\d+'/g, (_, pkg) => {
|
|
const version = require(`../packages/${pkg}/package.json`).version
|
|
return `'${pkg}': '^${version}'`
|
|
})
|
|
fs.writeFileSync(filePath, updated)
|
|
}
|