pubz 0.2.4 → 0.2.5

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 (2) hide show
  1. package/dist/cli.js +19 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2,6 +2,11 @@
2
2
  import { createRequire } from "node:module";
3
3
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
4
 
5
+ // src/cli.ts
6
+ import { readFileSync } from "node:fs";
7
+ import { dirname, join as join4 } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+
5
10
  // src/colors.ts
6
11
  var isColorSupported = process.env.FORCE_COLOR !== "0" && (process.env.FORCE_COLOR !== undefined || process.stdout.isTTY && process.env.TERM !== "dumb");
7
12
  var fmt = (open, close) => {
@@ -528,11 +533,20 @@ var REGISTRIES = {
528
533
  npm: "https://registry.npmjs.org",
529
534
  github: "https://npm.pkg.github.com"
530
535
  };
536
+ function getVersion() {
537
+ const __dirname2 = dirname(fileURLToPath(import.meta.url));
538
+ const pkgPath = join4(__dirname2, "..", "package.json");
539
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
540
+ return pkg.version;
541
+ }
531
542
  function printUsage() {
532
543
  console.log(`
533
544
  pubz - Interactive npm package publisher
534
545
 
535
- Usage: pubz [options]
546
+ Usage: pubz [command] [options]
547
+
548
+ Commands:
549
+ version Show version number
536
550
 
537
551
  Options:
538
552
  --dry-run Show what would be published without actually publishing
@@ -597,6 +611,10 @@ function parseArgs(args) {
597
611
  return options;
598
612
  }
599
613
  async function main() {
614
+ if (process.argv[2] === "version") {
615
+ console.log(getVersion());
616
+ process.exit(0);
617
+ }
600
618
  const options = parseArgs(process.argv.slice(2));
601
619
  if (options.help) {
602
620
  printUsage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubz",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Interactive CLI for publishing npm packages (single or monorepo)",
5
5
  "type": "module",
6
6
  "bin": {