From ba9c4ed08047c9eb014504e8292a5877f640789d Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 6 Jan 2018 01:10:20 -0500 Subject: [PATCH] switch to yorkie for git hook management --- package.json | 7 ++++--- .../@vue/cli-plugin-eslint/__tests__/generator.spec.js | 2 +- packages/@vue/cli-plugin-eslint/generator.js | 4 +++- packages/@vue/cli-service/bin/install.js | 4 ++-- packages/@vue/cli-service/package.json | 6 +++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index bbfa88715..b5a316f33 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,10 @@ ], "scripts": { "test": "jest --env node", - "lint": "eslint --fix packages/**/*.js packages/**/bin/* test/**/*.js", - "precommit": "lint-staged" + "lint": "eslint --fix packages/**/*.js packages/**/bin/* test/**/*.js" + }, + "gitHooks": { + "pre-commit": "lint-staged" }, "jest": { "testEnvironment": "node", @@ -34,7 +36,6 @@ "eslint": "^4.14.0", "eslint-plugin-vue-libs": "^2.1.0", "globby": "^7.1.1", - "husky": "^0.14.3", "jest": "^22.0.4", "lerna": "^2.5.1", "lint-staged": "^6.0.0", diff --git a/packages/@vue/cli-plugin-eslint/__tests__/generator.spec.js b/packages/@vue/cli-plugin-eslint/__tests__/generator.spec.js index 6bf55b996..10a2d2c6a 100644 --- a/packages/@vue/cli-plugin-eslint/__tests__/generator.spec.js +++ b/packages/@vue/cli-plugin-eslint/__tests__/generator.spec.js @@ -70,7 +70,7 @@ test('lint on commit', async () => { lintOn: 'commit' } }) - expect(pkg.scripts.precommit).toBe('lint-staged') + expect(pkg.gitHooks['pre-commit']).toBe('lint-staged') expect(pkg.devDependencies).toHaveProperty('lint-staged') expect(pkg['lint-staged']).toEqual({ '*.js': ['vue-cli-service lint', 'git add'], diff --git a/packages/@vue/cli-plugin-eslint/generator.js b/packages/@vue/cli-plugin-eslint/generator.js index 09d17d37e..03292432d 100644 --- a/packages/@vue/cli-plugin-eslint/generator.js +++ b/packages/@vue/cli-plugin-eslint/generator.js @@ -34,7 +34,9 @@ module.exports = (api, { config, lintOn }) => { Object.assign(pkg.devDependencies, { 'lint-staged': '^6.0.0' }) - pkg.scripts.precommit = 'lint-staged' + pkg.gitHooks = { + 'pre-commit': 'lint-staged' + } pkg['lint-staged'] = { '*.js': ['vue-cli-service lint', 'git add'], '*.vue': ['vue-cli-service lint', 'git add'] diff --git a/packages/@vue/cli-service/bin/install.js b/packages/@vue/cli-service/bin/install.js index ace9b84f0..4aba8fc14 100755 --- a/packages/@vue/cli-service/bin/install.js +++ b/packages/@vue/cli-service/bin/install.js @@ -4,6 +4,6 @@ const projectDir = process.env.VUE_CLI_CONTEXT || path.dirname(require('read-pkg-up').sync().path) -const huskyWorkingPath = path.resolve(projectDir, 'node_modules', '@vue') +const yorkieWorkingPath = path.resolve(projectDir, 'node_modules/@vue') -require('husky/src/install')(huskyWorkingPath) +require('yorkie/src/install')(yorkieWorkingPath) diff --git a/packages/@vue/cli-service/package.json b/packages/@vue/cli-service/package.json index 888f012c3..b6ac55930 100644 --- a/packages/@vue/cli-service/package.json +++ b/packages/@vue/cli-service/package.json @@ -39,7 +39,6 @@ "friendly-errors-webpack-plugin": "^1.6.1", "get-value": "^2.0.6", "html-webpack-plugin": "^2.30.1", - "husky": "^0.14.3", "javascript-stringify": "^1.6.0", "minimist": "^1.2.0", "opn": "^5.1.0", @@ -59,8 +58,9 @@ "vue-template-compiler": "^2.5.13", "webpack": "^3.10.0", "webpack-chain": "^4.5.0", - "webpack-dev-server": "^2.9.7", - "webpack-merge": "^4.1.1" + "webpack-dev-server": "^2.10.0", + "webpack-merge": "^4.1.1", + "yorkie": "^1.0.0" }, "devDependencies": { "vue": "^2.5.13"