From 84961a3462f77302989156e1ea9f9ad23ac3e06b Mon Sep 17 00:00:00 2001 From: "A.A.Abroskin" Date: Mon, 24 Jun 2019 18:47:38 +0300 Subject: [PATCH] [skip travis] remove some examples to wiki --- README.md | 3 + examples/benchmark/lefthook_vs_overcommit.md | 65 ------------------- examples/migrations/husky.md | 45 ------------- examples/migrations/husky_with_lint-staged.md | 43 ------------ examples/migrations/overcommit.md | 44 ------------- 5 files changed, 3 insertions(+), 197 deletions(-) delete mode 100644 examples/benchmark/lefthook_vs_overcommit.md delete mode 100644 examples/migrations/husky.md delete mode 100644 examples/migrations/husky_with_lint-staged.md delete mode 100644 examples/migrations/overcommit.md diff --git a/README.md b/README.md index 1b5a68aa..5ee863d7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ # Lefthook + + Fast and powerfull Git hook manager for Node.js, Ruby or any other type of projects. * **Fast.** It is written on Go. Can run commands in parallel. diff --git a/examples/benchmark/lefthook_vs_overcommit.md b/examples/benchmark/lefthook_vs_overcommit.md deleted file mode 100644 index 3de513ea..00000000 --- a/examples/benchmark/lefthook_vs_overcommit.md +++ /dev/null @@ -1,65 +0,0 @@ -Benchmark based on [discourse](https://github.com/discourse/discourse/blob/master/.travis.yml#L77-L83) project. -We take all commands from Travis CI "as is". - -## Lefthook - -```yml -pre-commit: - parallel: true - commands: - rubocop: - run: bundle exec rubocop --parallel - danger: - run: bundle exec danger - eslint-assets: - run: npx yarn eslint --ext .es6 app/assets/javascripts - eslint-test: - run: npx yarn eslint --ext .es6 test/javascripts - eslint-plugins-assets: - run: npx yarn eslint --ext .es6 plugins/**/assets/javascripts - eslint-plugins-test: - run: npx yarn eslint --ext .es6 plugins/**/test/javascripts - eslint-assets-tests: - run: npx yarn eslint app/assets/javascripts test/javascripts - -``` - -Run it: -```bash -lefthook run pre-commit -``` - -## Overcommit - -```yml -PreCommit: - RuboCop: - enabled: true - command: ['bundle', 'exec', 'rubocop', '--parallel'] - Danger: - enabled: true - command: ['bundle', 'exec', 'danger'] - EsLintAssets: - enabled: true - command: ['yarn', 'eslint', '--ext', '.es6', 'app/assets/javascripts'] - EsLintTest: - enabled: true - command: ['yarn', 'eslint', '--ext', '.es6', 'test/javascripts'] - EsLintPAssets: - enabled: true - command: ['yarn', 'eslint', '--ext', '.es6', 'plugins/**/assets/javascripts'] - EsLintPTest: - enabled: true - command: ['yarn', 'eslint', '--ext', '.es6', 'plugins/**/test/javascripts'] - EsLintAT: - enabled: true - command: ['yarn', 'eslint', 'app/assets/javascripts', 'test/javascripts'] -``` - -Run it -```bash -overcommit --run -``` - -## Result -Lefthook ~20% faster than Overcommit. diff --git a/examples/migrations/husky.md b/examples/migrations/husky.md deleted file mode 100644 index c778b0c0..00000000 --- a/examples/migrations/husky.md +++ /dev/null @@ -1,45 +0,0 @@ -### Migration from husky - -## Steps: -1. Uninstall husky -```bash -npm uninstall husky -``` - -2. Install lefthook -```bash -npm install @arkweid/lefthook --save-dev -``` - -3. Move hooks from `package.json` to `lefthook.yml` - -```json -// package.json -{ - "husky": { - "hooks": { - "pre-commit": "npm test", - "pre-push": "npm test" - } - } -} - -``` - -```yml -# lefthook.yml -pre-commit: - commands: - sometest: - run: npm test - -pre-push: - commands: - anothertest: - run: npm test -``` - -4. (optional) Unhappy? Want to revert? -```bash -npx lefthook uninstall && npm uninstall @arkweid/lefthook && npm install husky --save-dev -``` diff --git a/examples/migrations/husky_with_lint-staged.md b/examples/migrations/husky_with_lint-staged.md deleted file mode 100644 index 71b2b3b8..00000000 --- a/examples/migrations/husky_with_lint-staged.md +++ /dev/null @@ -1,43 +0,0 @@ -### Migration from husky - -## Steps: -1. Uninstall husky -```bash -npm uninstall husky -``` - -2. Install lefthook -```bash -npm install @arkweid/lefthook --save-dev -``` - -3. Move hooks from `package.json` to `lefthook.yml` - -```json -// package.json -{ - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{js,jsx}": "eslint" - } -} - -``` - -```yml -# lefthook.yml -pre-commit: - commands: - eslint: - glob: "*.{js,jsx}" - run: npx eslint {staged_files} -``` - -4. (optional) Unhappy? Want to revert? -```bash -npx lefthook uninstall && npm uninstall @arkweid/lefthook && npm install husky --save-dev -``` diff --git a/examples/migrations/overcommit.md b/examples/migrations/overcommit.md deleted file mode 100644 index d724bab2..00000000 --- a/examples/migrations/overcommit.md +++ /dev/null @@ -1,44 +0,0 @@ -### Migration from overcommit - -## Steps: -1. Uninstall overcommit -```bash -overcommit --uninstall -``` - -2. Install lefthook -```bash -gem install lefthook && lefthook install -``` - -3. Move hooks from `.overcommit.yml` to `lefthook.yml` -```yml -# .overcommit.yml -PreCommit: - RuboCop: - enabled: true - command: ['rubocop'] - Audit: - enabled: true - command: ['bundle', 'audit'] -``` - -```yml -# lefthook.yml -pre-commit: - commands: - rubocop: - run: rubocop - audit: - run: bundle audit -``` - -4. Sync new hooks and test it! -```bash -lefthook install && lefthook run pre-commit -``` - -5. (optional) Unhappy? Want to revert? -```bash -lefthook uninstall && gem uninstall lefthook && overcommit --install -```