Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ungoldman/gh-release
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.0.3
Choose a base ref
...
head repository: ungoldman/gh-release
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.0.4
Choose a head ref
  • 9 commits
  • 10 files changed
  • 4 contributors

Commits on Oct 2, 2020

  1. chore(deps): bump actions/setup-node from v2.1.1 to v2.1.2

    Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.1 to v2.1.2.
    - [Release notes](https://github.com/actions/setup-node/releases)
    - [Commits](actions/setup-node@v2.1.1...c6fd00c)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 2, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    601030c View commit details
  2. Merge pull request #110 from hypermodules/dependabot/github_actions/a…

    …ctions/setup-node-v2.1.2
    
    chore(deps): bump actions/setup-node from v2.1.1 to v2.1.2
    bcomnes authored Oct 2, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f42a081 View commit details

Commits on Oct 22, 2020

  1. chore(deps-dev): bump standard from 14.3.4 to 15.0.0 (#111)

    Bumps [standard](https://github.com/standard/standard) from 14.3.4 to 15.0.0.
    - [Release notes](https://github.com/standard/standard/releases)
    - [Changelog](https://github.com/standard/standard/blob/master/CHANGELOG.md)
    - [Commits](standard/standard@v14.3.4...v15.0.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 22, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    422bca3 View commit details

Commits on Oct 28, 2020

  1. chore(deps-dev): bump snazzy from 8.0.0 to 9.0.0 (#112)

    Bumps [snazzy](https://github.com/feross/snazzy) from 8.0.0 to 9.0.0.
    - [Release notes](https://github.com/feross/snazzy/releases)
    - [Commits](standard/snazzy@v8.0.0...v9.0.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 28, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    29674ff View commit details

Commits on Nov 4, 2020

  1. chore(deps): bump actions/checkout from v2.3.3 to v2.3.4

    Bumps [actions/checkout](https://github.com/actions/checkout) from v2.3.3 to v2.3.4.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v2.3.3...5a4ac90)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 4, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    755d689 View commit details

Commits on Nov 5, 2020

  1. Merge pull request #115 from hypermodules/dependabot/github_actions/a…

    …ctions/checkout-v2.3.4
    
    chore(deps): bump actions/checkout from v2.3.3 to v2.3.4
    bcomnes authored Nov 5, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5e1ae2e View commit details

Commits on Nov 12, 2020

  1. chore(deps-dev): bump standard from 15.0.1 to 16.0.2 (#116)

    * chore(deps-dev): bump standard from 15.0.1 to 16.0.2
    
    Bumps [standard](https://github.com/standard/standard) from 15.0.1 to 16.0.2.
    - [Release notes](https://github.com/standard/standard/releases)
    - [Changelog](https://github.com/standard/standard/blob/master/CHANGELOG.md)
    - [Commits](standard/standard@v15.0.1...v16.0.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    * lint fixes
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: john gravois <jagravois@gmail.com>
    dependabot[bot] and jgravois authored Nov 12, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    306f913 View commit details

Commits on Dec 4, 2020

  1. CHANGELOG

    Woops, I published beta to the wrong channel.
    bcomnes committed Dec 4, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    bcomnes Bret Comnes
    Copy the full SHA
    c568ebd View commit details
  2. 4.0.4

    bcomnes committed Dec 4, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    bcomnes Bret Comnes
    Copy the full SHA
    a83075e View commit details
Showing with 109 additions and 104 deletions.
  1. +2 −2 .github/workflows/test.yml
  2. +4 −0 CHANGELOG.md
  3. +24 −24 bin/cli.js
  4. +19 −18 bin/lib/get-defaults.js
  5. +12 −12 bin/lib/preview.js
  6. +1 −1 bin/lib/yargs.js
  7. +29 −29 index.js
  8. +3 −3 package.json
  9. +9 −9 test/get-defaults-test.js
  10. +6 −6 test/index.js
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -12,9 +12,9 @@ jobs:
node: [12, 14]

steps:
- uses: actions/checkout@v2.3.3
- uses: actions/checkout@v2.3.4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.1
uses: actions/setup-node@v2.1.2
with:
node-version: ${{ matrix.node-version }}
- run: npm i
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@ Project versioning adheres to [Semantic Versioning](http://semver.org/).
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).

## [4.0.4](https://github.com/hypermodules/gh-release/compare/v4.0.3...v4.0.4) - 2020-12-04

- Republish of 4.0.3 due to a bad beta version publish on the latest npm tag.

## [4.0.3](https://github.com/hypermodules/gh-release/compare/v4.0.2...v4.0.3) - 2020-09-30

- update-notifier version 5.0.0 (drops old node, and bugfixes)
48 changes: 24 additions & 24 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
#!/usr/bin/env node

var extend = require('deep-extend')
var fs = require('fs')
var path = require('path')
var chalk = require('chalk')
var ghauth = require('ghauth')
var inquirer = require('inquirer')
var ghRelease = require('../')
var getDefaults = require('./lib/get-defaults')
var preview = require('./lib/preview')
var yargs = require('./lib/yargs')
var updateNotifier = require('update-notifier')
var pkg = require('../package.json')
var Gauge = require('gauge')
var argv = yargs.argv
const extend = require('deep-extend')
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const ghauth = require('ghauth')
const inquirer = require('inquirer')
const ghRelease = require('../')
const getDefaults = require('./lib/get-defaults')
const preview = require('./lib/preview')
const yargs = require('./lib/yargs')
const updateNotifier = require('update-notifier')
const pkg = require('../package.json')
const Gauge = require('gauge')
const argv = yargs.argv

// notify of update if needed

updateNotifier({ pkg: pkg }).notify()

// check dir

var pkgExists = fs.existsSync(path.resolve(argv.workpath, 'package.json'))
var logExists = fs.existsSync(path.resolve(argv.workpath, 'CHANGELOG.md'))
const pkgExists = fs.existsSync(path.resolve(argv.workpath, 'package.json'))
const logExists = fs.existsSync(path.resolve(argv.workpath, 'CHANGELOG.md'))

if (!pkgExists || !logExists) {
console.log('Must be run in a directory with package.json and CHANGELOG.md')
yargs.showHelp()
process.exit(1)
}

var isEnterprise = !!argv.endpoint && argv.endpoint !== 'https://api.github.com'
const isEnterprise = !!argv.endpoint && argv.endpoint !== 'https://api.github.com'

// get auth

var ghauthOpts = {
const ghauthOpts = {
clientId: ghRelease.clientId,
configName: 'gh-release',
scopes: ['repo'],
@@ -62,7 +62,7 @@ if (process.env.GH_RELEASE_GITHUB_API_TOKEN) {
}

function releaseWithAuth (auth) {
var options = {}
const options = {}
options.auth = auth
options.cli = true
// get defaults
@@ -76,7 +76,7 @@ function releaseWithAuth (auth) {

// filter options through whitelist

var whitelist = ghRelease.OPTIONS.whitelist
const whitelist = ghRelease.OPTIONS.whitelist

Object.keys(options).forEach(function (key) {
if (whitelist.indexOf(key) === -1) delete options[key]
@@ -100,7 +100,7 @@ function releaseWithAuth (auth) {
}
// confirm & release

var confirmation = [{
const confirmation = [{
type: 'confirm',
name: 'confirm',
message: 'publish release to github?',
@@ -121,7 +121,7 @@ function releaseWithAuth (auth) {
function performRelease (options) {
// pass options to api

var release = ghRelease(options, function ghReleaseCallback (err, result) {
const release = ghRelease(options, function ghReleaseCallback (err, result) {
// handle errors
if (err) return handleError(err)

@@ -139,7 +139,7 @@ function performRelease (options) {
console.log(result.html_url)
process.exit(0)
})
var gauge = new Gauge(process.stderr, {
const gauge = new Gauge(process.stderr, {
updateInterval: 50,
theme: 'colorBrailleSpinner'
})
@@ -157,7 +157,7 @@ function performRelease (options) {
}

function handleError (err) {
var msg = err.message || JSON.stringify(err)
const msg = err.message || JSON.stringify(err)
console.log(chalk.red(msg))
process.exit(1)
}
37 changes: 19 additions & 18 deletions bin/lib/get-defaults.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
var path = require('path')
var fs = require('fs')
var changelogParser = require('changelog-parser')
var exec = require('shelljs').exec
var parseRepo = require('github-url-to-object')
const path = require('path')
const fs = require('fs')
const changelogParser = require('changelog-parser')
const exec = require('shelljs').exec
const parseRepo = require('github-url-to-object')

function getDefaults (workPath, isEnterprise, callback) {
var pkg = require(path.resolve(workPath, 'package.json'))
var lernaPath = path.resolve(workPath, 'lerna.json')
const pkg = require(path.resolve(workPath, 'package.json'))
const lernaPath = path.resolve(workPath, 'lerna.json')

if (!Object.hasOwnProperty.call(pkg, 'repository')) {
return callback(new Error('You must define a repository for your module => https://docs.npmjs.com/files/package.json#repository'))
}

var commit = getTargetCommitish()
var repoParts = parseRepo(pkg.repository, {
const commit = getTargetCommitish()
const repoParts = parseRepo(pkg.repository, {
enterprise: isEnterprise
})
if (!repoParts) {
return callback(new Error('The repository defined in your package.json is invalid => https://docs.npmjs.com/files/package.json#repository'))
}
var owner = repoParts.user
var repo = repoParts.repo
var logPath = path.resolve(workPath, 'CHANGELOG.md')
const owner = repoParts.user
const repo = repoParts.repo
const logPath = path.resolve(workPath, 'CHANGELOG.md')

changelogParser(logPath, function (err, result) {
if (err) return callback(err)

// check for 'unreleased' section in CHANGELOG: allow sections which do not include a body (eg. 'Added', 'Changed', etc.)

var unreleased = result.versions.filter(function (release) {
const unreleased = result.versions.filter(function (release) {
return release.title && release.title.toLowerCase
? release.title.toLowerCase().indexOf('unreleased') !== -1
: false
@@ -40,17 +40,18 @@ function getDefaults (workPath, isEnterprise, callback) {
return callback(new Error('Unreleased changes detected in CHANGELOG.md, aborting'))
}

var log = result.versions.filter(function (release) { return release.version !== null })[0]
const log = result.versions.filter(function (release) { return release.version !== null })[0]

if (!log) {
return callback(new Error('CHANGELOG.md does not contain any versions'))
}

var lerna = {}
let lerna = {}
let errStr
if (fs.existsSync(lernaPath)) {
lerna = require(lernaPath) /* || {} */ // 👈 though I prefer this expression
if (log.version !== lerna.version) {
var errStr = 'CHANGELOG.md out of sync with lerna.json '
errStr = 'CHANGELOG.md out of sync with lerna.json '
errStr += '(' + (log.version || log.title) + ' !== ' + lerna.version + ')'
return callback(new Error(errStr))
}
@@ -60,7 +61,7 @@ function getDefaults (workPath, isEnterprise, callback) {
return callback(new Error(errStr))
}

var version = pkg.version ? 'v' + pkg.version : lerna.version ? 'v' + lerna.version : null
const version = pkg.version ? 'v' + pkg.version : lerna.version ? 'v' + lerna.version : null

callback(null, {
body: log.body,
@@ -81,7 +82,7 @@ function getDefaults (workPath, isEnterprise, callback) {
}

function getTargetCommitish () {
var commit = exec('git rev-parse HEAD', { silent: true }).split('\n')[0]
const commit = exec('git rev-parse HEAD', { silent: true }).split('\n')[0]
if (commit.indexOf('fatal') === -1) return commit
return 'master'
}
24 changes: 12 additions & 12 deletions bin/lib/preview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var chalk = require('chalk')
var extend = require('deep-extend')
var columnWidth = 20
const chalk = require('chalk')
const extend = require('deep-extend')
const columnWidth = 20

function preview (options) {
var intro = '\ncreating release ' + chalk.bold(options.tag_name) +
const intro = '\ncreating release ' + chalk.bold(options.tag_name) +
' for ' + chalk.bold(options.owner + '/' + options.repo) + '\n'
var prettyOptions = formatOptions(options)
const prettyOptions = formatOptions(options)

console.log(intro)

@@ -17,8 +17,8 @@ function preview (options) {
}

function formatOptions (options) {
var formatted = []
var copy = extend({}, options)
const formatted = []
const copy = extend({}, options)

delete copy.auth
delete copy.owner
@@ -27,15 +27,15 @@ function formatOptions (options) {
delete copy.yes
delete copy.workpath

var keys = Object.keys(copy).reverse()
const keys = Object.keys(copy).reverse()

keys.forEach(function (key) {
if (['assets', 'draft', 'prerelease'].indexOf(key) > -1) {
if (!copy[key]) return
}

if (key === 'body') {
var body = formatBody(copy.body)
const body = formatBody(copy.body)
formatted.push.apply(formatted, body)
} else {
formatted.push({ column1: justify(key), column2: copy[key] })
@@ -46,17 +46,17 @@ function formatOptions (options) {
}

function formatBody (body) {
var arr = []
const arr = []
arr.push({ column1: justify('body'), column2: '' })
arr.push({ column1: '', column2: '' })
body.split('\n').map(function (line, i) {
body.split('\n').forEach(function (line) {
arr.push({ column1: '', column2: line })
})
return arr
}

function justify (word) {
var justified = word + ':'
let justified = word + ':'
while (justified.length < columnWidth) justified += ' '
return justified
}
2 changes: 1 addition & 1 deletion bin/lib/yargs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var version
let version
try {
version = require('../../lerna.json').version
} catch (_) {
Loading