Skip to content

Commit 5e109f3

Browse files
author
Charlike Mike Reagent
committed
feat: implement and push to github
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
1 parent b678647 commit 5e109f3

File tree

6 files changed

+500
-15
lines changed

6 files changed

+500
-15
lines changed

.verb.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ $ yarn add {%= name %}
5454
## API
5555

5656
<!-- docks-start -->
57+
_Generated using [docks](http://npm.im/docks)._
58+
59+
60+
5761
<!-- docks-end -->
5862

5963
**[back to top](#thetop)**

README.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# git-commits-since [![npm version][npmv-img]][npmv-url] [![github release][ghrelease-img]][ghrelease-url] [![License][license-img]][license-url]
2+
3+
> Get all commits since given period of time or by default from latest git semver tag. Also detects and calculates next needed / recommended bump for your package. Based on [recommended-bump][], [parse-commit-message][], [detect-next-version][], [git-semver-tags][] and [git-raw-commits][]. Follows Conventional Commits specification.
4+
5+
Please consider following this project's author, [Charlike Mike Reagent](https://github.com/tunnckoCore), and :star: the project to show your :heart: and support.
6+
7+
<div id="thetop"></div>
8+
9+
[![Code style][codestyle-img]][codestyle-url]
10+
[![CircleCI linux build][linuxbuild-img]][linuxbuild-url]
11+
[![CodeCov coverage status][codecoverage-img]][codecoverage-url]
12+
[![DavidDM dependency status][dependencies-img]][dependencies-url]
13+
[![Renovate App Status][renovateapp-img]][renovateapp-url]
14+
[![Make A Pull Request][prs-welcome-img]][prs-welcome-url]
15+
[![Semantically Released][new-release-img]][new-release-url]
16+
17+
If you have any _how-to_ kind of questions, please read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents.
18+
For bugs reports and feature requests, [please create an issue][open-issue-url] or ping
19+
[@tunnckoCore](https://twitter.com/tunnckoCore) at Twitter.
20+
21+
[![Become a Patron][patreon-img]][patreon-url]
22+
[![Conventional Commits][ccommits-img]][ccommits-url]
23+
[![NPM Downloads Weekly][downloads-weekly-img]][npmv-url]
24+
[![NPM Downloads Monthly][downloads-monthly-img]][npmv-url]
25+
[![NPM Downloads Total][downloads-total-img]][npmv-url]
26+
[![Share Love Tweet][shareb]][shareu]
27+
28+
Project is [semantically](https://semver.org) & automatically released on [CircleCI](https://circleci.com) with [new-release][] and its [New Release](https://github.com/apps/new-release) GitHub App.
29+
30+
<!-- Logo when needed:
31+
32+
<p align="center">
33+
<a href="https://github.com/tunnckoCoreLabs/git-commits-since">
34+
<img src="./media/logo.png" width="85%">
35+
</a>
36+
</p>
37+
38+
-->
39+
40+
## Table of Contents
41+
42+
- [Install](#install)
43+
- [API](#api)
44+
- [See Also](#see-also)
45+
- [Contributing](#contributing)
46+
* [Follow the Guidelines](#follow-the-guidelines)
47+
* [Support the project](#support-the-project)
48+
* [OPEN Open Source](#open-open-source)
49+
* [Wonderful Contributors](#wonderful-contributors)
50+
- [License](#license)
51+
52+
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
53+
54+
## Install
55+
56+
This project requires [**Node.js**](https://nodejs.org) **^8.11.0 || >=10.13.0**. Install it using
57+
[**yarn**](https://yarnpkg.com) or [**npm**](https://npmjs.com).
58+
_We highly recommend to use Yarn when you think to contribute to this project._
59+
60+
```bash
61+
$ yarn add git-commits-since
62+
```
63+
64+
## API
65+
66+
<!-- docks-start -->
67+
_Generated using [docks](http://npm.im/docks)._
68+
69+
<!-- docks-end -->
70+
71+
**[back to top](#thetop)**
72+
73+
## See Also
74+
75+
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your
76+
existance!
77+
- [@tunnckocore/config](https://www.npmjs.com/package/@tunnckocore/config): All the configs for all the tools, in one place | [homepage](https://github.com/tunnckoCoreLabs/config "All the configs for all the tools, in one place")
78+
- [@tunnckocore/create-project](https://www.npmjs.com/package/@tunnckocore/create-project): Create and scaffold a new project, its GitHub repository and… [more](https://github.com/tunnckoCoreLabs/create-project) | [homepage](https://github.com/tunnckoCoreLabs/create-project "Create and scaffold a new project, its GitHub repository and contents")
79+
- [@tunnckocore/execa](https://www.npmjs.com/package/@tunnckocore/execa): Thin layer on top of [execa][] that allows executing multiple… [more](https://github.com/tunnckoCoreLabs/execa) | [homepage](https://github.com/tunnckoCoreLabs/execa "Thin layer on top of [execa][] that allows executing multiple commands in parallel or in sequence")
80+
- [@tunnckocore/scripts](https://www.npmjs.com/package/@tunnckocore/scripts): Universal and minimalist scripts & tasks runner. | [homepage](https://github.com/tunnckoCoreLabs/scripts "Universal and minimalist scripts & tasks runner.")
81+
- [@tunnckocore/update](https://www.npmjs.com/package/@tunnckocore/update): Update a repository with latest templates from `charlike`. | [homepage](https://github.com/tunnckoCoreLabs/update "Update a repository with latest templates from `charlike`.")
82+
- [asia](https://www.npmjs.com/package/asia): Blazingly fast, magical and minimalist testing framework, for Today and… [more](https://github.com/olstenlarck/asia#readme) | [homepage](https://github.com/olstenlarck/asia#readme "Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow")
83+
- [charlike](https://www.npmjs.com/package/charlike): Small & fast project scaffolder with sane defaults. Supports hundreds… [more](https://github.com/tunnckoCoreLabs/charlike) | [homepage](https://github.com/tunnckoCoreLabs/charlike "Small & fast project scaffolder with sane defaults. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options")
84+
- [docks](https://www.npmjs.com/package/docks): Extensible system for parsing and generating documentation. It just freaking… [more](https://github.com/tunnckoCore/docks) | [homepage](https://github.com/tunnckoCore/docks "Extensible system for parsing and generating documentation. It just freaking works!")
85+
- [gitcommit](https://www.npmjs.com/package/gitcommit): Lightweight and joyful `git commit` replacement. Conventional Commits compliant. | [homepage](https://github.com/tunnckoCore/gitcommit "Lightweight and joyful `git commit` replacement. Conventional Commits compliant.")
86+
87+
**[back to top](#thetop)**
88+
89+
## Contributing
90+
91+
### Follow the Guidelines
92+
93+
Please read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents for advices.
94+
For bugs reports and feature requests, [please create an issue][open-issue-url] or ping
95+
[@tunnckoCore](https://twitter.com/tunnckoCore) at Twitter.
96+
97+
### Support the project
98+
99+
[Become a Partner or Sponsor?][patreon-url] :dollar: Check the **Partner**, **Sponsor** or **Omega-level** tiers! :tada: You can get your company logo, link & name on this file. It's also rendered on package page in [npmjs.com][npmv-url] and [yarnpkg.com](https://yarnpkg.com/en/package/git-commits-since) sites too! :rocket:
100+
101+
Not financial support? Okey! [Pull requests](https://github.com/tunnckoCoreLabs/contributing#opening-a-pull-request), stars and all kind of [contributions](https://opensource.guide/how-to-contribute/#what-it-means-to-contribute) are always
102+
welcome. :sparkles:
103+
104+
### OPEN Open Source
105+
106+
This project is following [OPEN Open Source](http://openopensource.org) model
107+
108+
> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is built on collective efforts and it's not strongly guarded by its founders.
109+
110+
There are a few basic ground-rules for its contributors
111+
112+
1. Any **significant modifications** must be subject to a pull request to get feedback from other contributors.
113+
2. [Pull requests](https://github.com/tunnckoCoreLabs/contributing#opening-a-pull-request) to get feedback are _encouraged_ for any other trivial contributions, but are not required.
114+
3. Contributors should attempt to adhere to the prevailing code-style and development workflow.
115+
116+
### Wonderful Contributors
117+
118+
Thanks to the hard work of these wonderful people this project is alive! It follows the
119+
[all-contributors](https://github.com/kentcdodds/all-contributors) specification.
120+
Don't hesitate to add yourself to that list if you have made any contribution! ;) [See how,
121+
here](https://github.com/jfmengels/all-contributors-cli#usage).
122+
123+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
124+
<!-- prettier-ignore -->
125+
| [<img src="https://avatars3.githubusercontent.com/u/5038030?v=4" width="120px;"/><br /><sub><b>Charlike Mike Reagent</b></sub>](https://tunnckocore.com)<br />[💻](https://github.com/tunnckoCoreLabs/git-commits-since/commits?author=tunnckoCore "Code") [📖](https://github.com/tunnckoCoreLabs/git-commits-since/commits?author=tunnckoCore "Documentation") [💬](#question-tunnckoCore "Answering Questions") [👀](#review-tunnckoCore "Reviewed Pull Requests") [🔍](#fundingFinding-tunnckoCore "Funding Finding") |
126+
| :---: |
127+
128+
<!-- ALL-CONTRIBUTORS-LIST:END -->
129+
130+
Consider showing your [support](#support-the-project) to them. :sparkling_heart:
131+
132+
## License
133+
134+
Copyright (c) 2018-present, [Charlike Mike Reagent](https://tunnckocore.com) `<mameto2011@gmail.com>` & [contributors](#wonderful-contributors).
135+
Released under the [Apache-2.0 License][license-url].
136+
137+
<!-- Heading badges -->
138+
139+
[npmv-url]: https://www.npmjs.com/package/git-commits-since
140+
[npmv-img]: https://badgen.net/npm/v/git-commits-since?icon=npm
141+
142+
[ghrelease-url]: https://github.com/tunnckoCoreLabs/git-commits-since/releases/latest
143+
[ghrelease-img]: https://badgen.net/github/release/tunnckoCoreLabs/git-commits-since?icon=github
144+
145+
[license-url]: https://github.com/tunnckoCoreLabs/git-commits-since/blob/master/LICENSE
146+
[license-img]: https://badgen.net/npm/license/git-commits-since
147+
148+
<!-- Front line badges -->
149+
150+
[codestyle-url]: https://github.com/airbnb/javascript
151+
[codestyle-img]: https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb
152+
153+
[linuxbuild-url]: https://circleci.com/gh/tunnckoCoreLabs/git-commits-since/tree/master
154+
[linuxbuild-img]: https://badgen.net/circleci/github/tunnckoCoreLabs/git-commits-since/master?label=build&icon=circleci
155+
156+
[codecoverage-url]: https://codecov.io/gh/tunnckoCoreLabs/git-commits-since
157+
[codecoverage-img]: https://badgen.net/codecov/c/github/tunnckoCoreLabs/git-commits-since?icon=codecov
158+
159+
[dependencies-url]: https://david-dm.org/tunnckoCoreLabs/git-commits-since
160+
[dependencies-img]: https://badgen.net/david/dep/tunnckoCoreLabs/git-commits-since?label=deps
161+
162+
[ccommits-url]: https://conventionalcommits.org/
163+
[ccommits-img]: https://badgen.net/badge/conventional%20commits/v1.0.0/dfb317
164+
[new-release-url]: https://ghub.io/new-release
165+
[new-release-img]: https://badgen.net/badge/semantically/released/05c5ff
166+
167+
[downloads-weekly-img]: https://badgen.net/npm/dw/git-commits-since
168+
[downloads-monthly-img]: https://badgen.net/npm/dm/git-commits-since
169+
[downloads-total-img]: https://badgen.net/npm/dt/git-commits-since
170+
171+
[renovateapp-url]: https://renovatebot.com
172+
[renovateapp-img]: https://badgen.net/badge/renovate/enabled/green
173+
[prs-welcome-img]: https://badgen.net/badge/PRs/welcome/green
174+
[prs-welcome-url]: http://makeapullrequest.com
175+
[paypal-donate-url]: https://paypal.me/tunnckoCore/10
176+
[paypal-donate-img]: https://badgen.net/badge/$/support/purple
177+
[patreon-url]: https://www.patreon.com/bePatron?u=5579781
178+
[patreon-img]: https://badgen.net/badge/patreon/tunnckoCore/F96854?icon=patreon
179+
[patreon-sponsor-img]: https://badgen.net/badge/become/a%20sponsor/F96854?icon=patreon
180+
181+
[shareu]: https://twitter.com/intent/tweet?text=https://github.com/tunnckoCoreLabs/git-commits-since&via=tunnckoCore
182+
[shareb]: https://badgen.net/badge/twitter/share/1da1f2?icon=twitter
183+
[open-issue-url]: https://github.com/tunnckoCoreLabs/git-commits-since/issues/new
184+
185+
[detect-next-version]: https://github.com/tunnckoCoreLabs/detect-next-version
186+
[execa]: https://github.com/sindresorhus/execa
187+
[git-raw-commits]: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/git-raw-commits
188+
[git-semver-tags]: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/git-semver-tags
189+
[new-release]: https://github.com/tunnckoCore/new-release
190+
[parse-commit-message]: https://github.com/olstenlarck/parse-commit-message
191+
[recommended-bump]: https://github.com/tunnckoCoreLabs/recommended-bump
192+
[semantic-release]: https://github.com/semantic-release/semantic-release

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
"node": "^8.11.0 || >=10.13.0"
1616
},
1717
"dependencies": {
18-
"esm": "^3.0.84"
18+
"detect-next-version": "^3.0.1",
19+
"esm": "^3.0.84",
20+
"git-raw-commits": "^2.0.0",
21+
"git-semver-tags": "^2.0.2",
22+
"parse-commit-message": "^2.1.4"
1923
},
2024
"devDependencies": {
2125
"@tunnckocore/config": "^0.5.1",
@@ -70,7 +74,13 @@
7074
},
7175
"reflinks": [
7276
"new-release",
73-
"semantic-release"
77+
"semantic-release",
78+
"detect-next-version",
79+
"execa",
80+
"git-raw-commits",
81+
"git-semver-tags",
82+
"parse-commit-message",
83+
"recommended-bump"
7484
]
7585
}
7686
}

src/index.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
export default () => {};
1+
import util from 'util';
2+
import gitSemverTags from 'git-semver-tags';
3+
import gitRawCommits from 'git-raw-commits';
4+
import { parse, plugins } from 'parse-commit-message';
5+
import detectNextVersion from 'detect-next-version';
6+
7+
const getAllTags = async () => util.promisify(gitSemverTags)();
8+
9+
export default async function gitCommitsSince(options) {
10+
const opts = Object.assign({}, options);
11+
const tags = await getAllTags();
12+
const rawCommits = [];
13+
const commits = [];
14+
const from = opts.from || tags[0] || '';
15+
const to = opts.to || '@';
16+
17+
const promise = new Promise((resolve, reject) => {
18+
gitRawCommits(Object.assign({ from, to }, opts))
19+
.on('data', (res) => {
20+
const rawCommit = res.toString();
21+
const commit = parse(
22+
rawCommit,
23+
plugins.concat(opts.plugins).filter(Boolean),
24+
);
25+
26+
rawCommits.push(rawCommit);
27+
commits.push(commit);
28+
})
29+
.on('error', reject)
30+
.on('end', () => {
31+
resolve({ from, to, rawCommits, commits, options: opts });
32+
});
33+
});
34+
35+
return promise.then(async (result) => {
36+
if (typeof opts.name === 'string') {
37+
const res = await detectNextVersion(opts.name, commits);
38+
return Object.assign({}, result, res);
39+
}
40+
return result;
41+
});
42+
}

test/snapshots/index.snapshot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"todo":{"skip":false,"todo":false,"run":false,"isPending":false,"isRejected":false,"isFulfilled":true,"id":1,"str":"(t) => {\n t.strictEqual(typeof mod, 'function');\n}","title":"todo"}}

0 commit comments

Comments
 (0)