Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to publish to npm every time I update a package available via git?

Tags:

git

npm

publish

Say I maintain an incredible crab-season package. I've npm published version 0.1.0 with a package.json containing:

"repository": {   "type": "git",   "url": "https://github.com/example/crab-season.git" } 

When I add awesome new features, bump the version to 0.2.0, and push to github will the npmjs registry notice my new version or do I need to npm publish each time?

like image 839
hurrymaplelad Avatar asked Nov 22 '12 07:11

hurrymaplelad


People also ask

Does npm publish update?

Publish to npm Finally, once you're confident this version is ready to release, you can publish the updated package to npm. The publish command will add the updated package to the npm registry.

Does npm publish overwrite?

By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a scope in the name (see package. json ).

What does publishing to npm mean?

When you run npm publish , npm bundles up all the files in the current directory. It makes a few decisions for you about what to include and what to ignore. To make these decisions, it uses the contents of several files in your project directory.


1 Answers

Travis CI can publish to npm when you push a version tag to reduce the overhead of releasing a change. Enable in your .travis.yml with:

deploy:    provider: npm   api_key: "YOUR API KEY"   on:     - tags: true 

Check the travis docs for details. There's also a step-by-step guide in this post.

like image 199
hurrymaplelad Avatar answered Sep 22 '22 01:09

hurrymaplelad