0.26.3 β€’ Published 1 year ago

shipjs-lib v0.26.3

Weekly downloads
2,877
License
MIT
Repository
github
Last release
1 year ago

Why πŸ€·πŸ»β€

Coding is fun, debugging and testing are okay, but releasing is NOT.

When releasing, you go through something like the following:

  • Update the version in package.json
  • Update the changelog
  • Actually release it (e.g. yarn build && yarn publish)
  • Create a git tag
  • Create a release on GitHub

What could go wrong?

  • You might make mistakes during the release.
    • Environments are different across your team members.
    • You're releasing alone because the whole process happens on your local machine.
    • It's not your everyday-job. Mistakes can happen.
  • You are blocked and cannot do anything else until it's done.
    • Even if you have a release script, you need to watch until the script finishes well.
    • You don't want to switch to another feature branch and work there until the script finishes.

How to solve them❓

In Ship.js, the release process consists of three parts.

Part 1. Preparation (shipjs prepare)

Preview

Run shipjs prepare and it will briefly do the following:

  • Figure out next version.
  • Update the version and changelog.
  • Create a pull request.

It takes less than a couple of minutes.

Part 2. Review

  • Review the PR by yourself, or with your colleagues.
  • Add more commits to the PR if you want.
  • You can hold the release, build from the staging branch and test it manually.
  • If you want to cancel the release, just close the PR and delete the staging branch.

When you think it's ready to release, merge the PR.

Part 3. Trigger a release (shipjs trigger)

Run shipjs trigger and it will briefly do the following:

  • Run a final test (unit, e2e, etc).
  • Release it to NPM (or elsewhere as you configure it).
  • Create a git tag for the version.
  • Create a release for the tag on GitHub.

You can manually run shipjs trigger on the base branch after the PR is merged.

However you can also configure your CI service(e.g. CircleCI) to do this for you. It means the longest process is on the CI service asynchronously, not occupying your working environment.

A little deeper look ⁉️

Let's assume the following situation:

  • Current branch: master
  • Currently released version: 1.0.0
  • Next version: 1.0.1 (because there are only commits like chore:, fix:, ...)

Part 1. Preparation (shipjs prepare)

On your terminal, run shipjs prepare and it will briefly do the following:

  • git checkout -b releases/v1.0.1
  • Update the version in package.json.
  • Update the changelog.
  • git commit -m "chore: release v1.0.1
  • Create a PR from releases/v1.0.1 to master.

You can run shipjs prepare --dry-run just to see what will be executed without actual execution.

Part 2. Review

You will review and merge this PR.

You can add more commits to this PR if needed.

According to your merge strategy, you might either Squash and merge or Merge pull request.

For more information, please refer to the mergeStrategy section of the guide.

Part 3. Trigger a release (shipjs trigger)

On your terminal, git pull on master branch. And run shipjs trigger. It will check the following conditions whether it should proceed releasing or not.

  • if it's master branch now
  • if the latest commit message is like chore: releases v1.0.1 (#xx)

If the conditions are met, shipjs trigger will briefly do the following:

  • Send a Slack message to notify the beginning of the release(If configured).
  • Run test, build and release it.
  • git tag v1.0.1.
  • Push them to git remote.
  • hub release create -m <changelog> v1.0.1
  • Notify at Slack.

You can run shipjs trigger --dry-run just to see what will be executed without actual execution.

And you can configure your CI service to run the Part 3 on behalf of you. What you need to do is just to make it run shipjs trigger every time there is a new commit. It's okay to do so because shipjs trigger triggers release only when the conditions are met. If not, it skips.

Installation

Running the following command will guide you to set it up interactively.

npx shipjs setup

Otherwise, you can still do it manually.

npm install --save-dev shipjs

or

yarn add -D shipjs

Add the following to the scripts section in your package.json.

"release:prepare": "shipjs prepare",
"release:trigger": "shipjs trigger",

Do you want to set it up now? Then, let's move on to the GUIDE.md.

How is it different from semantic-release?

semantic-release is a tool for fully automated version management and package publishing.

Ship.js gives you more control over the release process. Ship.js automatically creates a PR before publishing every release, so that you can:

  • Confirm the next version is correct.
  • Confirm which commits are going to be released and discuss them with colleagues.
  • Edit the automatically generated changelog for clarity & readability.
  • Run any automated tests on the package release candidate.
  • Build a release candidate automatically (with Pika CI).

Contributing

You can create an issue for bug, feature request or your opinion.

And we also appreciate your PRs. The detailed contribution guide is coming soon.

Getting Started

Let's move on to the GUIDE.md.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

0.26.3

1 year ago

0.26.2

1 year ago

0.26.1

1 year ago

0.26.0

1 year ago

0.25.1

1 year ago

0.25.0

1 year ago

0.25.0-alpha.1

1 year ago

0.24.4

2 years ago

0.24.3

2 years ago

0.24.2

2 years ago

0.24.1

2 years ago

0.24.0

3 years ago

0.23.3

3 years ago

0.23.2

3 years ago

0.23.1

3 years ago

0.23.0

4 years ago

0.22.0

4 years ago

0.21.1

4 years ago

0.21.1-beta.2

4 years ago

0.21.1-beta.0

4 years ago

0.21.1-beta.1

4 years ago

0.21.0

4 years ago

0.20.1

4 years ago

0.20.0

4 years ago

0.20.0-beta.3

4 years ago

0.20.0-beta.2

4 years ago

0.20.0-beta.0

4 years ago

0.20.0-beta.1

4 years ago

0.19.0

4 years ago

0.18.4

4 years ago

0.18.3

4 years ago

0.18.2

4 years ago

0.18.1

4 years ago

0.18.0

4 years ago

0.17.0

4 years ago

0.16.1

4 years ago

0.16.0

4 years ago

0.15.0

4 years ago

0.14.2

4 years ago

0.14.1

4 years ago

0.14.0

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.1

4 years ago

0.12.0

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.2

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.8.0-beta.0

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago