1.0.14 • Published 2 years ago

monorepo-staged-precommit v1.0.14

Weekly downloads
496
License
ISC
Repository
github
Last release
2 years ago

monorepo-staged-precommit

This package adds a pre-commit hook script that runs the precommit script in all package.json's in projects where there are staged changes.

Uses nvm use to use the correct node version for each project.

Does not run on CI.

Usage

  1. add to all package.json files in monorepo by running npm i --save-dev monorepo-staged-precommit in all folders containg package.json. (can be done in one, yet only when installing a project with it, will the precommit-hook script be added).
  2. add precommit script to package.json. (e.g. "precommit": "lint-staged").
  3. make changes and stage them.
  4. run git commit. - all precommit scripts will run in projects with changes.

Example

Given monorepo:

- project
  |
  |-- projectA
  |   |
  |   |-- package.json
  |
  |-- projectB
  |   |
  |   |--package.json
  |
  |-- projectC
  • When changing a file in projectA and staging it, the script will run the precommit script in projectA/pacakge.json.

  • When changing a file in projectA and projectB and staging them the script will run the precommit script in both project/package.json and projectB/package.json.

  • When changing a file in projectC and staging it nothing will run since projectC has no package.json.

1.0.14

2 years ago

1.0.13

3 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago