Skip to content

Commit a433b16

Browse files
jkzingyyx990803
authored andcommitted
build: install dependency for vue-server-renderer in setup script (#6839)
1 parent b6c384d commit a433b16

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

Diff for: build/install-hooks.js

-8
This file was deleted.

Diff for: build/setup.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { test, ln, chmod, cd, exec } = require('shelljs')
2+
const path = require('path')
3+
4+
const baseUrl = path.resolve()
5+
6+
function installHooks () {
7+
if (test('-e', '.git/hooks')) {
8+
ln('-sf', '../../build/git-hooks/pre-commit', '.git/hooks/pre-commit')
9+
chmod('+x', '.git/hooks/pre-commit')
10+
ln('-sf', '../../build/git-hooks/commit-msg', '.git/hooks/commit-msg')
11+
chmod('+x', '.git/hooks/commit-msg')
12+
}
13+
}
14+
15+
function setupSSR () {
16+
const ssrBase = path.resolve('packages/vue-server-renderer')
17+
if (!test('-e', path.join(ssrBase, 'node_modules'))) {
18+
cd(ssrBase)
19+
exec('npm install')
20+
cd(baseUrl)
21+
}
22+
}
23+
24+
installHooks()
25+
setupSSR()
26+

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"release": "bash build/release.sh",
4141
"release:weex": "bash build/release-weex.sh",
4242
"release:note": "node build/gen-release-note.js",
43-
"setup": "node build/install-hooks.js",
43+
"setup": "node build/setup.js",
4444
"commit": "git-cz"
4545
},
4646
"repository": {

0 commit comments

Comments
 (0)