Git Product home page Git Product logo

node-generate-release's Introduction

node-generate-release

Generate a release for a project following semver using nodejs and gitflow or git-stream

Generate Release on Travis CI Coverage Status Generate Release on NPM Generate Release uses the MIT

Current Version: 1.1.1

Requires NodeJS v4.0.0 or greater

Generate Release Example

Usage

You can either install generate-release globally or for a single project

Globally

Install package

npm install -g generate-release

Navigate to your project and execute generate-release

Locally

cd your/project
npm install --save-dev generate-release

Then add the following to your package.json file:

{
    "scripts": {
        "release": "generate-release"
    }
}

Then you can run npm run-script release in order to generate a release.

Important notes for gitflow OSX

Git-flow from nvie is broken on OSX, and generate-release will not work. Please use the updated and actively maintained version from petervanderdoes, https://github.com/petervanderdoes/gitflow-avh. Please follow the OSX Install Guide

What does it do?

This is the default process.

  1. Verify the working directory is clean
  2. Reads git-flow settings from repo config file
  3. Reads Current version from package.json file and generates the new version
  4. Fetches from remote
  5. Rebases remote/develop into develop
  6. Resets master to remote/master
  7. Starts a gitflow or git-stream release named the new version number
  8. Changes the version number in package.json and any files in files_to_version
  9. Runs all pre_commit_commands
  10. Commits the changes to the package.json and any file in files_to_version and files_to_commit
    1. This will also commit any file deletions which may have occurred during the pre_commit_commands
  11. Runs all post_commit_commands
  12. Runs the gitflow or git-stream finish release command
  13. Pushes master, develop, and tags to remote
  14. Runs all the post_complete_commands

If any of the steps aside from the post_complete_commands step fail, the entire release is canceled and everything is reset.

All commands are run in either sh or cmd.exe. If sh is available, even on windows, it will use that first.

Options

CLI

run generate-release --help to see this as well.

-p, --package   FILE            Path to package.json file. Default: ./package.json
-c, --current-version VERSION   Current Version. Default: read from package.json
-v, --next-version VERSION      Next Version. Default: automatically bumps
-t, --release-type TYPE         Release Type: patch, minor, major. Ignored when next-version is given. Default: prompt, if next-version is undefined
-n, --no-confirm                Do not ask for confirmation. Default: prompt for confirmation
-l, --skip-git-pull             Do not pull from origin and rebase master and dev. Default: Do pull
-s, --skip-git-push             Do not push to origin when complete. Default: Do push
-f, --skip-git-flow-finish,     Do not finish git-flow release. Default: Do finish
    --skip-finish
-d, --release-file FILE         Path to your .release.json file. Default: ./.release.json
-o, --remote REMOTE             Change the remote. Default: origin
-q, --quiet                     Less output. Default: Do show output
-m, release-message [MESSAGE]   Set a release message. If no message given, prompt for one. Will replace
                                "{version}" with the next version. Default: Release {version}

Release File

By default, the following options can be set in a .release.json file. The following is an example with all default options set.

  {
      "package_file_location": "./package.json",
      "no_confirm": false,
      "skip_git_pull": false,
      "skip_git_push": false,
      "skip_finish": false,
      "release_message": true,
      "remote": "origin",
      "pre_commit_commands": [],
      "post_commit_commands": [],
      "post_complete_commands": [],
      "files_to_commit": [],
      "files_to_version": ["README.md"]
  }

The files_to_commit and files_to_version use node-glob. See the documentation located there on how to format those options.

If release_message is true, then you will be prompted to write a release message via your editor of choice.

package.json

If you are using this for an NPM package, you can include all the above options in your package.json instead of a dedicated file.

Place all your configuration options in config : generateRelease.

{
    ...
    "config": {
        "generateRelease": {
            "no_confirm": false,
            "remote": "origin"
        }
    },
    ...
}

Option Precedence

Precedence is determined in the following order:

  • CLI Argument
  • package.json file
  • .release.json file

Building Assets, Running Tests, and Publishing Package

If you wish to build assets, run test, and/or publish your project automatically when the release is being generated you can use the example .release.json file below. The following assumptions are made:

  • You have a script in your package file to build your assets named build-assets
  • All your built assets are saved to ./build
  • You run your tests via the npm test command
  • You publish your package via the npm publish command

.release.json

{
    "pre_commit_commands": [
        "npm run-script build-assets"
    ],
    "post_commit_commands": [
        "npm test"
    ],
    "post_complete_commands": [
        "npm publish"
    ],
    "files_to_commit": [
        "./build/**/*"
    ]
}

Usage on a Non NPM Based Repo

It's quite simple to use this on a non NPM based repo. The only npm specific aspect baked into Generate Release is the usage of the package.json file. In fact, you are able to use any json file which maintains a version property. If you are working on a PHP project which uses Composer, the composer.json already has the required property. Either call generate-release with -p composer.json or set the package_file_location property of your .release.json file.

If your project does not already contain a json file which maintains a version, you just use the .release.json file! Just put a version property in the file and set package_file_location to ".release.json".

Roadmap

  • Write tests Partial
  • Code coverage for tests Partial
  • Change remote (not origin)
  • Allow for custom hook (like running gulp or grunt during release to prepare assets)
  • Ability to define arbitrary files to replace version in (like source code files, other MD's, etc)
  • Use and parse a .release file to parse defaults (instead of using cli switches)
  • Custom release message
  • Read git-flow configuration from .git folder

node-generate-release's People

Contributors

greenkeeper[bot] avatar hetzijzo avatar johnnyghost avatar mat21psu avatar mrkmg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-generate-release's Issues

An in-range update of nyc is breaking the build 🚨

Version 10.3.2 of nyc just got published.

Branch Build failing 🚨
Dependency nyc
Current Version 10.3.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As nyc is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ coverage/coveralls Coverage pending from Coveralls.io Details,- ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 2 commits0.

  • e062a86 chore(release): 10.3.2
  • 213206f fix: we should not create a cache folder if cache is false (#567)

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

git-flow versiontag

If I specify a versiontag in my git-flow options, I have noticed two issues:

  1. The versiontag is prepended to the version written into my package.json. I don't think that should be.
  2. The tag created in git has the versiontag prepended twice. ex: if my versiontag is 'REL-', my git tags look like 'REL-REL-x.x.x'. I don't think this should be either, it is probably a side effect of prepending the versiontag and putting that value in options.next_version.

Some ideas

After using the generate-relase module here are some ideas and features which would be nice to have πŸ˜‰

Instead of creating an extra file .release.json it would be nice put options in the config of the package.json.

{
  config: {
    release: {
      no_confirm: false,
      skip_git_pull: false,
      skip_git_push: false,
      // etc ...
    }
  }
}

It would be cool to have a option to set your own default release message.

release_message: "My release message for {version}"

Problem regex GIT_CLEAN_REGEX

Good night, I can not say if it could be considered a bug, but always I run the command to generate the release, the error message was displayed: 'Working directory is not clean, not ready for release'

I noticed that installing git on ubuntu via apt-get translated the reply messages into my language.

So the regex did not work. I changed the regex and everything worked perfectly.

Excellent project

An in-range update of inquirer is breaking the build 🚨

Version 3.1.0 of inquirer just got published.

Branch Build failing 🚨
Dependency inquirer
Current Version 3.0.6
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

inquirer is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ coverage/coveralls Coverage pending from Coveralls.io Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes v3.1.0
  • password prompt can now rendered hidden input (Unix style)
  • filter function now also receive the current answers as argument
  • Smaller package size
Commits

The new version differs by 17 commits.

  • e612cc5 3.1.0
  • 148cb71 Update eslint-config-xo-space to the latest version πŸš€ (#516)
  • 3b93dd5 call chalk.reset() after message prompt (#544)
  • 3ff39a6 chore(package): update chai to version 4.0.1 (#541)
  • 76f1bfe upgrade external-editor to 2.0.4 (#535)
  • da4eceb pass current answers hash to filter (#533)
  • f99b398 Use rx-lite-aggregates instead of full rx (#532)
  • 20119a2 fix(package): update ansi-escapes to version 2.0.0 (#527)
  • e294e16 Update validate fn param docs (#526)
  • 5b3a4a2 Add masked password example
  • 9de81a8 Fix linting of tests
  • d7db156 Add some tests
  • 50a9beb Switch conditionals
  • 379e0aa Inform user that input is hidden
  • bf28e76 Password prompt should display no characters

There are 17 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of nyc is breaking the build 🚨

Version 11.2.0 of nyc just got published.

Branch Build failing 🚨
Dependency nyc
Current Version 11.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As nyc is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
  • βœ… coverage/coveralls First build on greenkeeper/nyc-11.2.0 at 85.759% Details

Commits

The new version differs by 7 commits.

  • b2ff72d chore(release): 11.2.0
  • 97b962e chore: explicit update of istanbul-lib-instrument (#662)
  • 0dcceda feat: allow cwd to be configured see #620
  • 0fc6d8f chore: add support for --cwd (#542) (#620)
  • 658dba4 fix: remove excluded files from coverage before writing (#649)
  • dd40dc5 feat: add possibility to filter coverage-maps (#637)
  • fb3ab92 docs: add link to community slack (#639)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Change commit message

Hello @mrkmg , how are you?

I'm trying to change the commit message to conform to @commitlint/config-conventional requirements.

I tried it: generate-release -t patch -m build: {version}

But got an error, the version was not in commit message.

β§—   input: build:
βœ–   subject may not be empty [subject-empty]
βœ–   type may not be empty [type-empty]

The input: expected was like: build: 0.0.1

Would you help me?

Thanks

getopt does not support spaces in arguments on Mac OS X

[Generate Release] GIT: Pull from Origin
[Generate Release] GIT: Pull from Origin                         Complete
[Generate Release] GIT: Start Release                            Complete
[Generate Release] Files: Write New Version                      Complete
[Generate Release] Commands: Pre Commit                          Complete
[Generate Release] GIT: Commit Files                             Complete
[Generate Release] Commands: Post Commit                         Complete
[Generate Release] GIT: Finish Release                          Finishing
[Generate Release] Commands: Post Complete
git flow release finish -m Release 0.3.0 0.3.0 returned 2.

 Output:

 flags:FATAL the available getopt does not support spaces in options

I get a problem when running the command on OSX.
There is a bug about this on gitflow.

Can you add it so that FLAGS_GETOPT_CMD is used if it exists?
Or how to solve this error?

Can't release

Running takes too long for pull and push

$ generate-release -t patch
? Are you sure you want to update the release from 0.0.2 to 0.0.3 Yes
[Generate Release] GIT: Pull from Origin                          Pulling 
[Generate Release] GIT: Start Release                                     
[Generate Release] Files: Write New Version                               
[Generate Release] Commands: Pre Commit                                   
[Generate Release] GIT: Commit Files                                      
[Generate Release] Commands: Post Commit                                  
[Generate Release] GIT: Finish Release                                    
[Generate Release] GIT: Push to Origin                                    
[Generate Release] Commands: Post Complete

Release command fails

I just tried to generate a release however, the package.json gets not updated or commited and i get this error message. Any suggestions?

err

An in-range update of inquirer is breaking the build 🚨

Version 3.3.0 of inquirer just got published.

Branch Build failing 🚨
Dependency inquirer
Current Version 3.2.3
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

inquirer is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
  • βœ… coverage/coveralls First build on greenkeeper/inquirer-3.3.0 at 85.759% Details

Release Notes v3.3.0
  • Added prefix and suffix options to question object to allow you to edit the ? prefix or add a custom suffix.
Commits

The new version differs by 3 commits.

  • dcf3110 3.3.0
  • f859745 Added prefix and suffix custom option (#571)
  • e44b4f3 Update ansi-escapes to the latest version πŸš€ (#584)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of sinon is breaking the build 🚨

Version 2.3.8 of sinon just got published.

Branch Build failing 🚨
Dependency sinon
Current Version 2.3.7
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As sinon is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
  • βœ… coverage/coveralls First build on greenkeeper/sinon-2.3.8 at 85.802% Details

Release Notes Fix #1474: stub#usingPromise and stub#onNthCall have unexpected interactions

This release fixes #1474

Commits

The new version differs by 6 commits.

  • 717ebf7 Update docs/changelog.md and set new release id in docs/_config.yml
  • 4f1bcc0 Add release documentation for v2.3.8
  • 083632e 2.3.8
  • 0b5bd48 Update Changelog.txt and AUTHORS for new release
  • 7512258 Merge pull request #1484 from HugoMuller/issue-1474
  • d14d296 propagates promiseLibrary to new stub behaviors

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Can't generate release

Running, doesn't pull

# generate-release
? Release Type? patch
? Are you sure you want to update the release from 0.0.1 to 0.0.2 Yes
[Generate Release] GIT: Pull from Origin                          Pulling 
[Generate Release] GIT: Start Release                                     
[Generate Release] Files: Write New Version                               
[Generate Release] Commands: Pre Commit                                   
[Generate Release] GIT: Commit Files                                      
[Generate Release] Commands: Post Commit                                  
[Generate Release] GIT: Finish Release                                    
[Generate Release] GIT: Push to Origin                                    
[Generate Release] Commands: Post Complete

An in-range update of mocha is breaking the build 🚨

Version 3.5.1 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.5.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
  • βœ… coverage/coveralls First build on greenkeeper/mocha-3.5.1 at 85.759% Details

Release Notes v3.5.1

3.5.1 / 2017-09-09

πŸ“° News

  • πŸ“£ Mocha is now sponsoring PDXNode! If you're in the Portland area, come check out the monthly talks and hack nights!

πŸ› Fixes

  • #2997: Fix missing xit export for "require" interface (@solodynamo)
  • #2957: Fix unicode character handling in XUnit reporter failures (@jkrems)

πŸ”© Other

Commits

The new version differs by 14 commits.

  • 4070a44 Release v3.5.1
  • 466ba73 update CHANGELOG.md for v3.5.1 [ci skip]
  • 1cc0fc0 import/require xit, fixes #2972
  • 74fa66f update nyc to latest; remove workaround in travis script
  • aa52933 update coveralls strategy; closes #2984
  • 73a5338 Spelling (#2981)
  • 9f403bf Add utils.escape tests and fix unicode escaping
  • 800acbc whitelist "developer-experience" tag for stalebot [ci skip]
  • 5895671 Added issue, pull request templates. (#2869)
  • 075bd51 Merge pull request #2918 from mochajs/no-shell-test
  • 8710438 Work around Node 0.10 Windows flake when testing
  • 13b8340 Ensure that compiler lookup works and not just that transpilation works (#2922)
  • 26d337a Add tests for double-star behavior
  • c0e6b68 Eliminate glob.sh

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Unknown Git Plugin

Hello,

I get the following error:

$ npm run release

> [email protected] release
> generate-release

? Release Type patch
? Are you sure you want to update the release from 1.0.0 to 1.0.1 Yes
 β«Έ  GIT: Pull from Origin                                  
 β«Έ  GIT: Start Release                                     
 β«Έ  Files: Write New Version                               
 β«Έ  Commands: Pre Commit                                   
 β«Έ  GIT: Commit Files                                      
 β«Έ  Commands: Post Commit                                  
 β«Έ  GIT: Finish Release                                    
 β«Έ  GIT: Push to Origin                                    
 β«Έ  Commands: Post Complete                                
There was an unknown error.
Unknown Git Plugin

I have git-flow installed. Any idea what's going wrong?

Kind regards
Patrick

An in-range update of nyc is breaking the build 🚨

Version 10.3.0 of nyc just got published.

Branch Build failing 🚨
Dependency nyc
Current Version 10.2.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As nyc is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details - ❌ **continuous-integration/travis-ci/push** The Travis CI build is in progress [Details](https://travis-ci.org/mrkmg/node-generate-release/builds/227079771?utm_source=github_status&utm_medium=notification),- ❌ **dependency-ci** Failed dependency checks [Details](https://dependencyci.com/builds/202419)

Commits

The new version differs by 4 commits ahead by 4, behind by 2.

  • 55e826d chore(release): 10.3.0
  • 89dc7a6 chore: explicit update of istanbul dependnecies (#562)
  • 1887d1c feat: add support for --no-clean, to disable deleting raw coverage output (#558)
  • ff73b18 fix: source-maps were not being cached in the parent process when --all was being used (#556)

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of mocha is breaking the build 🚨

Version 3.4.0 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v3.4.0

Mocha is now moving to a quicker release schedule: when non-breaking changes are merged, a release should happen that week.

This week's highlights:

  • allowUncaught added to commandline as --allow-uncaught (and bugfixed)
  • warning-related Node flags

πŸŽ‰ Enhancements

πŸ› Fixes

πŸ”© Other

Commits

The new version differs by 9 commits0.

  • 7554b31 Add Changelog for v3.4.0
  • 9f7f7ed Add --trace-warnings flag
  • 92561c8 Add --no-warnings flag
  • ceee976 lint test/integration/fixtures/simple-reporter.js
  • dcfc094 Revert "use semistandard directly"
  • 93392dd no special case for macOS running Karma locally
  • 4d1d91d --allow-uncaught cli option
  • fb1e083 fix allowUncaught in browser
  • 4ed3fc5 Add license report and scan status

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.