Skip to content

Commit

Permalink
adjust script
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 29, 2017
1 parent 79cfab8 commit ded8b94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 5 additions & 0 deletions scripts/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"vue-libs/no-async-functions": 0
}
}
12 changes: 2 additions & 10 deletions scripts/syncDeps.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// 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')
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 => {
Expand All @@ -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) {
Expand Down

0 comments on commit ded8b94

Please sign in to comment.