mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-21 23:00:00 -06:00
adjust script
This commit is contained in:
5
scripts/.eslintrc
Normal file
5
scripts/.eslintrc
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rules": {
|
||||
"vue-libs/no-async-functions": 0
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// make sure generators are using the latest version of plugins
|
||||
// make sure generators are using the latest version of libs
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
@@ -6,11 +6,10 @@ const chalk = require('chalk')
|
||||
const globby = require('globby')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
const localPackageRE = /'(@vue\/cli-[\w-]+)': '\^(\d+\.\d+\.\d+)'/g
|
||||
const npmPackageRE = /'(vue|vue-template-compiler|vuex|vue-router|vue-test-utils)': '\^(\d+\.\d+\.\d+)'/g
|
||||
|
||||
;(async () => {
|
||||
const paths = await globby(['packages/@vue/cli/lib/generators/**/*.js'])
|
||||
const paths = await globby(['packages/@vue/**/*.js'])
|
||||
paths
|
||||
.filter(p => !/\/files\//.test(p))
|
||||
.forEach(filePath => {
|
||||
@@ -27,18 +26,11 @@ const npmPackageRE = /'(vue|vue-template-compiler|vuex|vue-router|vue-test-utils
|
||||
return `'${pkg}': '^${version}'`
|
||||
}
|
||||
|
||||
const localReplacer = makeReplacer(
|
||||
pkg => require(`../packages/${pkg}/package.json`).version
|
||||
)
|
||||
|
||||
const npmReplacer = makeReplacer(
|
||||
pkg => execSync(`npm view ${pkg} version`).toString().trim()
|
||||
)
|
||||
|
||||
const updated = fs.readFileSync(filePath, 'utf-8')
|
||||
// update @vue packages in this repo
|
||||
.replace(localPackageRE, localReplacer)
|
||||
// also update vue, vue-template-compiler, vuex, vue-router
|
||||
.replace(npmPackageRE, npmReplacer)
|
||||
|
||||
if (isUpdated) {
|
||||
|
||||
Reference in New Issue
Block a user