Skip to content

Commit

Permalink
Fix Name.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidalnt committed Aug 25, 2024
1 parent 2be5fcf commit 8c08a51
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ BREAKING CHANGES:
- add oauth2 token authentication method [#5](https://github.com/ungoldman/gh-release/issues/5)
- add `CONTRIBUTING.md`
- refactor getDefaults, cli
- fix error when in directories w/o `package.json` & `CHANGELOG.md` [#9](https://github.com/ungoldman/gh-release/issues/9)
- fix error when in directories w/o `package.json` & `README.md` [#9](https://github.com/ungoldman/gh-release/issues/9)

## [1.0.8](https://github.com/ungoldman/gh-release/compare/v1.0.7...v1.0.8) - 2015-02-22

Expand All @@ -361,7 +361,7 @@ BREAKING CHANGES:

## [1.0.5](https://github.com/ungoldman/gh-release/compare/v1.0.4...v1.0.5) - 2015-02-08

- hotfix for help/usage in dir w/o `package.json` or `CHANGELOG.md`
- hotfix for help/usage in dir w/o `package.json` or `README.md`

## [1.0.4](https://github.com/ungoldman/gh-release/compare/v1.0.3...v1.0.4) - 2015-02-07

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Create a GitHub Release for a Node package.
## Features

- Uses the [Github Releases API](https://developer.github.com/v3/repos/releases/) to create a new GitHub release.
- Defaults to using information from `package.json` and `CHANGELOG.md`.
- Defaults to using information from `package.json` and `README.md`.
- Supports uploading release assets.

## Install
Expand Down Expand Up @@ -60,7 +60,7 @@ https://github.com/ungoldman/gh-release-test/releases/tag/v1.0.9

Should be run at the root of the project to be released.

Expects a `package.json` and `CHANGELOG.md` in the working directory.
Expects a `package.json` and `README.md` in the working directory.

Prints release URL to `stdout` on success.

Expand Down Expand Up @@ -143,7 +143,7 @@ All default values taken from `package.json` unless specified otherwise.
| `tag_name` | release tag | 'v' + `version` |
| `target_commitish` | commitish value to tag | HEAD of current branch |
| `name` | release title | 'v' + `version` |
| `body` | release text | `CHANGELOG.md` section matching `version` |
| `body` | release text | `README.md` section matching `version` |
| `owner` | repo owner | repo owner in `repository` |
| `repo` | repo name | repo name in `repository` |
| `draft` | publish as draft | false |
Expand All @@ -155,7 +155,7 @@ Override defaults with flags (CLI) or the `options` object (node).

## Standards

* `CHANGELOG.md`: http://keepachangelog.com
* `README.md`: http://keepachangelog.com
* `package.json`: https://docs.npmjs.com/files/package.json

## Example
Expand All @@ -174,7 +174,7 @@ Windows (XP, 2000) | `%USERPROFILE%/Local Settings/Application Data/gh-release/c

## Motivation

There are packages that already do something like this, and they're great, but I want something that does this one thing really well and nothing else, leans heavily on standards in `package.json` and `CHANGELOG.md`, and can work both as a CLI tool and programmatically in node.
There are packages that already do something like this, and they're great, but I want something that does this one thing really well and nothing else, leans heavily on standards in `package.json` and `README.md`, and can work both as a CLI tool and programmatically in node.

## Contributing

Expand All @@ -188,7 +188,7 @@ Any other conventions (autochangelog, standard-version, etc.) are not currently

## History

Please read the [change log](CHANGELOG.md) for a human-readable history of changes.
Please read the [change log](README.md) for a human-readable history of changes.

## Tests

Expand Down
4 changes: 2 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ updateNotifier({ pkg }).notify()
// check dir

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

if (!pkgExists || !logExists) {
console.log('Must be run in a directory with package.json and CHANGELOG.md')
console.log('Must be run in a directory with package.json and README.md')
yargs.showHelp()
process.exit(1)
}
Expand Down
10 changes: 5 additions & 5 deletions bin/lib/get-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getDefaults (workPath, isEnterprise, callback) {
}
const owner = repoParts.user
const repo = repoParts.repo
const logPath = path.resolve(workPath, 'CHANGELOG.md')
const logPath = path.resolve(workPath, 'README.md')

changelogParser(logPath, function (err, result) {
if (err) return callback(err)
Expand All @@ -37,26 +37,26 @@ function getDefaults (workPath, isEnterprise, callback) {
})

if (unreleased.length > 0) {
return callback(new Error('Unreleased changes detected in CHANGELOG.md, aborting'))
return callback(new Error('Unreleased changes detected in README.md, aborting'))
}

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'))
return callback(new Error('README.md does not contain any versions'))
}

let lerna = {}
let errStr
if (fs.existsSync(lernaPath)) {
lerna = readJson(lernaPath) /* || {} */ // 👈 though I prefer this expression
if (log.version !== lerna.version) {
errStr = 'CHANGELOG.md out of sync with lerna.json '
errStr = 'README.md out of sync with lerna.json '
errStr += '(' + (log.version || log.title) + ' !== ' + lerna.version + ')'
return callback(new Error(errStr))
}
} else if (log.version !== pkg.version) {
errStr = 'CHANGELOG.md out of sync with package.json '
errStr = 'README.md out of sync with package.json '
errStr += '(' + (log.version || log.title) + ' !== ' + pkg.version + ')'
return callback(new Error(errStr))
}
Expand Down
12 changes: 6 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test('should return error if changelog version !== package.json version', functi
ghRelease({
workpath: fixture('mismatch')
}, function (err, result) {
t.deepEqual(err.message, 'CHANGELOG.md out of sync with package.json (0.0.1 !== 0.0.0)')
t.deepEqual(err.message, 'README.md out of sync with package.json (0.0.1 !== 0.0.0)')
})
})

Expand All @@ -26,12 +26,12 @@ test('should return error if changelog version !== lerna.json version', function
ghRelease({
workpath: fixture('lerna-mismatch')
}, function (err, result) {
t.deepEqual(err.message, 'CHANGELOG.md out of sync with lerna.json (0.0.1 !== 0.0.0)')
t.deepEqual(err.message, 'README.md out of sync with lerna.json (0.0.1 !== 0.0.0)')
})
})

test('should return error if a non-empty unreleased section exists', function (t) {
const errStr = 'Unreleased changes detected in CHANGELOG.md, aborting'
const errStr = 'Unreleased changes detected in README.md, aborting'
t.plan(1)
ghRelease({
workpath: fixture('unreleased')
Expand All @@ -45,12 +45,12 @@ test('should return error if no versions exist', function (t) {
ghRelease({
workpath: fixture('no-versions')
}, function (err, result) {
t.deepEqual(err.message, 'CHANGELOG.md does not contain any versions')
t.deepEqual(err.message, 'README.md does not contain any versions')
})
})

test('should allow empty unreleased sections', function (t) {
const errStr = 'Unreleased changes detected in CHANGELOG.md, aborting'
const errStr = 'Unreleased changes detected in README.md, aborting'
t.plan(1)
ghRelease({
workpath: fixture('unreleased-alt')
Expand All @@ -60,7 +60,7 @@ test('should allow empty unreleased sections', function (t) {
})

test('should allow empty unreleased sub-sections', function (t) {
const errStr = 'Unreleased changes detected in CHANGELOG.md, aborting'
const errStr = 'Unreleased changes detected in README.md, aborting'
t.plan(1)
ghRelease({
workpath: fixture('unreleased-empty-subsections')
Expand Down

0 comments on commit 8c08a51

Please sign in to comment.