pubz 0.4.0 → 0.4.1

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.
Files changed (3) hide show
  1. package/README.md +60 -51
  2. package/dist/cli.js +34 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -21,6 +21,7 @@ bunx pubz
21
21
  9. Transforms `workspace:` definitions to hard version numbers (so `npm` can be used for publishing with OIDC support).
22
22
  10. Publishes to npm
23
23
  11. Prompts you to create a `git tag` and push it
24
+ 12. Generates a changelog and creates a GitHub Release
24
25
 
25
26
  ## Options
26
27
 
@@ -186,49 +187,35 @@ Discovering packages...
186
187
 
187
188
  Found 1 publishable package(s):
188
189
 
189
- • pubz@0.2.2
190
+ • pubz@0.4.0
190
191
 
191
192
  Step 1: Version Management
192
193
  ──────────────────────────────
193
194
 
194
- Current version: 0.2.2
195
-
196
- ? Bump version before publishing? [Y/n]
197
- ? Select version bump type:
198
-
199
- > 1) patch (0.2.2 -> 0.2.3)
200
- 2) minor (0.2.2 -> 0.3.0)
201
- 3) major (0.2.2 -> 1.0.0)
202
-
203
- Enter choice [1-3] (default: 1): 1
204
-
205
- Updating version to 0.2.3 in all packages...
206
-
207
- Updated pubz: 0.2.2 -> 0.2.3
208
- M package.json
209
- Committing version bump...
210
- [main 945e1a3] chore: release v0.2.3
211
- 1 file changed, 1 insertion(+), 1 deletion(-)
212
- Changes committed
195
+ Current version: 0.4.0
213
196
 
197
+ ? Bump version before publishing? [Y/n] n
214
198
  ? Select publish target:
215
199
 
216
200
  > 1) Public npm registry (https://registry.npmjs.org)
217
201
  2) GitHub Packages (https://npm.pkg.github.com)
218
202
 
219
- Enter choice [1-2] (default: 1):
203
+ Enter choice [1-2] (default: 1):
220
204
 
221
205
  Publishing to: https://registry.npmjs.org
222
206
 
207
+ Verifying npm authentication...
208
+ Authenticated as zdavison
209
+
223
210
  Step 2: Building Packages
224
211
  ──────────────────────────────
225
212
 
226
213
  Running build...
227
214
 
228
215
  $ bun build src/cli.ts --outdir dist --target node
229
- Bundled 7 modules in 7ms
216
+ Bundled 10 modules in 5ms
230
217
 
231
- cli.js 28.65 KB (entry point)
218
+ cli.js 41.27 KB (entry point)
232
219
 
233
220
 
234
221
  Build completed successfully
@@ -242,46 +229,68 @@ Step 3: Publishing to npm
242
229
 
243
230
  About to publish the following packages:
244
231
 
245
- • pubz@0.2.3
232
+ • pubz@0.4.0
246
233
 
247
234
  Registry: https://registry.npmjs.org
248
235
 
249
- ? Continue? [Y/n]
236
+ ? Continue? [Y/n]
237
+
238
+ Preparing packages for publish...
250
239
 
251
240
  Publishing packages...
252
241
 
253
- Publishing pubz@0.2.3...
254
- npm notice
255
- npm notice 📦 pubz@0.2.3
256
- npm notice Tarball Contents
257
- npm notice 717B package.json
258
- npm notice 2.3kB README.md
259
- npm notice 28.7kB dist/cli.js
260
- npm notice Tarball Details
261
- npm notice name: pubz
262
- npm notice version: 0.2.3
263
- npm notice filename: pubz-0.2.3.tgz
264
- npm notice package size: 8.3 kB
265
- npm notice unpacked size: 31.6 kB
266
- npm notice shasum: b8cd25d62b05d5cd6a4ecc8ff6ef6e522e7b2aa5
267
- npm notice integrity: sha512-jihTMvUxMeXNX[...]2+gtHJexETkWA==
268
- npm notice total files: 3
269
- npm notice
270
- + pubz@0.2.3
242
+ Publishing pubz@0.4.0...
243
+ npm notice
244
+ npm notice 📦 pubz@0.4.0
245
+ npm notice === Tarball Contents ===
246
+ npm notice 7.1kB README.md
247
+ npm notice 41.3kB dist/cli.js
248
+ npm notice 697B package.json
249
+ npm notice === Tarball Details ===
250
+ npm notice name: pubz
251
+ npm notice version: 0.4.0
252
+ npm notice filename: pubz-0.4.0.tgz
253
+ npm notice package size: 12.0 kB
254
+ npm notice unpacked size: 49.1 kB
255
+ npm notice shasum: 3026a7936458dcaa84030a0ce2e206b9f74aa65d
256
+ npm notice integrity: sha512-6vKMOsC7sZa87[...]w8KNx1fD45u/A==
257
+ npm notice total files: 3
258
+ npm notice
259
+ npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
260
+ Authenticate your account at:
261
+ https://www.npmjs.com/auth/cli/c47d9bee-2a1e-4adf-9aab-63d15acfade2
262
+ Press ENTER to open in the browser...
263
+
264
+ + pubz@0.4.0
271
265
  pubz published successfully
272
266
 
273
267
  ══════════════════════════════
274
268
  Publishing complete!
275
269
 
276
- Published version: 0.2.3
277
-
278
- ? Create a git tag for v0.2.3? [Y/n]
279
-
280
- Tag v0.2.3 created
281
- ? Push tag to origin? [Y/n]
270
+ Published version: 0.4.0
271
+
272
+ Changes since v0.2.12:
273
+ 5553c95 Fix ENTER to open browser not working.
274
+ 9aaddff Fix tag/push/release branch when using --yes.
275
+ 0ce3ab8 Generate changlog and attach it to release page / print it out during publish.
276
+ 5a29ca4 Merge branch 'main' of github.com:mm-zacharydavison/pubz
277
+ b4c47fc Clean up README.md formatting
278
+ 2da403c Update README.md
279
+ 88a4211 Update README with image and usage instructions
280
+ 8a8148a Update README.md
281
+ 2b45d21 Transform 'workspace:' definitions on publish, and restore them before any commit.
282
+
283
+ ? Create a git tag for v0.4.0? [Y/n]
284
+
285
+ Tag v0.4.0 created
286
+ ? Push tag to origin? [Y/n]
287
+ remote: This repository moved. Please use the new location:
288
+ remote: git@github.com:zdavison/pubz.git
282
289
  To github.com:mm-zacharydavison/pubz.git
283
- * [new tag] v0.2.3 -> v0.2.3
284
- Tag v0.2.3 pushed to origin
290
+ * [new tag] v0.4.0 -> v0.4.0
291
+ Tag v0.4.0 pushed to origin
292
+ ? Create a GitHub release? [Y/n]
293
+ Release created: https://github.com/zdavison/pubz/releases/tag/v0.4.0
285
294
 
286
295
  Done!
287
296
  ```
package/dist/cli.js CHANGED
@@ -638,7 +638,11 @@ function formatChangelogMarkdown(commits, repoUrl) {
638
638
  }).join(`
639
639
  `);
640
640
  }
641
+ async function fetchTags(cwd) {
642
+ await runSilent("git", ["fetch", "--tags"], cwd);
643
+ }
641
644
  async function generateChangelog(cwd) {
645
+ await fetchTags(cwd);
642
646
  const [previousTag, repoUrl] = await Promise.all([
643
647
  getPreviousTag(cwd),
644
648
  getRepoUrl(cwd)
@@ -738,6 +742,9 @@ async function restoreWorkspaceProtocol(transforms) {
738
742
  console.log(` Restored workspace references in ${byPath.size} package(s)`);
739
743
  }
740
744
  }
745
+ function isValidVersion(version) {
746
+ return /^\d+\.\d+\.\d+(-.+)?$/.test(version);
747
+ }
741
748
  function bumpVersion(version, type) {
742
749
  if (type === "none")
743
750
  return version;
@@ -988,7 +995,13 @@ async function main() {
988
995
  newVersion = bumpVersion(currentVersion, options.version);
989
996
  console.log(`Bumping version (${options.version}): ${yellow(currentVersion)} → ${green(newVersion)}`);
990
997
  } else {
991
- newVersion = options.version;
998
+ const cleaned = options.version.startsWith("v") ? options.version.slice(1) : options.version;
999
+ if (!isValidVersion(cleaned)) {
1000
+ console.error(red(bold("Error:")) + ` Invalid version "${options.version}". Expected format: major.minor.patch (e.g. 1.2.3, 1.2.3-beta)`);
1001
+ closePrompt();
1002
+ process.exit(1);
1003
+ }
1004
+ newVersion = cleaned;
992
1005
  console.log(`Using explicit version: ${green(newVersion)}`);
993
1006
  }
994
1007
  console.log("");
@@ -1011,7 +1024,7 @@ async function main() {
1011
1024
  } else if (!skipAllPrompts) {
1012
1025
  const shouldBump = skipConfirms || await confirm("Bump version before publishing?");
1013
1026
  if (shouldBump) {
1014
- const bumpType = await select("Select version bump type:", [
1027
+ const bumpChoice = await select("Select version bump type:", [
1015
1028
  {
1016
1029
  label: `patch (${previewBump(currentVersion, "patch")})`,
1017
1030
  value: "patch"
@@ -1023,9 +1036,27 @@ async function main() {
1023
1036
  {
1024
1037
  label: `major (${previewBump(currentVersion, "major")})`,
1025
1038
  value: "major"
1039
+ },
1040
+ {
1041
+ label: "custom version",
1042
+ value: "custom"
1026
1043
  }
1027
1044
  ]);
1028
- newVersion = bumpVersion(currentVersion, bumpType);
1045
+ if (bumpChoice === "custom") {
1046
+ let customVersion = "";
1047
+ while (!customVersion) {
1048
+ const input = await prompt(` Enter version: `);
1049
+ const cleaned = input.startsWith("v") ? input.slice(1) : input;
1050
+ if (isValidVersion(cleaned)) {
1051
+ customVersion = cleaned;
1052
+ } else {
1053
+ console.log(yellow(" Invalid version. Expected format: major.minor.patch (e.g. 1.2.3, 1.2.3-beta)"));
1054
+ }
1055
+ }
1056
+ newVersion = customVersion;
1057
+ } else {
1058
+ newVersion = bumpVersion(currentVersion, bumpChoice);
1059
+ }
1029
1060
  console.log("");
1030
1061
  console.log(`Updating version to ${green(newVersion)} in all packages...`);
1031
1062
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubz",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Interactive CLI for publishing npm packages (single or monorepo)",
5
5
  "type": "module",
6
6
  "bin": {