Browse Source

build: install dependency for vue-server-renderer in setup script (#6839)

dev
JK 7 years ago
committed by Evan You
parent
commit
a433b16588
  1. 8
      build/install-hooks.js
  2. 26
      build/setup.js
  3. 2
      package.json

8
build/install-hooks.js

@ -1,8 +0,0 @@
const { test, ln, chmod } = require('shelljs')
if (test('-e', '.git/hooks')) {
ln('-sf', '../../build/git-hooks/pre-commit', '.git/hooks/pre-commit')
chmod('+x', '.git/hooks/pre-commit')
ln('-sf', '../../build/git-hooks/commit-msg', '.git/hooks/commit-msg')
chmod('+x', '.git/hooks/commit-msg')
}

26
build/setup.js

@ -0,0 +1,26 @@
const { test, ln, chmod, cd, exec } = require('shelljs')
const path = require('path')
const baseUrl = path.resolve()
function installHooks () {
if (test('-e', '.git/hooks')) {
ln('-sf', '../../build/git-hooks/pre-commit', '.git/hooks/pre-commit')
chmod('+x', '.git/hooks/pre-commit')
ln('-sf', '../../build/git-hooks/commit-msg', '.git/hooks/commit-msg')
chmod('+x', '.git/hooks/commit-msg')
}
}
function setupSSR () {
const ssrBase = path.resolve('packages/vue-server-renderer')
if (!test('-e', path.join(ssrBase, 'node_modules'))) {
cd(ssrBase)
exec('npm install')
cd(baseUrl)
}
}
installHooks()
setupSSR()

2
package.json

@ -40,7 +40,7 @@
"release": "bash build/release.sh",
"release:weex": "bash build/release-weex.sh",
"release:note": "node build/gen-release-note.js",
"setup": "node build/install-hooks.js",
"setup": "node build/setup.js",
"commit": "git-cz"
},
"repository": {

Loading…
Cancel
Save