package-version-info 0.2.3 → 0.3.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/README.md +38 -7
- package/bin/native/darwin-arm64/version_info +0 -0
- package/bin/native/darwin-x64/version_info +0 -0
- package/bin/native/linux-arm64/version_info +0 -0
- package/bin/native/linux-x64/version_info +0 -0
- package/bin/native/win32-x64/version_info.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ npm install package-version-info --save-dev
|
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
|
|
44
|
+
bun add --dev package-version-info
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
The npm package includes native executables for macOS arm64/x64, Linux arm64/x64, and Windows
|
|
@@ -55,7 +55,7 @@ npx package-version-info --output src/version-info.ts
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
```text
|
|
58
|
-
|
|
58
|
+
✓ Generated src/version-info.ts • v1.0.0 • 2.00 ms
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### 3. Import it
|
|
@@ -107,10 +107,14 @@ npx package-version-info
|
|
|
107
107
|
| --- | --- | --- | --- |
|
|
108
108
|
| `--help` | `-h` | — | Display usage information. |
|
|
109
109
|
| `--version` | `-v` | — | Display the installed package version. |
|
|
110
|
-
| `--verbose` | — | Disabled | Display detailed generation
|
|
110
|
+
| `--verbose` | — | Disabled | Display a detailed generation summary. |
|
|
111
|
+
| `--dry-run` | — | Disabled | Print TypeScript without creating a file. |
|
|
111
112
|
| `--input <path>` | `-i` | `package.json` | Input package file. |
|
|
112
113
|
| `--output <path>` | `-o` | `version-info.ts` | Generated TypeScript file. |
|
|
113
|
-
| `--git <path>` | `-g` | `.git` | Git directory used for branch and commit metadata. |
|
|
114
|
+
| `--git <path>` | `-g` | `.git` | Git directory or pointer file used for branch and commit metadata. |
|
|
115
|
+
|
|
116
|
+
The Git path may be a regular `.git` directory or the `.git` pointer file used by linked
|
|
117
|
+
worktrees and submodules.
|
|
114
118
|
|
|
115
119
|
### Common examples
|
|
116
120
|
|
|
@@ -121,6 +125,12 @@ npx package-version-info
|
|
|
121
125
|
# Show detailed progress
|
|
122
126
|
npx package-version-info --verbose
|
|
123
127
|
|
|
128
|
+
# Preview generated TypeScript without creating a file
|
|
129
|
+
npx package-version-info --dry-run
|
|
130
|
+
|
|
131
|
+
# Pipe the preview to another command
|
|
132
|
+
npx package-version-info --dry-run | less
|
|
133
|
+
|
|
124
134
|
# Use custom paths
|
|
125
135
|
npx package-version-info \
|
|
126
136
|
--input package.json \
|
|
@@ -139,7 +149,7 @@ npx package-version-info \
|
|
|
139
149
|
Compact mode is designed for normal builds:
|
|
140
150
|
|
|
141
151
|
```text
|
|
142
|
-
|
|
152
|
+
✓ Generated src/version-info.ts • v1.0.0 • 2.00 ms
|
|
143
153
|
```
|
|
144
154
|
|
|
145
155
|
Use verbose mode when diagnosing package, author, timestamp, Git, or output-path behavior:
|
|
@@ -148,6 +158,27 @@ Use verbose mode when diagnosing package, author, timestamp, Git, or output-path
|
|
|
148
158
|
npx package-version-info --verbose
|
|
149
159
|
```
|
|
150
160
|
|
|
161
|
+
```text
|
|
162
|
+
› Package package.json • v1.0.0
|
|
163
|
+
› Author Dominik Hladík • dominik.hladik@seznam.cz • https://github.com/Celtian
|
|
164
|
+
› Timestamp 2026-07-16T18:53:01.908Z
|
|
165
|
+
› Git main • 8be6ca60256cc90e0a41d40b9ee222165f239444
|
|
166
|
+
✓ Generated version-info.ts • v1.0.0 • 2.00 ms
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Dry-run preview
|
|
170
|
+
|
|
171
|
+
Use `--dry-run` to print the generated TypeScript to stdout without creating the configured output
|
|
172
|
+
file or its parent directories:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npx package-version-info --dry-run
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The stdout stream contains only TypeScript, with no colors or status text, so it can be redirected
|
|
179
|
+
or piped directly. Combining `--verbose` with `--dry-run` keeps the TypeScript on stdout and writes
|
|
180
|
+
the colored diagnostic summary to stderr, ending with `✓ Previewed`.
|
|
181
|
+
|
|
151
182
|
## 🛠️ Build-tool integration
|
|
152
183
|
|
|
153
184
|
Generate version information automatically before your application build:
|
|
@@ -171,7 +202,7 @@ Requirements:
|
|
|
171
202
|
|
|
172
203
|
- [Zig 0.16.0](https://ziglang.org/download/)
|
|
173
204
|
- Node.js 24
|
|
174
|
-
-
|
|
205
|
+
- Bun 1.3.14
|
|
175
206
|
|
|
176
207
|
```bash
|
|
177
208
|
# Build the executable
|
|
@@ -181,7 +212,7 @@ zig build
|
|
|
181
212
|
zig build run
|
|
182
213
|
|
|
183
214
|
# Run all formatting, build, and test checks
|
|
184
|
-
|
|
215
|
+
bun run validate
|
|
185
216
|
```
|
|
186
217
|
|
|
187
218
|
<details>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|