git-commits-since
v2.0.5
Published
Get all commits since given period of time or by default from latest git semver tag. Understands and follows both SemVer and the Conventional Commits specification.
Downloads
357
Readme
git-commits-since
Get all commits since given period of time or by default from latest git semver tag. Understands and follows both the SemVer and the Conventional Commits specification.
Please consider following this project's author, Charlike Mike Reagent, and :star: the project to show your :heart: and support.
If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issue or ping
@tunnckoCore at Twitter.
Project is semantically & automatically released on CircleCI with new-release and its New Release GitHub App.
Table of Contents
(TOC generated by verb using markdown-toc)
Install
This project requires Node.js ^8.10.0 || >=10.13.0. Install it using
yarn or npm.
We highly recommend to use Yarn when you think to contribute to this project.
$ yarn add git-commits-since
Usage
In this example, we show how this package can be used in combination with parse-commit-message and detect-next-version to make robust automation, pblish & release flow.
This actually is used in the @tunnckocore/release-cli
and the Release GitHub App.
In the CLI commits are collected from git log
using this module,
in the App commits are from the GitHub API.
Example
import { applyPlugins, plugins, parse, check } from 'parse-commit-message';
import gitCommitsSince from 'git-commits-since';
import detector from 'detect-next-version';
async function main() {
const { rawCommits } = await gitCommitsSince({ cwd: 'path/to/repo' });
const commits = applyPlugins(plugins, check(parse(rawCommits)));
// detect-next-version, also can accept rawCommits (array of strings) directly,
// but that is that way just for demo purposes.
const result = await detector('my-npm-package', commits);
console.log(result);
console.log(result.pkg);
console.log(result.patch);
console.log(result.increment); // => 'patch'
console.log(result.isBreaking); // => false
console.log(result.lastVersion); // => 0.1.0
console.log(result.nextVersion); // => 0.1.1
}
API
Generated using docks.
src/index.js
gitCommitsSince
Gets all commits since given options.from
or since last semver tag (by default).
In return you will get useful metadata and rawCommits
.
Where rawCommits
is an array of commit message strings. Optionally you can pass
a options.plugin
functin which is passed with (rawCommit: string, result: object)
signature and will be called on each commit. This behavior can be used
to do fun stuff on per each project basis. Such as parsing each rawCommit or whatever.
Params
options
{object} basically passed to git-raw-commits and git-semver-tags
Returns
Promise<object>
resolves to an object with{ from, to, cwd, rawCommits }
Examples
import gitCommitsSince from 'git-commits-since';
async function main() {
const result = await gitCommitsSince({ cwd: 'path/to/git/repository' });
console.log(result);
// the @ means HEAD or the latest commit
// => { from: 'v0.1.0', to: '@', cwd: 'path/to/cwd', rawCommits, options }
}
main().catch(console.error);
import gitCommitsSince from 'git-commits-since';
// Using the plugin API
async function main() {
const plugin = (rawCommitString, result) => {
console.log(rawCommitString);
// log each commit
result.qux = 12345;
return { foo: 'bar' };
};
const res = await gitCommitsSince({ plugin });
console.log(res);
console.log(res.rawCommits);
console.log(res.foo); // => 'bar'
console.log(res.qux); // => 12345
}
main().catch(console.error);
See Also
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!
- @tunnckocore/config: All the configs for all the tools, in one… more | homepage
- @tunnckocore/create-project: Create and scaffold a new project, its GitHub repository… more | homepage
- @tunnckocore/package-json: Simple and fast getting of latest package.json metadata for… more | homepage
- @tunnckocore/scripts: Universal and minimalist scripts & tasks runner. | homepage
- @tunnckocore/update: Update to latest project files and templates, based on… more | homepage
- asia: Blazingly fast, magical and minimalist testing framework, for Today… more | homepage
- charlike: Small, fast and streaming project scaffolder with support for… more | homepage
- detect-next-version: Calculates next version, based on given commit message and… more | homepage
- docks: Extensible system for parsing and generating documentation. It just… more | homepage
- gitcommit: Lightweight and joyful
git commit
replacement. Conventional Commits compliant. | homepage - parse-commit-message: Extensible parser for git commit messages following Conventional Commits… more | homepage
Contributing
Follow the Guidelines
Please read the Contributing Guide and Code of Conduct documents for advices.
For bugs reports and feature requests, please create an issue or ping
@tunnckoCore at Twitter.
Support the project
Become a Partner or Sponsor? :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 and yarnpkg.com sites too! :rocket:
Not financial support? Okey! Pull requests, stars and all kind of contributions are always welcome. :sparkles:
OPEN Open Source
This project is following OPEN Open Source model
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.
There are a few basic ground-rules for its contributors
- Any significant modifications must be subject to a pull request to get feedback from other contributors.
- Pull requests to get feedback are encouraged for any other trivial contributions, but are not required.
- Contributors should attempt to adhere to the prevailing code-style and development workflow.
Wonderful Contributors
Thanks to the hard work of these wonderful people this project is alive! It follows the
all-contributors specification.
Don't hesitate to add yourself to that list if you have made any contribution! ;) See how,
here.
| Charlike Mike Reagent💻 📖 💬 👀 🔍 | | :---: |
Consider showing your support to them. :sparkling_heart:
License
Copyright (c) 2018-present, Charlike Mike Reagent <[email protected]>
& contributors.
Released under the Apache-2.0 License.