How do NPM always update the latest Comite in master?

Asked

Viewed 1,030 times

1

I have a local repository (gitlab) with several components, I’m pointing to package.json each component directly to this repository. See below for an example:

"dependencies": {
    "XX-alert": "git+http://git.domain.com/XX-platform/XX-alert.git",
    ...
}

I would like every time a developer makes one push to the master anyone in the network making a npm update could pick up this update.

Right now for this to work I need to add the package again:

npm install git+http://git.domain.com/XX-platform/XX-alert.git --save

Thank you.

  • Can you clarify, please, who would this update be available to? Another developer? A test environment?

  • Today I have 40 components and all are within Gitlab, each developer uses the command git install git+http://git.domain.com/XX-platform/XX-alert.git --save to add a package to the project, the point is that every time you update the package in the master branch, developers can’t access this update.

2 answers

2

Bruno, it’s good practice not to say this in Git, when a dev does the clone it downloads the packages and when it does, you have to put this process in the "build" automation Gulp can help you automate these tasks. The only thing you would versioning would be the json file with the package list, hence just give the npm update command, to update the packages.

1


If you know which dependency has been updated, you can run npm update <pkg> that it will be updated if you do not know which dependency has been updated, so I suggest you remove the folder from node_modules with a rm -rf node_modules and turn the npm install again.

  • Remembering not to leave the static version number in package.json, otherwise it will always install that specific version

Browser other questions tagged

You are not signed in. Login or sign up in order to post.