@vingy/nimver 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +181 -0
- package/bin/nimver.js +13364 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vingy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# nimver
|
|
2
|
+
|
|
3
|
+
Forget about manual versioning — `nimver` handles it for you.
|
|
4
|
+
|
|
5
|
+
It uses your Git commit history to determine the next version, and even writes your changelog for you. All you need to do is write nice [Conventional Commits](https://www.conventionalcommits.org).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
From npm (needs Node 18+):
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install --save-dev @vingy/nimver # or: npm install -g @vingy/nimver
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The package is scoped, but the command it installs is plain `nimver` (or `npx nimver`).
|
|
16
|
+
|
|
17
|
+
From Nimble:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
nimble install nimver
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or grab a prebuilt binary for your platform from the [releases page](https://github.com/vinpogo/nimver/releases) and put it on your `PATH`. The binary has no runtime dependencies beyond `git`.
|
|
24
|
+
|
|
25
|
+
## Setup (per repository)
|
|
26
|
+
|
|
27
|
+
From the root of the Git repository you want to version:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
nimver init
|
|
31
|
+
nimver install-hooks
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`init` creates `.nimver/config.ini`, pre-populated with sensible defaults.
|
|
35
|
+
`install-hooks` writes a `commit-msg` hook into `.git/hooks/` that delegates to this binary, rejecting messages a release would not be able to read. `.nimver/` should be committed to Git.
|
|
36
|
+
|
|
37
|
+
## Everyday use
|
|
38
|
+
|
|
39
|
+
Just commit normally, using [Conventional Commits syntax](https://www.conventionalcommits.org/):
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
type(scope)!: subject
|
|
43
|
+
|
|
44
|
+
optional body
|
|
45
|
+
|
|
46
|
+
optional footer, e.g.:
|
|
47
|
+
BREAKING CHANGE: describe the break
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
When you're ready to cut a release:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
nimver bump # updates the manifest + CHANGELOG.md, commits, and tags
|
|
54
|
+
nimver bump --dry-run # what it would do, and the changelog entry it would write
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### What counts as pending
|
|
58
|
+
|
|
59
|
+
`bump` looks back from `HEAD` to the last release of the package it is releasing — the newest commit carrying that package's release tag. Every commit in between is a pending change, and its type decides the bump.
|
|
60
|
+
|
|
61
|
+
Two things follow from reading history rather than a recorded state:
|
|
62
|
+
|
|
63
|
+
- **CI needs the history and the tags.** Shallow clones do not have them; on GitHub Actions that means `fetch-depth: 0` on `actions/checkout`.
|
|
64
|
+
|
|
65
|
+
## Supported project manifests
|
|
66
|
+
|
|
67
|
+
`nimver bump` currently supports:
|
|
68
|
+
|
|
69
|
+
- `.nimble`
|
|
70
|
+
- `package.json`
|
|
71
|
+
|
|
72
|
+
## Monorepos
|
|
73
|
+
|
|
74
|
+
Repositories with multiple packages must list them explicitly in `.nimver/config.ini`:
|
|
75
|
+
|
|
76
|
+
```ini
|
|
77
|
+
[workspace]
|
|
78
|
+
strategy = independent
|
|
79
|
+
sharedChanges = all
|
|
80
|
+
|
|
81
|
+
[package.web]
|
|
82
|
+
manifest = packages/web/package.json
|
|
83
|
+
|
|
84
|
+
[package.cli]
|
|
85
|
+
manifest = packages/cli/cli.nimble
|
|
86
|
+
sourceFiles = "src/cli/src/**"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`sourceFiles` is optional per package, see [Change attribution](#change-attribution).
|
|
90
|
+
|
|
91
|
+
### Strategy
|
|
92
|
+
|
|
93
|
+
The strategy controls how versioning is handled for the packages. There are two strategies: `independent` and `fixed`.
|
|
94
|
+
|
|
95
|
+
- `independent` — each package keeps its own version (default)
|
|
96
|
+
- `fixed` — all packages share the same version
|
|
97
|
+
|
|
98
|
+
When using `independent` strategy, you can bump the version of a single package without affecting others using `nimver bump <package>`.
|
|
99
|
+
|
|
100
|
+
If you don't declare any packages, `nimver` picks up the manifests directly in the repository root. Finding more than one there, it assumes `fixed`, since nothing says how they relate.
|
|
101
|
+
|
|
102
|
+
### Shared changes
|
|
103
|
+
|
|
104
|
+
Shared changes are files that belong to no package on their own. There are two options for handling them: `all` and `none`.
|
|
105
|
+
|
|
106
|
+
- `all` — all packages are affected (default)
|
|
107
|
+
- `none` — no packages are affected
|
|
108
|
+
|
|
109
|
+
### Changelogs
|
|
110
|
+
|
|
111
|
+
A changelog lives next to its manifest, so where you put manifests decides how many changelogs you get:
|
|
112
|
+
|
|
113
|
+
- **Each manifest in its own directory** — one `CHANGELOG.md` per package,
|
|
114
|
+
written beside the manifest, with plain `## [1.2.0]` headings.
|
|
115
|
+
- **Several manifests in the same directory** (including the repository root) —
|
|
116
|
+
those packages share the one `CHANGELOG.md` in that directory, and each
|
|
117
|
+
section names its package: `## [web 1.2.0]`.
|
|
118
|
+
|
|
119
|
+
### Change attribution
|
|
120
|
+
|
|
121
|
+
A committed file is attributed to the package whose manifest is its _nearest
|
|
122
|
+
ancestor_, so no per-package file patterns are needed:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
packages/web/src/button.ts -> web
|
|
126
|
+
packages/cli/src/main.nim -> cli
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
When `sourceFiles` is set, it wins over the nearest-ancestor rule. The patterns of two packages must not overlap. Glob patterns must be quoted.
|
|
130
|
+
|
|
131
|
+
If two manifests share a directory, any file within that directory belongs to neither package and follows [Shared changes](#shared-changes) — set `sourceFiles` to attribute it to one of them.
|
|
132
|
+
|
|
133
|
+
## Commit types
|
|
134
|
+
|
|
135
|
+
You can manually configure the commit types and bump levels in `.nimver/config.ini`. These levels are available:
|
|
136
|
+
|
|
137
|
+
```ini
|
|
138
|
+
[types]
|
|
139
|
+
foo = major # bumps a major version e.g. 1.1.0 -> 2.0.0
|
|
140
|
+
bar = minor # bumps a minor version e.g. 0.1.1 -> 0.2.0
|
|
141
|
+
baz = patch # bumps a patch version e.g. 0.1.0 -> 0.1.1
|
|
142
|
+
qux = none # shows in changelog but doesn't bump version
|
|
143
|
+
quux = ignore # won't show up in changelog
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
A breaking change will always be treated as a major bump.
|
|
147
|
+
|
|
148
|
+
Each commit is read under the configuration *it* was made with, taken from its own tree — so changing a mapping today does not rewrite what last week's commits meant, and a package added mid-cycle cannot claim changes made before it existed.
|
|
149
|
+
|
|
150
|
+
Any commit type not listed here is rejected by the `commit-msg` hook. Add your own types (and adjust bump levels) as needed.
|
|
151
|
+
|
|
152
|
+
The default types are:
|
|
153
|
+
|
|
154
|
+
```ini
|
|
155
|
+
[types]
|
|
156
|
+
feat = minor
|
|
157
|
+
fix = patch
|
|
158
|
+
perf = patch
|
|
159
|
+
refactor = patch
|
|
160
|
+
revert = patch
|
|
161
|
+
docs = none
|
|
162
|
+
style = none
|
|
163
|
+
chore = none
|
|
164
|
+
test = none
|
|
165
|
+
build = none
|
|
166
|
+
ci = none
|
|
167
|
+
version = ignore
|
|
168
|
+
wip = ignore
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## CLI reference
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
nimver init
|
|
175
|
+
nimver install-hooks [--force]
|
|
176
|
+
nimver bump [<package>] [--dry-run]
|
|
177
|
+
nimver version
|
|
178
|
+
|
|
179
|
+
Invoked by the installed hook (not usually run by hand):
|
|
180
|
+
nimver check-commit-msg <path-to-message-file>
|
|
181
|
+
```
|