question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature request]run lerna script against staged-files

See original GitHub issue

I would like to run lerna scripts against packages that have staged files. It similar to --since flag. I would recommend to add new filtered flag --staged (git diff --cached).

Expected Behavior

Run pre-commit git hook with husky using lint-staged package on packages that have staged files. The command should looks like: lerna run pre-commit --staged

Current Behavior

There is not such possibility yet

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
rfgamaralcommented, Nov 7, 2019

The proposed --since HEAD solution will run the command on every package with changed files not staged ones. Could this be reopened and the feature request reconsidered?

3reactions
nchandran3commented, Apr 11, 2019

For the exact same use case, I was able to use lerna run pre-commit --since HEAD.

You would place that in your root package.json config.

  "husky": {
    "hooks": {
      "pre-commit": "lerna run pre-commit --concurrency 1 --since HEAD"
    }
  }

This will only run the pre-commit script on packages that have staged changes within them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use lint-staged in a lerna monorepo to run the same ...
So lerna will run the script lint-staged on all packages that has the script lint-staged added to scripts entry on their package.json files....
Read more >
Run Tasks - Lerna
Run Tasks. Monorepos can have hundreds or even thousands of projects, so being able to run npm scripts against all (or some) of...
Read more >
Create a monorepo with Lerna | by Damian Cyrus - Medium
Lint over Git staged files to have a check on files before they are committed. Add ESLint and lint-staged to all packages. In...
Read more >
Managing Your Typescript Monorepo With Lerna and Codefresh
Setting up our Monorepo · Create Typescript Project · Create React Project · Make one package depend on the other · Testing ·...
Read more >
lerna/npm-run-script
An internal Lerna tool. Latest version: 6.0.1, last published: 12 days ago. Start using @lerna/npm-run-script in your project by running ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found