release.js
function updateMaster () {
    pushCmds.push(
        comment('update package.json in master'),
        'git checkout master',
        `git pull --rebase ${origin} master --strategy=theirs`,
        `git checkout release/${newVersion} -- CHANGELOG.md`,
        `node -e "const newVersion = '${newVersion}'; ${stringifyFunction(buildCommand)}"`,
        'git add CHANGELOG.md',
        'git add package.json',
        `git commit -m "update version number in package.json to ${newVersion}"`,
        `git push ${origin} master`
    );

    function buildCommand () {
      require('fs').writeFileSync('package.json', JSON.stringify(getUpdatedJson(), null, 2));
      function getUpdatedJson () {
        const json = require('./package.json');
        json.version = newVersion;
        return json;
      }
    }

    function stringifyFunction (method) {
      return method
          .toString()
          .split('\n')
          .slice(1, -1)
          .map(function (line) { return line.trim(); })
          .join(' ')
          .replace(/"/g, '\\"');
    }
  }
function updateMaster () {
    pushCmds.push(
        comment('update package.json in master'),
        'git checkout master',
        `git pull --rebase ${origin} master --strategy=theirs`,
        `git checkout release/${newVersion} -- CHANGELOG.md`,
        `node -e "const newVersion = '${newVersion}'; ${stringifyFunction(buildCommand)}"`,
        'git add CHANGELOG.md',
        'git add package.json',
        `git commit -m "update version number in package.json to ${newVersion}"`,
        `git push ${origin} master`
    );

    function buildCommand () {
      require('fs').writeFileSync('package.json', JSON.stringify(getUpdatedJson(), null, 2));
      function getUpdatedJson () {
        const json = require('./package.json');
        json.version = newVersion;
        return json;
      }
    }

    function stringifyFunction (method) {
      return method
          .toString()
          .split('\n')
          .slice(1, -1)
          .map(function (line) { return line.trim(); })
          .join(' ')
          .replace(/"/g, '\\"');
    }
  }
function updateMaster ( ) { pushCmds . push ( comment ( 'update package.json in master' ) , 'git checkout master' , ` ${ origin } ` , ` ${ newVersion } ` , ` ${ newVersion } ${ stringifyFunction ( buildCommand ) } ` , 'git add CHANGELOG.md' , 'git add package.json' , ` ${ newVersion } ` , ` ${ origin } ` ) ; function buildCommand ( ) { require ( 'fs' ) . writeFileSync ( 'package.json' , JSON . stringify ( getUpdatedJson ( ) , null , 2 ) ) ; function getUpdatedJson ( ) { const json = require ( './package.json' ) ; json . version = newVersion ; return json ; } } function stringifyFunction ( method ) { return method . toString ( ) . split ( '\n' ) . slice ( 1 , - 1 ) . map ( function ( line ) { return line . trim ( ) ; } ) . join ( ' ' ) . replace ( / " / g , '\\"' ) ; } }
copies the changelog back over to master branch
copies the changelog back over to master branch