Skip to content

Commit d71ff4b

Browse files
author
Charlike Mike Reagent
committed
feat: bump recommended-bump to latest & some tweaks
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
1 parent d78ae9e commit d71ff4b

File tree

9 files changed

+210
-1707
lines changed

9 files changed

+210
-1707
lines changed

.circleci/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobtest: &jobtest
5555
name: Installing project dependencies
5656
command: yarn install --prefer-offline || yarn install
5757
- run:
58-
name: Testing your project
59-
command: yarn tunnckocore-scripts test
58+
name: Linting and testing your project
59+
command: yarn global add nyc@latest && yarn run lint && yarn test
6060
- save_cache:
6161
key: detect-next-version-{{ checksum "yarn.lock" }}
6262
paths: node_modules
@@ -97,17 +97,17 @@ jobs:
9797
# <<: *node10osx
9898
# <<: *jobtest
9999

100-
release:
100+
publish:
101101
<<: *node10linux
102102
steps:
103103
- checkout
104104
- *restore_modules_cache
105105
- run:
106106
name: Bundling your awesome project
107-
command: yarn tunnckocore-scripts build || echo "No build step."
107+
command: yarn run build || echo "No build step."
108108
- run:
109109
name: Releasing and publishing
110-
command: yarn tunnckocore-scripts release
110+
command: yarn run release || (yarn global add @tunnckocore/release-cli && yarn run release)
111111

112112
workflows:
113113
version: 2
@@ -137,7 +137,7 @@ workflows:
137137

138138
# Release and NPM publish
139139
# Executed only on master
140-
- release:
140+
- publish:
141141
requires:
142142
# - test-node8osx
143143
# - test-node10osx
@@ -146,4 +146,4 @@ workflows:
146146
filters:
147147
branches:
148148
only: master
149-
context: org-secret
149+
context: org-global

.huskyrc.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

.verb.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ example usage. If all commit messages are of type that is not `patch|fix|minor|f
7070
or containing `BREAKING CHANGE:` label (e.g. the `chore` type), then the
7171
returned result won't have `nextVersion` and `increment` will be `false`.
7272

73+
ProTip: See [parse-commit-message types](https://github.com/tunnckoCoreLabs/parse-commit-message#type-definitions) documentation!
74+
7375
**Params**
7476
- `name` **{string}** a package name which you looking to update
7577
- `commits` **{string|}** directly passed to [recommended-bump][]
@@ -83,15 +85,13 @@ returned result won't have `nextVersion` and `increment` will be `false`.
8385
**Examples**
8486
```ts
8587
type Commit = {
86-
header: {
87-
type: string,
88-
scope: string,
89-
subject: string,
90-
toString: Function,
91-
},
92-
body: string | null,
93-
footer: string | null
94-
}
88+
header: Header;
89+
body?: string | null;
90+
footer?: string | null;
91+
increment?: string | boolean;
92+
isBreaking?: boolean;
93+
mentions?: Array<Mention>;
94+
};
9595
```
9696
```javascript
9797
import detector from 'detect-next-version';
@@ -114,14 +114,14 @@ async function main() {
114114
main().catch(console.error);
115115
```
116116
```javascript
117-
import { parse, plugins } from 'parse-commit-message';
118-
import detectNextVersion from 'detect-next-version';
117+
import { parse } from 'parse-commit-message';
118+
import detector from 'detect-next-version';
119119

120120
async function main() {
121-
const commitOne = parse('fix: foo bar', plugins);
122-
const commitTwo = parse('feat: some feature subject', plugins);
121+
const commitOne = parse('fix: foo bar');
122+
const commitTwo = parse('feat: some feature subject');
123123

124-
const result = detectNextVersion('@my-org/my-awesomepkg', [commitOne, commitTwo]);
124+
const result = await detector('@my-org/my-awesomepkg', [commitOne, commitTwo]);
125125
console.log(result.increment); // => 'minor'
126126
}
127127

@@ -136,8 +136,8 @@ main().catch(console.error);
136136

137137
## See Also
138138

139-
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your
140-
existance!
139+
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!
140+
141141
{%= related(verb.related.list, { words: 10 }) %}
142142

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

README.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Project is [semantically](https://semver.org) & automatically released on [Circl
5151
* [Wonderful Contributors](#wonderful-contributors)
5252
- [License](#license)
5353

54+
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
55+
5456
## Install
5557

5658
This project requires [**Node.js**](https://nodejs.org) **^8.11.0 || >=10.13.0**. Install it using
@@ -80,6 +82,8 @@ example usage. If all commit messages are of type that is not `patch|fix|minor|f
8082
or containing `BREAKING CHANGE:` label (e.g. the `chore` type), then the
8183
returned result won't have `nextVersion` and `increment` will be `false`.
8284

85+
ProTip: See [parse-commit-message types](https://github.com/tunnckoCoreLabs/parse-commit-message#type-definitions) documentation!
86+
8387
**Params**
8488
- `name` **{string}** a package name which you looking to update
8589
- `commits` **{string|}** directly passed to [recommended-bump][]
@@ -93,15 +97,13 @@ returned result won't have `nextVersion` and `increment` will be `false`.
9397
**Examples**
9498
```ts
9599
type Commit = {
96-
header: {
97-
type: string,
98-
scope: string,
99-
subject: string,
100-
toString: Function,
101-
},
102-
body: string | null,
103-
footer: string | null
104-
}
100+
header: Header;
101+
body?: string | null;
102+
footer?: string | null;
103+
increment?: string | boolean;
104+
isBreaking?: boolean;
105+
mentions?: Array<Mention>;
106+
};
105107
```
106108
```javascript
107109
import detector from 'detect-next-version';
@@ -124,14 +126,14 @@ async function main() {
124126
main().catch(console.error);
125127
```
126128
```javascript
127-
import { parse, plugins } from 'parse-commit-message';
128-
import detectNextVersion from 'detect-next-version';
129+
import { parse } from 'parse-commit-message';
130+
import detector from 'detect-next-version';
129131

130132
async function main() {
131-
const commitOne = parse('fix: foo bar', plugins);
132-
const commitTwo = parse('feat: some feature subject', plugins);
133+
const commitOne = parse('fix: foo bar');
134+
const commitTwo = parse('feat: some feature subject');
133135

134-
const result = detectNextVersion('@my-org/my-awesomepkg', [commitOne, commitTwo]);
136+
const result = await detector('@my-org/my-awesomepkg', [commitOne, commitTwo]);
135137
console.log(result.increment); // => 'minor'
136138
}
137139

@@ -144,17 +146,11 @@ main().catch(console.error);
144146

145147
## See Also
146148

147-
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your
148-
existance!
149-
- [@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")
150-
- [@tunnckocore/create-github-repo](https://www.npmjs.com/package/@tunnckocore/create-github-repo): Small and fast way to create GitHub repository! Provides API… [more](https://github.com/tunnckoCoreLabs/create-github-repo) | [homepage](https://github.com/tunnckoCoreLabs/create-github-repo "Small and fast way to create GitHub repository! Provides API and CLI")
151-
- [@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")
152-
- [@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")
153-
- [@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.")
154-
- [@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`.")
155-
- [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")
156-
- [execa](https://www.npmjs.com/package/execa): A better `child_process` | [homepage](https://github.com/sindresorhus/execa#readme "A better `child_process`")
149+
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!
150+
151+
- [git-commits-since](https://www.npmjs.com/package/git-commits-since): Get all commits since given period of time or by… [more](https://github.com/tunnckoCoreLabs/git-commits-since) | [homepage](https://github.com/tunnckoCoreLabs/git-commits-since "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.")
157152
- [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.")
153+
- [parse-commit-message](https://www.npmjs.com/package/parse-commit-message): Extensible parser for git commit messages following Conventional Commits Specification | [homepage](https://github.com/tunnckoCoreLabs/parse-commit-message "Extensible parser for git commit messages following Conventional Commits Specification")
158154
- [recommended-bump](https://www.npmjs.com/package/recommended-bump): Calculates recommended bump (next semver version) based on given array… [more](https://github.com/tunnckoCoreLabs/recommended-bump) | [homepage](https://github.com/tunnckoCoreLabs/recommended-bump "Calculates recommended bump (next semver version) based on given array of commit messages following Conventional Commits specification")
159155

160156
**[back to top](#thetop)**
@@ -255,8 +251,7 @@ Released under the [Apache-2.0 License][license-url].
255251
[shareb]: https://badgen.net/badge/twitter/share/1da1f2?icon=twitter
256252
[open-issue-url]: https://github.com/tunnckoCoreLabs/detect-next-version/issues/new
257253

258-
[execa]: https://github.com/sindresorhus/execa
259254
[new-release]: https://github.com/tunnckoCore/new-release
260-
[parse-commit-message]: https://github.com/olstenlarck/parse-commit-message
255+
[parse-commit-message]: https://github.com/tunnckoCoreLabs/parse-commit-message
261256
[recommended-bump]: https://github.com/tunnckoCoreLabs/recommended-bump
262257
[semantic-release]: https://github.com/semantic-release/semantic-release

package.json

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,23 @@
44
"license": "Apache-2.0",
55
"licenseStart": "2017",
66
"scripts": {
7-
"start": "tunnckocore-scripts",
8-
"extends": "@tunnckocore/config/scripts",
9-
"docs": "tunnckocore-scripts docs",
10-
"lint": "tunnckocore-scripts lint",
11-
"test": "tunnckocore-scripts test",
12-
"commit": "tunnckocore-scripts commit"
7+
"docs": "docks --outfile .verb.md && verb",
8+
"lint": "eslint '**/*.js' --cache --fix --quiet --format codeframe",
9+
"test": "nyc asia",
10+
"commit": "yarn lint && yarn test && yarn dry",
11+
"dry": "git add -A && git status --porcelain && gitcommit -sS",
12+
"release": "tunnckocore-release"
1313
},
1414
"engines": {
1515
"node": "^8.11.0 || >=10.13.0"
1616
},
1717
"dependencies": {
1818
"@tunnckocore/package-json": "^1.0.1",
1919
"esm": "^3.0.84",
20-
"parse-commit-message": "1.1.2",
21-
"recommended-bump": "^1.2.0"
20+
"recommended-bump": "^1.3.0"
2221
},
2322
"devDependencies": {
24-
"@tunnckocore/config": "^0.5.1",
25-
"@tunnckocore/scripts": "^1.1.0",
23+
"@tunnckocore/config": "^1.0.2",
2624
"asia": "^0.19.7"
2725
},
2826
"files": [
@@ -32,7 +30,7 @@
3230
"main": "index.js",
3331
"module": "src/index.js",
3432
"typings": "src/index.d.ts",
35-
"version": "3.0.0",
33+
"version": "3.0.1",
3634
"repository": "tunnckoCoreLabs/detect-next-version",
3735
"homepage": "https://github.com/tunnckoCoreLabs/detect-next-version",
3836
"author": "Charlike Mike Reagent (https://tunnckocore.com)",
@@ -48,25 +46,17 @@
4846
"toc": {
4947
"render": true,
5048
"method": "preWrite",
51-
"maxdepth": 4,
52-
"footer": ""
49+
"maxdepth": 4
5350
},
5451
"layout": "empty",
5552
"tasks": [
5653
"readme"
5754
],
5855
"related": {
5956
"list": [
60-
"execa",
61-
"charlike",
6257
"gitcommit",
63-
"@tunnckocore/create-github-repo",
64-
"@tunnckocore/create-project",
65-
"@tunnckocore/package-json",
66-
"@tunnckocore/execa",
67-
"@tunnckocore/update",
68-
"@tunnckocore/scripts",
69-
"@tunnckocore/config",
58+
"git-commits-since",
59+
"parse-commit-message",
7060
"recommended-bump"
7161
]
7262
},
@@ -76,9 +66,8 @@
7666
"reflinks": [
7767
"new-release",
7868
"semantic-release",
79-
"execa",
8069
"parse-commit-message",
8170
"recommended-bump"
8271
]
8372
}
84-
}
73+
}

src/index.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ import increment from './semver-inc';
1414
* or containing `BREAKING CHANGE:` label (e.g. the `chore` type), then the
1515
* returned result won't have `nextVersion` and `increment` will be `false`.
1616
*
17+
* ProTip: See [parse-commit-message types](https://github.com/tunnckoCoreLabs/parse-commit-message#type-definitions) documentation!
18+
*
1719
* @example ts
1820
* type Commit = {
19-
* header: {
20-
* type: string,
21-
* scope: string,
22-
* subject: string,
23-
* toString: Function,
24-
* },
25-
* body: string | null,
26-
* footer: string | null
27-
* }
21+
* header: Header;
22+
* body?: string | null;
23+
* footer?: string | null;
24+
* increment?: string | boolean;
25+
* isBreaking?: boolean;
26+
* mentions?: Array<Mention>;
27+
* };
2828
*
2929
* @example
3030
* import detector from 'detect-next-version';
@@ -47,14 +47,14 @@ import increment from './semver-inc';
4747
* main().catch(console.error);
4848
*
4949
* @example
50-
* import { parse, plugins } from 'parse-commit-message';
51-
* import detectNextVersion from 'detect-next-version';
50+
* import { parse } from 'parse-commit-message';
51+
* import detector from 'detect-next-version';
5252
*
5353
* async function main() {
54-
* const commitOne = parse('fix: foo bar', plugins);
55-
* const commitTwo = parse('feat: some feature subject', plugins);
54+
* const commitOne = parse('fix: foo bar');
55+
* const commitTwo = parse('feat: some feature subject');
5656
*
57-
* const result = detectNextVersion('@my-org/my-awesomepkg', [commitOne, commitTwo]);
57+
* const result = await detector('@my-org/my-awesomepkg', [commitOne, commitTwo]);
5858
* console.log(result.increment); // => 'minor'
5959
* }
6060
*
@@ -69,22 +69,22 @@ import increment from './semver-inc';
6969
* @returns {object} an object which is basically the return of [recommended-bump][]
7070
* plus `{ pkg, lastVersion, nextVersion? }`.
7171
*/
72-
export default async function detector(name, commitMessages, options = {}) {
72+
export default async function detector(name, commits, options = {}) {
7373
const opts = Object.assign({}, options);
7474

7575
if (typeof name !== 'string') {
7676
throw new TypeError('expect `name` to be string');
7777
}
78-
const commits = [].concat(commitMessages).filter(Boolean);
78+
const cmts = [].concat(commits).filter(Boolean);
7979

80-
if (commits.length === 0) {
80+
if (cmts.length === 0) {
8181
throw new TypeError(
82-
'expect `commitMessages` to be string or array of strings',
82+
'expect `commits` to be string, array of strings or array of objects',
8383
);
8484
}
8585

8686
const pkg = await packageJson(name, opts.endpoint);
87-
const recommended = recommendedBump(commits, opts.plugins);
87+
const recommended = recommendedBump(cmts, opts.plugins);
8888
const lastVersion = pkg.version;
8989

9090
if (!recommended.increment) {

0 commit comments

Comments
 (0)