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: cookpete/auto-changelog
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.1
Choose a base ref
...
head repository: cookpete/auto-changelog
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.2
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Oct 31, 2017

  1. Tweak package read logic

    cookpete committed Oct 31, 2017
    Copy the full SHA
    5ca75a2 View commit details
  2. Copy the full SHA
    74e29b4 View commit details
  3. 1.0.2

    cookpete committed Oct 31, 2017
    Copy the full SHA
    6d21771 View commit details
Showing with 11 additions and 14 deletions.
  1. +5 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +1 −1 src/origin.js
  4. +4 −12 src/run.js
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.

Generated by [auto-changelog](https://github.com/CookPete/auto-changelog).

#### [v1.0.2](https://github.com/CookPete/auto-changelog/compare/v1.0.1...v1.0.2)
> 31 October 2017
- Tweak package read logic [`5ca75a2`](https://github.com/CookPete/auto-changelog/commit/5ca75a2a051a496fe7899185d486dc6447a44d7a)
- Fall back to https origin protocol [`74e29b4`](https://github.com/CookPete/auto-changelog/commit/74e29b4c40a8522a8aa33b6b66e845859dbcde1d)

#### [v1.0.1](https://github.com/CookPete/auto-changelog/compare/v1.0.0...v1.0.1)
> 27 October 2017
- Filter out commits with the same message as an existing merge [`2a420f7`](https://github.com/CookPete/auto-changelog/commit/2a420f793ac3b761291cfd5499676a80953cbee7)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auto-changelog",
"version": "1.0.1",
"version": "1.0.2",
"description": "Command line tool for generating a changelog from git tags and commit history",
"bin": {
"auto-changelog": "./lib/index.js"
2 changes: 1 addition & 1 deletion src/origin.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ export async function fetchOrigin (remote) {
throw new Error(`Git remote ${remote} was not found`)
}
const origin = parseRepoURL(originURL)
const protocol = origin.protocol || 'http:'
const protocol = origin.protocol || 'https:'
const host = origin.hostname || origin.host
return {
...origin,
16 changes: 4 additions & 12 deletions src/run.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import commander from 'commander'
import { readJson, writeFile } from 'fs-extra'
import { readJson, writeFile, pathExists } from 'fs-extra'

import { version } from '../package.json'
import { fetchOrigin } from './origin'
@@ -21,25 +21,17 @@ commander
.version(version)
.parse(process.argv)

async function getPackageVersion () {
const pkg = await readJson('package.json')
return NPM_VERSION_TAG_PREFIX + pkg.version
}

export default async function run () {
const pkg = await readJson('package.json')
const pkg = await pathExists('package.json') && await readJson('package.json')
let options = { ...commander }
if (pkg) {
options = {
...options,
...pkg['auto-changelog']
}
options = { ...options, ...pkg['auto-changelog'] }
} else if (commander.package) {
throw Error('package.json could not be found')
}
const origin = await fetchOrigin(options.remote)
const commits = await fetchCommits(origin)
const packageVersion = options.package ? await getPackageVersion() : null
const packageVersion = options.package ? NPM_VERSION_TAG_PREFIX + pkg.version : null
const releases = parseReleases(commits, origin, packageVersion, options.unreleased)
const log = await compileTemplate(options.template, { releases })
await writeFile(options.output, log)