Socket
Socket
Sign inDemoInstall

github-release-from-changelog

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-release-from-changelog - npm Package Compare versions

Comparing version 1.3.2 to 2.0.0

.github/workflows/test.yml

60

CHANGELOG.md

@@ -1,54 +0,70 @@

# 1.3.2 - 2018-06-07
# `github-release-from-changelog` Changelog
* [Upgrade of grizzly to prevent security issue](https://github.com/MoOx/github-release-from-changelog/commit/9634bf8e1fa9ce9f693277bfed24bb83ead5a9e8) by @ntwb
## 2.0.0 - 2019-09-20
# 1.3.1 - 2018-01-22
🥳 Less contraints!
* [Fix "Keep A Changelog" version detection](https://github.com/MoOx/github-release-from-changelog/commit/b96ea68110ee580abd31fbcc028c92091c03682d)
Now we support multiples version format like
- `# X.Y.Z`
- `## X.Y.Z`
- `## vX.Y.Z`
- `## [vX.Y.Z`
- `## [X.Y.Z`
(This means no more code specific to https://keepachangelog.com & more flexibility)
## 1.3.2 - 2018-06-07
- [Upgrade of grizzly to prevent security issue](https://github.com/MoOx/github-release-from-changelog/commit/9634bf8e1fa9ce9f693277bfed24bb83ead5a9e8) by @ntwb
## 1.3.1 - 2018-01-22
- [Fix "Keep A Changelog" version detection](https://github.com/MoOx/github-release-from-changelog/commit/b96ea68110ee580abd31fbcc028c92091c03682d)
by @igetgames
# 1.3.0 - 2017-12-06
## 1.3.0 - 2017-12-06
* [Add support for auto-determing different CHANGELOG filenames](https://github.com/MoOx/github-release-from-changelog/commit/eb8f20855810201561144ca3762168d1da421d12),
- [Add support for auto-determing different CHANGELOG filenames](https://github.com/MoOx/github-release-from-changelog/commit/eb8f20855810201561144ca3762168d1da421d12),
by @koppor, reported by @MoOx (in [#6](https://github.com/MoOx/github-release-from-changelog/issues/6))
* [Add support for format of "Keep a Changelog"](https://github.com/MoOx/github-release-from-changelog/commit/cf50e4e8f0829c36eb837974e189d733fdb0effd),
- [Add support for format of "Keep a Changelog"](https://github.com/MoOx/github-release-from-changelog/commit/cf50e4e8f0829c36eb837974e189d733fdb0effd),
by @koppor
# 1.2.1 - 2016-06-28
## 1.2.1 - 2016-06-28
* Fixed: `Empty value for parameter 'tag_name': undefined`
- Fixed: `Empty value for parameter 'tag_name': undefined`
# 1.2.0 - 2016-06-28
## 1.2.0 - 2016-06-28
* Changed: use `grizzly` v2.x
- Changed: use `grizzly` v2.x
(ref [node-grizzly#1](https://github.com/coderaiser/node-grizzly/issues/1))
# 1.1.4 - 2016-06-07
## 1.1.4 - 2016-06-07
* Fixed: `TypeError: Cannot read property 'createRelease' of undefined`
- Fixed: `TypeError: Cannot read property 'createRelease' of undefined`
by fixing `grizzly` version.
([#12](https://github.com/MoOx/npmpub/issues/12))
# 1.1.3 - 2016-02-12
## 1.1.3 - 2016-02-12
* Fixed: `chmod +x ./github-release-from-changelog.js`
- Fixed: `chmod +x ./github-release-from-changelog.js`
# 1.1.2 - 2016-02-12
## 1.1.2 - 2016-02-12
* Fixed: tag starting with "v" are now compatible.
- Fixed: tag starting with "v" are now compatible.
([#9](https://github.com/MoOx/github-release-from-changelog/pull/9))
# 1.1.1 - 2016-01-06
## 1.1.1 - 2016-01-06
* Fixed: blank line are not stripped for block anymore (which can break
- Fixed: blank line are not stripped for block anymore (which can break
markdown rendering - eg: title using `##` )
([#7](https://github.com/MoOx/github-release-from-changelog/pull/7))
# 1.1.0 - 2015-11-10
## 1.1.0 - 2015-11-10
* Added: `--filename` option to specify your own filename
- Added: `--filename` option to specify your own filename
(if you don't use `CHANGELOG.md`).
# 1.0.0 - 2015-10-04
## 1.0.0 - 2015-10-04
✨ Initial release
#!/usr/bin/env node
var changelogFileNames = [
"CHANGELOG.md",
"Changelog.md",
"changelog.md",
"CHANGES.md",
"Changes.md",
"changes.md",
"HISTORY.md",
"History.md",
"history.md",
"NEWS.md",
"News.md",
"news.md",
"RELEASES.md",
"Releases.md",
"releases.md"
];
/**

@@ -19,7 +37,2 @@ * GitHub release from an package.json + CHANGELOG

var token = process.env.GITHUB_TOKEN;
if (!token) {
throw "GITHUB_TOKEN required";
}
// read command line arguments

@@ -35,19 +48,2 @@ var cp = require("child_process");

if (!changelogFileName) {
const changelogFileNames = [
"CHANGELOG.md",
"Changelog.md",
"changelog.md",
"CHANGES.md",
"Changes.md",
"changes.md",
"HISTORY.md",
"History.md",
"history.md",
"NEWS.md",
"News.md",
"news.md",
"RELEASES.md",
"Releases.md",
"releases.md"
];
for (var fileName of changelogFileNames) {

@@ -117,26 +113,21 @@ if (fs.existsSync(fileName)) {

var body = [];
var start;
const changelogLines = changelog.replace(/\r\n/g, "\n").split("\n");
// determine whether the log format of http://keepachangelog.com/en/1.0.0/: check the first line and check if there is a second level heading linking to the version diff
const isKeepAChangelogFormat =
changelogLines[0] === "# Changelog" &&
changelog.indexOf("\n## [" + version + "]") !== -1;
// console.log(isKeepAChangelogFormat);
var start = false;
var changelogLines = changelog.replace(/\r\n/g, "\n").split("\n");
// read from # version to the next # .*
// accept various ways to specify version starting like
// # 1.0
// ## v1.0
// ## [v1.0
var versionStartStringRe = "##? \\[?v?";
var versionStartRe = new RegExp(versionStartStringRe);
var versionRe = new RegExp(versionStartStringRe + version.replace(/\./, "."));
var footerLinkRe = new RegExp("$\\[");
changelogLines.some(function(line, i) {
// start with the # version
if (
!start &&
(line.indexOf("# " + version) === 0 ||
(isKeepAChangelogFormat && line.indexOf("## [" + version) === 0))
) {
if (!start && line.match(versionRe)) {
start = true;
} else if (
start &&
(line.indexOf("# ") === 0 ||
(isKeepAChangelogFormat && line.indexOf("## [") === 0) ||
(line.indexOf("[") === 0))
(line.match(versionStartRe) || line.match(footerLinkRe))
) {
// end with another # version or a footer link
return true;

@@ -159,9 +150,22 @@ } else if (start) {

// console.log("About to release ", releaseOptions)
if (argv.dryRun) {
console.log(tagName);
console.log();
console.log("---");
console.log(body);
console.log("---");
console.log();
console.log(user + "/" + repo + " " + tagName + " NOT released");
} else {
var token = process.env.GITHUB_TOKEN;
if (!token) {
throw "GITHUB_TOKEN required";
}
release(token, releaseOptions, function(err) {
if (err) {
throw err;
}
console.log(user + "/" + repo + " " + tagName + " released");
});
release(token, releaseOptions, function(err) {
if (err) {
throw err;
}
console.log(user + "/" + repo + " " + tagName + " released");
});
}
{
"name": "github-release-from-changelog",
"version": "1.3.2",
"version": "2.0.0",
"description": "Create GitHub releases from CHANGELOG.md",

@@ -29,13 +29,13 @@ "keywords": [

"devDependencies": {
"husky": "^0.14.3",
"npmpub": "^3.0.1",
"prettier": "^1.9.1",
"pretty-quick": "^1.6.0"
"husky": "^3.0.5",
"npmpub": "^4.1.0",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1"
},
"scripts": {
"precommit": "pretty-quick --staged",
"test": "echo \"I use myself\"",
"release": "npmpub --no-release",
"test": "./github-release-from-changelog.js --dryRun",
"release": "npmpub --no-release --skip-test",
"postrelease": "./github-release-from-changelog.js"
}
}
# github-release-from-changelog
[![NPM version](https://img.shields.io/npm/v/github-release-from-changelog.svg?style=flat)](https://www.npmjs.com/package/github-release-from-changelog)
[![Test Status](https://github.com/MoOx/github-release-from-changelog/workflows/Test/badge.svg)](https://github.com/MoOx/github-release-from-changelog/actions)
[![Version](https://img.shields.io/npm/v/github-release-from-changelog.svg?style=flat)](https://www.npmjs.com/package/github-release-from-changelog)
> Create GitHub releases from `CHANGELOG.md`
**Included in [npmpub(lish)] !.**
**This tool _edits the git tag_ on GitHub and _create a GitHub release_ with the correct changelog section.**
You need:
* a CHANGELOG following the format of [keep a changelog](http://keepachangelog.com/en/1.0.0/) or a CHANGELOG with the following format:
- a changelog file ([various filenames supported](https://github.com/MoOx/github-release-from-changelog/blob/master/github-release-from-changelog.js) automatically or specified via `--filename` option) with markdown titles that start with the version (eg: `# 1.2.0`, `## v1.2.0`, `# [1.2.0`...)
- a `package.json` with a `version` field.
- a git tag with the corresponding version in either `X.Y.Z` or `vX.Y.Z` formats.
- a `GITHUB_TOKEN` as an env var. See <https://github.com/MoOx/npmpub#requirements> for instructions.
```md
# X.Y.Z - ...
_Included in [npmpub](https://github.com/MoOx/npmpub) !._
...
```
* a `package.json` with a `version` field.
* a git tag with the corresponding version in either `X.Y.Z` or `vX.Y.Z` formats.
* a `GITHUB_TOKEN` as an env var. See <https://github.com/MoOx/npmpub#requirements> for instructions.
This tool edits the git tag on GitHub and create a GitHub release with the correct `CHANGELOG.md` section.
## Install

@@ -39,5 +33,5 @@

github-release-from-changelog is fully integrated in [npmpub(lish)].
github-release-from-changelog is fully integrated in [npmpub](https://github.com/MoOx/npmpub).
Please follow the instructions at <https://github.com/MoOx/npmpub#install> to install and use it.
npmpub(lish) automatically calls github-release-from-changelog by default.
npmpub automatically calls github-release-from-changelog by default.

@@ -49,4 +43,4 @@ github-release-from-changelog also plays well with other publishing tools such as [release-it](https://www.npmjs.com/package/release-it).

* ⇄ Pull requests and ★ Stars are always welcome.
* For bugs and feature requests, please create an issue.
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.

@@ -61,3 +55,1 @@ ## CHANGELOG

See [LICENSE](LICENSE).
[npmpub(lish)]: https://github.com/MoOx/npmpub
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc