Releases with Thought
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


NPM version Travis Build Status [Appveyor Build Status] ( Coverage Status

Create high quality releases with less work

People like substack encourage you to divide the functionality of large monolithic modules into reasonable parts and publish each of those as module on there own. That's what I did when I separated swagger-to-html into bootprint and three template modules and then extracted multiple modules (i.e. the customize-family) from bootprint, so that it was easy to implement thought on this basis as well.

The problem is, that now there are 10 modules to maintain instead of just one. The overhead for releasing new versions is about the same for each package. This module is a toolkit to make the following tasks easier, thus increasing the package quality and reducing the workload for a release:

  • Generate changelog: Changelog generation is inspired by the Ghost git workflow
  • QA git hooks: This can be done using the ghooks package. Thougthful has no builtins for that.
  • Git workflow: Git hooks to prevent commiting to master directly. Support for cleaning up the history before merging to master
  • Release workflow: (not yet implemented) A command to run tests, generate changelog, bump versions and publish to npm, similar to the release-tools-package


npm install -g thoughtful-release

CLI options

Calling thoughtful --help will print a command-line reference:

Usage: thoughtful [options] [command]


    changelog [options]              Update the file of the module in the current directory.
    precommit                        Perform precommit-checks (locked branches...). Return non-zero exit-code if something is wrong
    sequence-editor <filename>       "Editor" for the rebase todos (replacing "pick" with "squash") with no interaction
    cleanup-history [target-branch]  Rebase the current branch onto another branch, condensing the whole branch into a single commit.


    -h, --help     output usage information
    -V, --version  output the version number

Please refer to the command line reference of this project for details about the commands.

Supporting the git workflow

You can enforce the above workflow using git-hooks and Thoughtful. Have a look at the git-workflow-document.



Kind: global class

new Thoughtful(cwd)

Return a new Thoughtful instance

Param Type Description
cwd string the working directory of that instance

thoughtful.updateChangelog([options]) ⇒ Promise.<?>

Update the of the module in the given working directory.

Kind: instance method of Thoughtful
Returns: Promise.<?> - a promise for finishing writing the changelog

Param Type Description
[options] object optional parameters
[options.release] string the release specification (as in npm version). If no value is provided, the current version from the package.json will be used. This is useful, when the function is called by as npm-version script in which case it is called after version bump but before committing the change.
[options.openEditor] boolean if this value is true, the changelog-file will be opened in an editor before commiting to git. The environment variable THOUGHTFUL_CHANGELOG_EDITOR may contain a custom command to open the editor. If this variable is not set, the EDITOR variable or vi will be used.
[options.addToGit] boolean if this value is true, the changelog-file will be staged in the git repository

thoughtful.rejectLockedBranches() ⇒ Promise.<boolean>

Throw an exception if the current branch is listed in package.json under $.thoughtful.lockedBranches.

The branch check can be disabled by setting the environment variable THOUGHTFUL_LOCKED_BRANCHES=false

Kind: instance method of Thoughtful
Returns: Promise.<boolean> - true, if the branch is not locked.
Throw: Error if the branch is locked


For use with "git -c sequence.editor=..." when rebasing and squashing feature-branches

Replace "pick" commits in rebase-todo-file by "squash" (except the first).

Kind: instance method of Thoughtful

Param Description
filename the name of the file to be edited


Perform a rebase of the current (topic-)branch onto a target-branch, condensing the whole branch into a single commit.

Kind: instance method of Thoughtful

Param Type Description
options object options to this function
[options.targetBranch] string the branch to rebase the current branch upon (default: master)
[options.thoughtful] string the command to invoke "thoughtful" (default: process.argv[1])


Reset and reload the cached parts of Thoughtful

Kind: instance method of Thoughtful


thoughtful-release is published under the MIT-license. See for details.


For release notes, see

Contributing guidelines