Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

16. Create a release tag, merge into master and publish to npm and Github #136

Closed
filipedeschamps opened this issue Mar 5, 2016 · 2 comments
Labels

Comments

@filipedeschamps
Copy link
Owner

This is the last step 馃憤

Semver

Semantic versioning is a very nice way to keep track of the evolution of your module. Basically, your module will have 3 numbers, for example 1.2.3, where:

  • The number 1 is for major changes and you have to increase it when you make breaking changes to your module. For example, if the add method accept an object as argument and you change it to only accept arrays for now on, you have to increase the major number since you created a breaking change.
  • The number 2 is for minor changes and you have to increase it when you add new functionalities to your public API without making any breaking changes. For example, add a new find method.
  • The number 3 is for patch changes and you have to increase it when you fix something, without changing the public API. For example, you manage to iterate over the feed list in a much more efficient way.

For more informations about semantic version: http://semver.org/

Package version in npm and Release tag in Github

There's a very easy way to bump package.json version and create a release tag to Github using npm.

Commit everything you have unstaged and then just run the below command to do that for a 1.0.0 version for example.

$ npm version 1.0.0

It will not only update the version property of your package.json but also will create a commit and a tag with that version:

image

To push that git tag to your remote branch, you need to add --follow tags in your push command:

$ git push --follow-tags

But there's a better way, just configure your Git to always push relevant annotated tags with this configuration:

$ git config --global push.followTags true

When when you push your feature branch, it will also push the version tag:

image

And this is responsible to automatically create a release inside Github:

image

Awesome!

Publish to npm

After you merge everything to master, just type this simple command in your terminal to publish everything to npm:

$ npm publish

And you're done, awesome!

From now on you will just keep iterating over the same things until your module internals are complete.

Next step

17. Bonus: how to watch tests with Mocha

@FabricioFFC
Copy link

Really cool tutorial! Awesome job!

I will start to recommend this tutorial for our candidates that need/want learn more, how to learn to code in a "professional way". Your tutorial is a perfect way to learn how to develop a module using JavaScript and also how to use tools and learn concepts that are very important, and so many developers and interns don't know.

Congrats Filipe!

P.S.: You could give a try to https://github.com/jsdoc3/jsdoc, or some other documentation tool, to improve the usability to go through your tutorial

@filipedeschamps
Copy link
Owner Author

@FabricioFFC great thanks!

This module and tutorial exists because of that technique you taught me, do one little thing a day 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants