3.0.5 • Published 3 months ago

changescribe v3.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago
changescribe logo
changescribe 𐫴 generated by AI

changescribe

A CHANGELOG.md utility generator. Provide a folder /unreleased with a Markdown file for each of your completed tasks: each file should be named with the task or ticket code related.

Run this utility in order to generate or update a CHANGELOG file merging each file in a new release or explore a range of versions included in the CHANGELOG. You must specify the semver version code for the next release to be generated.

Installation

This tool needs NodeJS and it is tested with node version 16 ~ 20.X.

npm install -g @ctinnovation/changescribe
changescribe --help

Configuration

You can configure this utility by using the inline CLI arguments illustrated below (EG: --targetVersion 1.1.0) or by creating a file .changescriberc in the root path you will run this tool into.

When using a .changescriberc file (default JSON or alternately CommonJS using extension .js or .cjs) you can specify the default values to use for each available command:

{
  "generate": {
    "fromPackageJson": true,
    "targetVersion": "1.1.1"
  },
  "init": {
    "output": "/test/CHANGELOG.md"
  },
  "explore": {
    "output": "console"
  }
}

Once you run changescribe the arguments defaults will be resolved in this order of priority:

  1. Command defaults (the defaults value illustrated by executing changescribe --help)
  2. .changescriberc(.c?js)? values, if the file exists
  3. Inline CLI arguments passed (EG: changescribe --targetVersion 1.1.0)

Commands and usage

Generate (default)

In your unreleased folder you have a PR-120.md file with this content:

## Added 
- I added this

## Changed

- I've changed this
- And also this

## Fixed

- I fixed this
- But also this!

Running this utility:

changescribe --taskUrlTemplate http://mydomain.atlassian.net/browse/{taskCode} --targetVersion 1.0.0

or

changescribe generate --taskUrlTemplate http://mydomain.atlassian.net/browse/{taskCode} --targetVersion 1.0.0

or (use package.json version as target version)

changescribe generate --taskUrlTemplate http://mydomain.atlassian.net/browse/{taskCode} -p

You'll have a CHANGELOG.md like this:


Changelog

All notable changes to this project will be documented in this file.

CHANGELOG FORMAT VERSIONING

1.0.0 - 2023-09-26

TASK

Added

  • I added this

Changed

  • I've changed this
  • And also this

Fixed

  • I fixed this
  • But also this!

Feel free to customize your template by modifying the templates inside templates folder.

ArgumentDescriptionValue
-t, --targetVersionSpecific target version. Mandatory if no --fromPackageJson specifiedstring
-p, --fromPackageJsonRetrieve target version from pkg.json (overrides --targetVersion)boolean
-o, --outputOuput CHANGELOG filestring
-i, --inputInput folder for compiling the changelogstring
-u, --taskUrlTemplateAssociated task URL template. Mandatory if --excludeTaskList is falsestring
--excludeTaskListExclude tasks list after release titleboolean
--createOutputIfNotFoundCreate a new output file if not foundboolean
--versionShow version numberboolean
--helpShow helpboolean

Task file format

For the generate command you must provide a Markdown file for each of yours task completed on the current branch. Each file:

  • Should be named with the code of the task
  • Should be splitted in sections with these titles:
    • If anything changed:
      • ## Change[d]
      • ## Edit[ed]
      • ## Update[d]
    • If anything was fixed/hotfixed:
      • ## [hot]Fix[ed]
    • If anything was added:
      • ## Add[ed]
      • ## Create[d]
    • If anything was removed:
      • ## Remove[d]
      • ## Cancel[led]
    • If anything was refactored
      • ## Refactor[ed]

The [notation] used here indicates optional group of characters inside the section title. Each possible variation will be standardised to the form: Changed, Added, Removed, Fixed

  • Each section should list each change prepended with -.
    • If anything in your list is a breaking change you can prepend your list with [breaking]

🔥 The CHANGELOG format inspires to keepachangelog

Example
## Changed
- change 1
- change 2
- [breaking] breaking change 3!

## Fix
- fix 1
- fix 2

Explore

With changescribe explore can explore a range of versions contained in a CHANGELOG.md file generated with changescribe:

changescribe explore --range 1.2.1

This command will exctract you a range of versions, in this case from 1.2.1 to the latest. You'll get a console log similar to the following:


packageName changelog from 1.2.1 to 1.3.1 (1.2.1~1.3.1)

All notable changes to this project from version 1.2.1 to 1.3.1.

CHANGELOG FORMAT https://keepachangelog.com/en/1.0.0/

VERSIONING https://semver.org/spec/v2.0.0.html

1.3.1

https://jira.com/browse/{taskCode}

Added

  • I added this

1.2.5

https://jira.com/browse/{taskCode}

Added

  • I changed this

Fixed

  • I fixed this

1.2.1

https://jira.com/browse/{taskCode}

Added

  • I changed this

Fixed

  • I fixed this

ArgumentDescriptionValue
--versionShow version numberboolean
-r, --rangeRange of versions in a format like X.Y.Z ~ A.B.Cstring
-o, --outputOutput path. If not console you can specify a path which the resulting Markdown will be saved intostring
-i, --inputInput CHANGELOG for explore diffsstring
--helpShow helpboolean

Init

Creates a new empty CHANGELOG.md file.

changescribe init
ArgumentDescriptionValue
--versionShow version numberboolean
-o, --outputOuput CHANGELOG filestring
--helpShow helpboolean