adjust script

This commit is contained in:
Evan You
2017-12-28 22:13:11 -05:00
parent 79cfab8edb
commit ded8b944a7
2 changed files with 7 additions and 10 deletions

5
scripts/.eslintrc Normal file
View File

@@ -0,0 +1,5 @@
{
"rules": {
"vue-libs/no-async-functions": 0
}
}

View File

@@ -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) {