stringify-changelog

Generate a markdown-formatted changelog from an object, array, yaml or json file.

stringify-changelog

Generate a markdown-formatted changelog from an object, array, yaml or json file.

Converts valid YAML, like this:

v0.1.0:
  date: "2016-12-26"
  changed:
    - Got stuck in another chimney.

Into this:

### [v0.1.0] - 2016-12-26

**changes**

- Got stuck in another chimney.

Install

Install with npm:

$ npm install --save stringify-changelog

Usage

var changelog = require('stringify-changelog');
changelog(value, options);

Params

  • value{String|Object|Array}: File path of YAML file to read, object or array of changes (see below)
  • options{Object}: the following options may be passed to modify output
    • format{Function}Custom function for formatting each entry in the changelog
    • key{Function}Prepend the following key/reference to your generated changelog, to guide users in making semantically labeled entries.

Example key

## key

Changelog entries are classified using the following labels from [keep-a-changelog][]:

- `added`: for new features
- `changed`: for changes in existing functionality
- `deprecated`: for once-stable features removed in upcoming releases
- `removed`: for deprecated features removed in this release
- `fixed`: for any bug fixes

[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog

Data format

Conventions from [keep-a-changelog][] are supported by default. When data is passed as an object or array (from a file or directly), changelog entries can be categorized using the following labels as property names:

  • addedfor new features.
  • changedfor changes in existing functionality.
  • deprecatedfor once-stable features removed in upcoming releases.
  • removedfor deprecated features removed in this release.
  • fixedfor any bug fixes.
  • securityto invite users to upgrade in case of vulnerabilities.

Examples

Data can either be formatted as an array or an object.

Object

JSON

{ 'v0.1.0':
   { date: '2016-12-26',
     changed: [ 'Got stuck in another chimney.' ] } }

YAML

v0.1.0:
  date: "2016-12-26"
  changed:
    - Got stuck in another chimney.

Array

JSON

[ { date: '2016-12-26',
    version: 'v0.1.0',
    changed: [ 'Got stuck in another chimney.' ] } ]

YAML

- version: v0.1.0
  date: '2016-12-26'
  changed:
    - Got stuck in another chimney.

Arbitrary entries

If you don't want to follow keep-a-changelog format, or you have an arbitrary entry that doesn't fit in one of the above categories, you can use the descriptionproperty.

Array

[ { date: '2016-12-26',
    version: 'v0.1.0',
    description: [ 'Got stuck in another chimney.' ] } ]

Object

{ 'v0.1.0':
   { date: '2016-12-26',
     description: [ 'Got stuck in another chimney.' ] } }

About

Related projects

helper-changelog: Template helper for generating a markdown-formatted changelog from an object, array or yaml file. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on July 21, 2016.

HomePage

https://github.com/jonschlinkert/stringify-changelog

Repository

jonschlinkert/stringify-changelog


上一篇:js-yaml-lite
下一篇:helper-changelog

相关推荐

  • (独家!)webpack 5 changelog 全文翻译

    ★ webpack 团队于北京时间 10 月 12 日凌晨发布了 版本,本文译自 。此部分主要面向非插件开发的 webpack 使用者。 ” 简要说明 此版本重点关注以下内容: ...

    8 个月前
  • 隐藏某些价值观输出stringify() JSON。

    Evan CarrollNilesh(https://stackoverflow.com/users/124486/evancarroll)提出了一个问题:Hide certain values in...

    2 年前
  • 这是不可能的stringify错误使用json.stringify?

    CommunityJay Querie(https://stackoverflow.com/users/1/community)提出了一个问题:Is it not possible to string...

    2 年前
  • 解密JSON.stringify()的参数使用

    基本使用 一般情况下,我们使用序列化对象,即将一个对象的属性和值转化为字符串 第二个参数 实际上并不是所有的JSON数据都能被序列化 可以通过传递第二个参数来解决,首先来看下第二个...

    7 个月前
  • 规范 commit 与 changelog 生成

    一个良好的提交习惯,绝对会为以后的代码维护带来不小的收益。 举个例子,某天你自己写的一个功能出问题了,找到代码被修改的地方,发现是一个同事修改了一行代码,这个时候你一脸懵逼,因为他既没有写注释,co...

    2 年前
  • 浅谈JSON.parse()和JSON.stringify()

    1.parse 用于从一个字符串中解析出json 对象。例如 var str='{"name":"cpf","age":"23"}' 经 JSON.parse(str) 得到: ...

    3 年前
  • 是JSON。stringify()通过IE 8支持?

    是JSON。stringify()通过IE 8支持?...

    2 年前
  • 探索如何使用 JSON.stringify() 去序列化一个 Error

    image(https://img.javascriptcn.com/b7763db8f55206bf6375cca2cfe8c053 "image") 最近在做 Node 服务端需求的时候,遇到了...

    9 个月前
  • 强大的JSON.STRINGIFY可选参数

    我脑子里酝酿里一个非常有意思的问题。我把他分享出来以便你遇到难题时可以参考。让我们看看有趣的地方。 没有任何亮点,坑爹的是我项目中(AWS DynamoDB for curious beasts...

    7 个月前
  • 对于json.stringify [复制] jQuery等效

    CommunityHighmastdon(https://stackoverflow.com/users/1/community)提出了一个问题:jquery equivalent for JSON....

    2 年前

官方社区

扫码加入 JavaScript 社区