Commit a051e97
fix(cli): report the real version instead of a hardcoded 0.1.0
Found by installing the published package and running it: iobroker-sync@1.0.0
printed 0.1.0 for --version. The version was a string literal in cli.ts, and
release-please bumps package.json — it has no way to reach a literal in the
source, so every release since 0.1.0 would have lied.
It is now read from package.json at runtime via createRequire. dist/cli.js
sits one level below package.json both in the repository and in the
installed package, so the relative path holds in both; verified by dropping
the built file into the package installed from npm.
The cli test now compares --version against package.json rather than a
regex, so the two cannot drift again.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent ba8f2da commit a051e97
2 files changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| |||
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
174 | | - | |
| 184 | + | |
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
208 | 215 | | |
209 | 216 | | |
210 | 217 | | |
211 | | - | |
| 218 | + | |
212 | 219 | | |
213 | 220 | | |
0 commit comments