From a433b16588412980b4ab51924de1ef91b5226f56 Mon Sep 17 00:00:00 2001 From: JK Date: Wed, 18 Oct 2017 22:15:29 +0800 Subject: [PATCH] build: install dependency for vue-server-renderer in setup script (#6839) --- build/install-hooks.js | 8 -------- build/setup.js | 26 ++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) delete mode 100644 build/install-hooks.js create mode 100644 build/setup.js diff --git a/build/install-hooks.js b/build/install-hooks.js deleted file mode 100644 index e5f8ad84..00000000 --- a/build/install-hooks.js +++ /dev/null @@ -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') -} diff --git a/build/setup.js b/build/setup.js new file mode 100644 index 00000000..231e4365 --- /dev/null +++ b/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() + diff --git a/package.json b/package.json index a8c2ad3f..09af3ed7 100644 --- a/package.json +++ b/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": {