Skip to content

Commit

Permalink
Feat/add typings #56 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleeit authored and piuccio committed Jul 17, 2019
1 parent d4ecf23 commit 304aafa
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,24 @@ However, there is a little difference between module usage and CLI of the `scrip

```js
releaseNotes({
branch: 'master',
script: (data, callback) => {
callback({
foo: 'bar'
})
}
branch: 'master',
script: (data, callback) => {
callback({
foo: 'bar'
})
}
}, RANGE, TEMPLATE)
```

### Typescript

`git-release-notes` includes [Typescript](http://www.typescriptlang.org/) definitions.

```ts
import * as releaseNotes from "git-release-notes";
releaseNotes({ path }, range, TEMPLATE);
```


### Debug
If your post processing script or template throws an exception, the JSON data will be written to the file system in the same folder as the processing script.
Expand Down
47 changes: 47 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export = gitReleaseNotes;

interface ICommit {
sha1: string;
authorName: string;
authorEmail: string;
authorDate: string;
committerName: string;
committerEmail: string;
committerDate: string;
title: string;
tag: string;
messageLines: string[];
}
type postprocessingFn = (data: {
commits: ICommit[];
range: string;
dateFnsFormat: (data: string | number | Date, format?: string, options?: {
locale?: any;
}) => string;
debug: any;
}, callback: (data: any) => void) => void;

declare function gitReleaseNotes(options: {
p?: string;
path?: string;
b?: string;
branch?: string;
i?: string;
"ignore-case"?: string;
s?: postprocessingFn | string;
script?: postprocessingFn | string;
t?: string;
title?: string;
f?: string;
file?: string;
c?: boolean;
"merge-commits"?: boolean;
o?: string[] | string;
"gitlog-option"?: string[] | string;
m?: string[] | string;
meaning?: string[] | string;
}, range: string, template: string): Promise<string>

declare namespace gitReleaseNotes {

}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"author": "ariatemplates <[email protected]> (http://github.com/ariatemplates)",
"name": "git-release-notes",
"description": "Generate beautiful release notes from a git log.",
"typings": "./index.d.ts",
"keywords": [
"git",
"log",
Expand Down

0 comments on commit 304aafa

Please sign in to comment.