2.1.0 • Published 3 years ago

@muukii/chglog_fetcher v2.1.0

Weekly downloads
116
License
MIT
Repository
github
Last release
3 years ago

A changelog generator that regarding pulls and specified commits in THE SPECIFIC RANGE.

First look you can create

Motivation

We can find a lot of tools that generate summarized changelogs from git and GitHub.
However I could not find something more simple tool which generates from any range.

So this library separated several modules as followings:

  • Fetching module - It fetches the all of pull-reqests in the range as possible.
  • Generator module - It generates text from the gathered pull-requests from fetching module with visitor pattern.
  • CLI module - It calls fetching module and passing data to generator module and then output in console.

Installation

npm install -g @muukii/chglog

Usage

Number of PRs : 31

tagnumber of PRs
Breaking Changes11
Performance3
Rename3
New Feature4
Docs1
Remove Symobl1

Group: Fix issues (3)

  • Make EventEmitter delivering event by commit order. #222 by @muukii
    • Breaking Changes
  • Add runtime sanitizer - Debug only #220 by @muukii
  • Fix InoutRef's wrapped property #189 by @muukii

Group: Enhancement (26)

  • Reduce reflecting to get performance #226 by @muukii
    • Breaking Changes Performance
  • Improve EntityType performance #224 by @muukii
    • Performance
  • Update default queue in sinkPrimitiveValue #214 by @muukii
    • Breaking Changes
  • Reduce the number of Emitters #216 by @muukii
  • Add runtime sanitizer - Debug only #220 by @muukii
  • Add documentation #219 by @muukii
  • Rename MemoizeMap to Pipeline #211 by @muukii
    • Rename
  • Add Sink method to DispatcherType #208 by @muukii
    • New Feature
  • Experimental Add creation method of SwiftUI.Binding #210 by @muukii
  • Support RxSwift 6 #209 by @muukii
    • Breaking Changes New Feature Performance
  • Update methods of Changes that become to use Comparer instead of closure #207 by @muukii
    • Breaking Changes
  • Add isEmpty to EntityTable #206 by @muukii
    • New Feature
  • Update Rx extension #202 by @muukii
  • Add method that maps Edge #201 by @muukii
    • Rename
  • Remove Verge/Core #200 by @muukii
    • Breaking Changes
  • Update CachedMapStorage #199 by @muukii
    • New Feature
  • Update how Derived retain itself to publish the value #198 by @muukii
  • Update cancelling in EventEmitter #197 by @muukii
    • Breaking Changes
  • Fix race-condition in VergeAnyCancellable #196 by @muukii
  • Drop receive changes itself in Store, Dispatcher #195 by @muukii
    • Breaking Changes
  • Trivial Update docs and few renames. #194 by @muukii
    • Docs Rename
  • ORM context.entities #192 by @muukii
  • Add precondition #191 by @muukii
  • Changes get a modification that indicates how the state changed #190 by @muukii
  • Support assign-assignee from Store #187 by @muukii
    • Breaking Changes Remove Symobl
  • Deprecation combined derived method #184 by @muukii
    • Breaking Changes

Other (3)

  • Bump ini from 1.3.5 to 1.3.8 in /Docs #205 by @dependabot
  • Changes default parameter which is queue in sink -> .mainIsolated() #193 by @muukii
    • Breaking Changes
  • Support rx.commitBinder #188 by @muukii

Usage

$ cd /path/to/your-repo

⚠️ Currently this cli must run in the directory where has .git.
Because, Over GitHub API can't get well the all of commits between the specified ref range.
So take care cloning git repo, chglog can get only commits which .git has.

$ chglog changelog --github_token <YOUR_TOKEN> -l 8.5.0 -r 8.6.0

--github_token reads also enviroment variable GITHUB_ACCESS_TOKEN. Or if you use gh and authenticated, that auth infomation would be used.

Setting your repository up for creating a effective changelog

chglog provides a built-in generator as a module.
It would be used when we set no custom generator.

That default generator has following features:

  • Grouping pull-request
  • Displaying the tags each pull-requests
  • Displaying summary of the tags of pull-request

Setting up steps:

Define a label that has Grooup: prefix.

Define a label that has Tag: prefix

You can add groups and tags as you need.
Regarding those, the built-in generator parses and prints.

Customization - Inject JS

In addition using built-in generator, we can inject javascript code that generates a changelog with our own rules.

Create javascript file and use following template code.

module.exports = () => {

    const state = {
        titles: []
    }

    return {

        visit(pullRequest) {
            state.titles.push(pullRequest.title)
        },

        visitLabel(label, pullRequest) {

        },

        visitAuthor(author, pullRequest) {

        },

        render() {
            
            return JSON.stringify(state, null, 2)
        }
    }
}

Pssing this from argument

$ chglog changelog -g /path/to/your_generator.js

Customization - From JS

Define a visitor

export interface Visitor {
  visitLabel(label: Label, source: PullRequest): void;
  visitAuthor(author: User, source: PullRequest): void;
}
const createSampleVistor = () => {
  return {
    visitLabel(label: Label, source: PullRequest) {
      ...
    },
    visitAuthor(author: User, source: PullRequest) {
      ...
    },
};

Fetch and parse

const visitor = createSampleVistor();

await fetchData(
  {
    rightRef: "",
    leftRef: "",
    githubToken: "",
    repoOwner: "",
    repoName: "",
    workingDirectory: "",
  },
  visitor
);

Development

Module resolutions:

  • core
  • extensions
  • cli

Install dependencies

$ lerna bootstrap

Build all packages

$ lerna exec yarn run build

Run CLI

$ cd ./packages/cli
$ yarn run dev