Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keep-a-changelog

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keep-a-changelog - npm Package Compare versions

Comparing version 0.10.4 to 2.0.0-beta

esm/bin.js

201

CHANGELOG.md

@@ -0,1 +1,3 @@

<!-- deno-fmt-ignore-file -->
# Changelog

@@ -8,198 +10,5 @@

## [0.10.4] - 2021-03-04
### Fixed
- Allow to pass a version number to `--release` command [#18]
## [2.0.0] - 2021-12-08
New version merging Deno and Node code. There are no changes.
## [0.10.3] - 2021-01-09
### Fixed
- Support for multiline links [#16]
## [0.10.2] - 2020-10-11
### Added
- New command option --quiet added to cli [#14] [#15]
### Changed
- `changelong` command will exit with code 1 if it fails to parse the changelog file
## [0.10.1] - 2020-05-04
### Added
- New command --latest-release added to cli
- New command --release added to cli
### Fixed
- Removed trailing space in the default description generated with --init
- Updated dependencies
## [0.10.0] - 2020-02-08
### Added
- Documentation to extend `Release` class + test coverage [#12] [#13]
- Ability to use extended `Release` within `parser` [#12] [#13]
### Fixed
- Upgrade semver and mocha to the latest version
## [0.9.1] - 2019-11-26
### Fixed
- Undefined function bug in CLI
## [0.9.0] - 2019-11-26
### Removed
- Support for node < 10
## [0.8.2] - 2019-11-26
### Added
- Allow to customize the HEAD branch to compare the unreleased versions
### Fixed
- Compare with master branch in gitlab
- Nested lists were flatten
- Updated yargs-parser
## [0.8.1] - 2019-05-27
### Fixed
- Support for more than one unreleased version
- Updated semver to the latest version
## [0.8.0] - 2019-03-02
### Added
- New property `Changelog.tagNameBuilder` to customize how the tag names are generated - [#10]
- New `Release.setDate()` function - [#9]
### Fixed
- Update `yargs-parser` dependency to v13.0.0
## [0.7.0] - 2018-11-29
### Changed
- Removed some spaces before and after some titles to inline with the changelog format
## [0.6.7] - 2018-11-29
### Fixed
- Fixed the links sorting to compare issues numerically instead alphabetically
## [0.6.6] - 2018-11-29
### Changed
- Order the links alphabetically
## [0.6.5] - 2018-11-01
### Fixed
- Updated issue autodetection to prevent unwanted extractions - [#7]
## [0.6.4] - 2018-09-03
### Added
- Added `findRelease` function to `Changelog` for finding a release by version number - [#6]
- Added `setVersion` function to `Release` for changing the version of a release - [#6]
## [0.6.3] - 2018-08-22
### Fixed
- Fixed trailing newlines when no links are present - [#5]
- Fixed case of unreleased version to match http://keepachangelog.com/ - [#4]
- Fixed Release isEmpty and add tests - [#3]
## [0.6.2] - 2018-07-24
### Added
- Support for unreleased versions (releases with version but without date)
## [0.6.1] - 2018-06-30
### Fixed
- Prevent inserting duplicated links
## [0.6.0] - 2018-06-12
### Added
- CLI Api: New option `--init`, to generate an empty CHANGELOG.md file
## [0.5.2] - 2018-05-12
### Fixed
- Issues autodetection links
## [0.5.1] - 2018-05-12
### Fixed
- Issues autodetection problems with texts like `#3.4`
- Test execution was commented
## [0.5.0] - 2018-05-09
### Added
- Allow to insert a footer at the end of the changelog
### Changed
- Placed the urls of the issues at bottom
- Indent automatically the extra lines of the changes
### Fixed
- Parser refactoring
## [0.4.0] - 2018-03-22
### Added
- Create links automatically to the issues
### Fixed
- Use UTC date functions to fix decrement issue - [#1]
## [0.3.1] - 2017-12-11
### Added
- CLI Api: New option `--file`, to change the filename used
- CLI Api: New option `--url`, to set or change the project url
- CLI Api: New option `--https`, to change the use of https in the url scheme
## [0.3.0] - 2017-12-08
### Added
- Added colors in CLI
- Parser errors contains the line number in the CHANGELOG file
### Fixed
- Fixed parsing bug when the changelog is using incorrect title levels
## [0.2.0] - 2017-12-07
### Changed
- Parser improvements
- Changed the constructor arguments of Changelog, Change and Release classes
### Removed
- Removed static factories. Use `new` instead.
### Fixed
- The last version should't have diff link
## 0.1.0 - 2017-12-07
First version
[#1]: https://github.com/oscarotero/keep-a-changelog/issues/1
[#3]: https://github.com/oscarotero/keep-a-changelog/issues/3
[#4]: https://github.com/oscarotero/keep-a-changelog/issues/4
[#5]: https://github.com/oscarotero/keep-a-changelog/issues/5
[#6]: https://github.com/oscarotero/keep-a-changelog/issues/6
[#7]: https://github.com/oscarotero/keep-a-changelog/issues/7
[#9]: https://github.com/oscarotero/keep-a-changelog/issues/9
[#10]: https://github.com/oscarotero/keep-a-changelog/issues/10
[#12]: https://github.com/oscarotero/keep-a-changelog/issues/12
[#13]: https://github.com/oscarotero/keep-a-changelog/issues/13
[#14]: https://github.com/oscarotero/keep-a-changelog/issues/14
[#15]: https://github.com/oscarotero/keep-a-changelog/issues/15
[#16]: https://github.com/oscarotero/keep-a-changelog/issues/16
[#18]: https://github.com/oscarotero/keep-a-changelog/issues/18
[0.10.4]: https://github.com/oscarotero/keep-a-changelog/compare/v0.10.3...v0.10.4
[0.10.3]: https://github.com/oscarotero/keep-a-changelog/compare/v0.10.2...v0.10.3
[0.10.2]: https://github.com/oscarotero/keep-a-changelog/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.9.1...v0.10.0
[0.9.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.8.2...v0.9.0
[0.8.2]: https://github.com/oscarotero/keep-a-changelog/compare/v0.8.1...v0.8.2
[0.8.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.7...v0.7.0
[0.6.7]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.6...v0.6.7
[0.6.6]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.5...v0.6.6
[0.6.5]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.4...v0.6.5
[0.6.4]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.3...v0.6.4
[0.6.3]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.2...v0.6.3
[0.6.2]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.1...v0.6.2
[0.6.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.5.2...v0.6.0
[0.5.2]: https://github.com/oscarotero/keep-a-changelog/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.3.1...v0.4.0
[0.3.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.1.0...v0.2.0
[2.0.0]: https://github.com/oscarotero/keep-a-changelog/releases/tag/v2.0.0
{
"module": "./esm/mod.js",
"main": "./umd/mod.js",
"types": "./types/mod.d.ts",
"bin": {
"changelog": "./esm/bin.js"
},
"name": "keep-a-changelog",
"version": "2.0.0-beta",
"description": "Node package to parse and generate changelogs following the [keepachangelog](http://keepachangelog.com/en/1.0.0/) format.",
"homepage": "https://github.com/oscarotero/keep-a-changelog#readme",
"version": "0.10.4",
"main": "src/index.js",
"bin": {
"changelog": "bin.js"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/oscarotero/keep-a-changelog.git"
},
"license": "MIT",
"keywords": [

@@ -23,20 +19,26 @@ "changelog",

"author": "Oscar Otero <oom@oscarotero.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/oscarotero/keep-a-changelog.git"
},
"bugs": {
"url": "https://github.com/oscarotero/keep-a-changelog/issues"
},
"exports": {
".": {
"import": "./esm/mod.js",
"require": "./umd/mod.js",
"types": "./types/mod.d.ts"
}
},
"scripts": {
"test": "node test_runner.js"
},
"dependencies": {
"gitconfiglocal": "^2.1.0",
"semver": "^7.3.2",
"yargs-parser": "^18.1.3"
"deno.ns": "0.7.3"
},
"devDependencies": {
"mocha": "^7.1.2",
"prettier": "^2.0.5"
},
"scripts": {
"prettier": "prettier src/*.js test/**/*.js bin.js --single-quote --tab-width 4 --print-width 100 --write",
"test": "mocha test",
"changelog": "node example.js"
"@types/node": "16.11.1",
"chalk": "4.1.2"
}
}
}

@@ -1,23 +0,29 @@

# keep-a-changelog
# Changelog
[![Build Status](https://travis-ci.org/oscarotero/keep-a-changelog.svg?branch=master)](https://travis-ci.org/oscarotero/keep-a-changelog)
[Keep a Changelog](https://github.com/oscarotero/keep-a-changelog) library for
Node & Deno
Node package to parse and generate changelogs following the [keepachangelog](http://keepachangelog.com/en/1.0.0/) format.
Deno package to parse and generate changelogs following the
[keepachangelog](http://keepachangelog.com/en/1.0.0/) format.
## Install
## Usage in Node
You can install it from the [npm repository](https://www.npmjs.com/package/keep-a-changelog) using npm/yarn:
```js
import { parser } from "keep-a-changelog";
import fs from "fs";
```sh
npm install keep-a-changelog
//Parse a changelog file
const changelog = parser(fs.readFileSync("CHANGELOG.md", "UTF-8"));
//Generate the new changelog string
console.log(changelog.toString());
```
## Usage
## Usage in Deno
```js
const { parser } = require('keep-a-changelog');
const fs = require('fs');
import { parser } from "https://deno.land/x/changelog@2.0.0/mod.ts";
//Parse a changelog file
const changelog = parser(fs.readFileSync('CHANGELOG.md', 'UTF-8'));
const changelog = parser(await Deno.readTextFile("CHANGELOG.md"));

@@ -31,17 +37,17 @@ //Generate the new changelog string

```js
const { Changelog, Release } = require('keep-a-changelog');
import { Changelog, Release } from "https://deno.land/x/changelog@2.0.0/mod.ts";
const changelog = new Changelog('My project')
.addRelease(
new Release('0.1.0', '2017-12-06')
.added('New awesome feature')
.added('New other awesome feature')
.fixed('Bug #3')
.removed('Drop support for X')
)
.addRelease(
new Release('0.2.0', '2017-12-09')
.security('Fixed security vulnerability')
.deprecated('Feature X is deprecated')
);
const changelog = new Changelog("My project")
.addRelease(
new Release("0.1.0", "2017-12-06")
.added("New awesome feature")
.added("New other awesome feature")
.fixed("Bug #3")
.removed("Drop support for X"),
)
.addRelease(
new Release("0.2.0", "2017-12-09")
.security("Fixed security vulnerability")
.deprecated("Feature X is deprecated"),
);

@@ -53,42 +59,48 @@ console.log(changelog.toString());

By default, the tag names are `v` + version number. For example, the tag for the version `2.4.9` is `v2.4.9`. To change this behavior, set a new `tagNameBuilder`:
By default, the tag names are `v` + version number. For example, the tag for the
version `2.4.9` is `v2.4.9`. To change this behavior, set a new
`tagNameBuilder`:
```js
const changelog = new Changelog();
changelog.tagNameBuilder = release => `version-${release.version}`;
changelog.tagNameBuilder = (release) => `version-${release.version}`;
```
### Custom Change Types
By default and according to the [keepachangelog](http://keepachangelog.com/en/1.0.0/) format, the change types are
`Added`,
`Changed`,
`Deprecated`,
`Removed`,
`Fixed`,
and `Security`.
In case you'd like add another type in order to use is in your changelog, you basically need to extend the `Release` class to support new types. Additionally, you have to tell the `parser` that it should create instances of your new extended `Release` in order to parse your changelog correctly.
By default and according to the
[keepachangelog](http://keepachangelog.com/en/1.0.0/) format, the change types
are `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, and `Security`.
For example, we would like to add a type `Maintenance`.
Extend the provided `Release` class:
In case you'd like add another type in order to use is in your changelog, you
basically need to extend the `Release` class to support new types. Additionally,
you have to tell the `parser` that it should create instances of your new
extended `Release` in order to parse your changelog correctly.
For example, we would like to add a type `Maintenance`. Extend the provided
`Release` class:
```js
class CustomRelease extends Release {
constructor(version, date, description) {
super(version, date, description);
// add whatever types you want - in lowercase
const newChangeTypes = [
['maintenance', []]
];
constructor(version, date, description) {
super(version, date, description);
// add whatever types you want - in lowercase
const newChangeTypes = [
["maintenance", []],
];
this.changes = new Map([...this.changes, ...newChangeTypes]);
}
// for convenience, add a new method to add change of type 'maintanance'
maintenance(change) {
return this.addChange('maintenance', change);
}
this.changes = new Map([...this.changes, ...newChangeTypes]);
}
// for convenience, add a new method to add change of type 'maintanance'
maintenance(change) {
return this.addChange("maintenance", change);
}
}
```
And once you want to use the parser:
```js
const releaseCreator = (ver, date, desc) => new CustomRelease(ver, date, desc)
const changelog = parser(changelogTextContent, {releaseCreator})
const releaseCreator = (ver, date, desc) => new CustomRelease(ver, date, desc);
const changelog = parser(changelogTextContent, { releaseCreator });
```

@@ -98,5 +110,22 @@

This library provides the `changelog` command to normalize the changelog format. It reads the CHANGELOG.md file and override it with the new format:
This library provides the `changelog` command to normalize the changelog format.
It reads the CHANGELOG.md file and override it with the new format:
### Install the library as script
Deno:
```sh
deno install --allow-read --allow-write --name changelog https://deno.land/x/changelog/bin.ts
```
Node:
```sh
npm install keep-a-changelog -g
```
Run the script:
```sh
changelog

@@ -132,9 +161,10 @@ ```

Option | Description
-------|-------------
`--file` | The markdown file of the changelog. The default value is `CHANGELOG.md`.
`--url` | The base url used to build the diff urls of the different releases. It is taken from the existing diff urls in the markdown. If no urls are found, try to catch it using the url of the git remote repository.
`--https` | Set to false to use `http` instead `https` in the url (`--https=false`).
`--init` | Init a new empty changelog file.
`--latest-release` | Print the latest release version.
`--release` | Updated the latest unreleased version with the current date.
| Option | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--file` | The markdown file of the changelog. The default value is `CHANGELOG.md`. |
| `--url` | The base url used to build the diff urls of the different releases. It is taken from the existing diff urls in the markdown. If no urls are found, try to catch it using the url of the git remote repository. |
| `--https` | Set to false to use `http` instead `https` in the url (`--https=false`). |
| `--init` | Init a new empty changelog file. |
| `--latest-release` | Print the latest release version. |
| `--release` | Updated the latest unreleased version with the current date. |
| `--quiet` | Do not output error messages |

Sorry, the diff of this file is not supported yet

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