Home > Back-end >  git command to update specific module
git command to update specific module

Time:01-30

I got two projects and two distinct git (let call them A & B).

When I work on A, I need sometimes to update the code in B. Here's the workflow:

  • code/add/commit/push on B
  • delete B module in A node_modules
  • delete package-lock.json in A
  • npm update on A
  • npm install on A

This is pretty ugly and to make matters worses, very slow.

I do this because it's the only way I found to systematically get the updates I want.

Are you aware of the command that I miss ? Do you know a cleaner workflow I could use ?

Thanks

CodePudding user response:

I just added in my scripts:

"npm uninstall MODULENAME && npm install \"git ssh://[email protected]:GITDEPOT/MODULENAME#master\""

It works like a charm.

EDIT: For separation of concerns sake, if you need to work with differents repo on your local enivronnement, you'de better have to use your local src in your package.json.

No need to update things each time something move somewhere, no headaches, no injuries; just fun. Exemple:

"dependencies": {
...
"separateModule": "file:../../anotherDir"
}

Then you can just import your module as you'd do with a common "node_modules":

import MyOwnPleasure from "Delighted"
  •  Tags:  
  • git
  • Related