Skip to content

Commit 03c9161

Browse files
committed
docs: README.md updates
1 parent 1bc7860 commit 03c9161

File tree

3 files changed

+208
-1
lines changed

3 files changed

+208
-1
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# @modulify/conventional-bump
2+
3+
Semantic-release helper that analyzes conventional commits and recommends the next version (major/minor/patch)
4+
based on your git history.
5+
6+
- Repository: https://github.com/modulify/conventional
7+
- Spec: https://www.conventionalcommits.org/en/v1.0.0/
8+
9+
## Installation
10+
11+
- npm: `npm i @modulify/conventional-bump`
12+
- yarn: `yarn add @modulify/conventional-bump`
13+
- pnpm: `pnpm add @modulify/conventional-bump`
14+
15+
## Quick start
16+
17+
```
18+
import { ReleaseAdvisor } from '@modulify/conventional-bump'
19+
20+
const advisor = new ReleaseAdvisor()
21+
const recommendation = await advisor.advise()
22+
23+
if (recommendation) {
24+
console.log(recommendation.type) // 'major' | 'minor' | 'patch'
25+
console.log(recommendation.reason) // human–readable explanation
26+
}
27+
```
28+
29+
## Public API
30+
31+
### Types
32+
33+
- `type ReleaseType = 'major' | 'minor' | 'patch'`
34+
- `type ReleaseRecommendation = { type: ReleaseType; reason: string }`
35+
- `type CommitType = { type: string; section: string; hidden?: boolean }`
36+
37+
### ReleaseAdvisor
38+
39+
Creates an analyzer that reads commits from git and recommends the next semantic version.
40+
41+
Constructor:
42+
43+
```
44+
new ReleaseAdvisor(options?: {
45+
cwd?: string; // Working directory for git commands
46+
git?: Client; // Custom @modulify/conventional-git client (for tests)
47+
parse?: ParseOptions; // Conventional commit parser options (@modulify/conventional-git)
48+
types?: CommitType[]; // Custom type-to-section mapping
49+
})
50+
```
51+
52+
Method:
53+
54+
```
55+
advise(options?: {
56+
ignore?: (commit: Commit) => boolean; // Skip specific commits
57+
ignoreReverted?: boolean; // Ignore commits that were later reverted (default: true)
58+
preMajor?: boolean; // If true, downgrade major→minor and minor→patch for <1.0.0
59+
strict?: boolean; // If true, return null when there are no meaningful changes
60+
}): Promise<ReleaseRecommendation | null>
61+
```
62+
63+
Behavior highlights:
64+
- Breaking changes ("!" or notes) lead to `major` unless `preMajor` is enabled.
65+
- New features (`feat`/`feature`) lead to `minor`.
66+
- Otherwise, `patch` is recommended when there are other visible changes; with `strict: true` and no changes, returns `null`.
67+
- With `ignoreReverted: true` the advisor cancels out commits that were reverted later, including revert-of-revert chains.
68+
69+
## Example: pre-1.0.0 workflow
70+
71+
```
72+
const advisor = new ReleaseAdvisor()
73+
const next = await advisor.advise({ preMajor: true })
74+
console.log(next?.type) // 'minor' or 'patch' for <1.0.0 projects
75+
```
76+
77+
## Example: strict mode
78+
79+
```
80+
const next = await advisor.advise({ strict: true })
81+
if (!next) {
82+
console.log('No release-worthy changes since last tag')
83+
}
84+
```
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# @modulify/conventional-changelog
2+
3+
Generate a changelog from your git history using conventional commits.
4+
Groups entries by sections you define and skips commits that were reverted later.
5+
6+
- Repository: https://github.com/modulify/conventional
7+
- Spec: https://www.conventionalcommits.org/en/v1.0.0/
8+
9+
## Installation
10+
11+
- npm: `npm i @modulify/conventional-changelog`
12+
- yarn: `yarn add @modulify/conventional-changelog`
13+
- pnpm: `pnpm add @modulify/conventional-changelog`
14+
15+
## Quick start
16+
17+
```
18+
import { ChangelogWriter } from '@modulify/conventional-changelog'
19+
20+
const writer = new ChangelogWriter({
21+
types: [
22+
{ type: 'feat', section: 'Features' },
23+
{ type: 'fix', section: 'Bug Fixes' },
24+
],
25+
})
26+
27+
const content = await writer.write()
28+
console.log(content)
29+
```
30+
31+
You can also pass a Node.js Writable to stream the generated content:
32+
33+
```
34+
import { createWriteStream } from 'node:fs'
35+
36+
const out = createWriteStream('CHANGELOG.md')
37+
const writer = new ChangelogWriter({ output: out, types: [...] })
38+
await writer.write()
39+
```
40+
41+
## Public API
42+
43+
### ChangelogWriter
44+
45+
Constructor:
46+
47+
```
48+
new ChangelogWriter(options?: ChangelogOptions)
49+
```
50+
51+
Method:
52+
53+
```
54+
write(): Promise<string>
55+
```
56+
57+
Behavior highlights:
58+
- Groups commits into sections according to `types`.
59+
- Skips commits that were later reverted; revert-of-revert chains are handled so that original commits are restored.
60+
- When `output` is provided, the same content is written to the stream and also returned as a string.
Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
# @modulify/conventional-git
1+
# @modulify/conventional-git
2+
3+
Thin wrapper over git that adds conventional-commit parsing and semantic tag helpers.
4+
5+
- Repository: https://github.com/modulify/conventional
6+
- Spec: https://www.conventionalcommits.org/en/v1.0.0/
7+
8+
## Installation
9+
10+
- npm: `npm i @modulify/conventional-git`
11+
- yarn: `yarn add @modulify/conventional-git`
12+
- pnpm: `pnpm add @modulify/conventional-git`
13+
14+
## Quick start
15+
16+
```
17+
import { Client, packagePrefix } from '@modulify/conventional-git'
18+
19+
const git = new Client()
20+
21+
// Read parsed commits (async iterable)
22+
for await (const c of git.commits()) {
23+
console.log(c.type, c.scope, c.subject)
24+
}
25+
26+
// Get semver tags (async iterable)
27+
for await (const t of git.tags({ clean: true })) {
28+
console.log('tag:', t)
29+
}
30+
31+
// Get latest version from tags
32+
console.log(await git.version())
33+
34+
// Work with package-scoped tags
35+
const prefix = packagePrefix('my-package') // => 'my-package@'
36+
for await (const t of git.tags({ prefix, clean: true })) {
37+
console.log('my-package version:', t)
38+
}
39+
```
40+
41+
## Public API
42+
43+
### Functions
44+
45+
- `packagePrefix(packageName?: string): string | RegExp`
46+
- Returns a prefix for package-specific semver tags. If no name is provided, returns a RegExp that matches any `<name>@` prefix.
47+
48+
### Client
49+
50+
Constructor:
51+
52+
```
53+
new Client(options?: { cwd?: string; git?: GitClient })
54+
```
55+
56+
Properties:
57+
* `git` — access to the underlying low-level client.
58+
59+
Methods:
60+
61+
* `commits` – Returns async iterable of parsed conventional commits.
62+
* `tags` – Streams semver tags. When `prefix` is provided, only tags with that prefix are considered.
63+
`skipUnstable` skips prereleases. With `clean: true`, the returned items are cleaned versions (e.g. `1.2.3`).
64+
* `version` – Returns the latest semantic version (sorted with semver) or `null` when no semver tag is found.

0 commit comments

Comments
 (0)