@solaqua/gji 0.1.0-beta.2 → 0.1.0-beta.3

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 +8 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { createRequire } from 'node:module';
1
2
  import { Command } from 'commander';
2
3
  import { runCleanCommand } from './clean.js';
3
4
  import { runConfigCommand } from './config-command.js';
@@ -12,14 +13,21 @@ import { runStatusCommand } from './status.js';
12
13
  import { runSyncCommand } from './sync.js';
13
14
  export function createProgram() {
14
15
  const program = new Command();
16
+ const packageVersion = readPackageVersion();
15
17
  program
16
18
  .name('gji')
17
19
  .description('Context switching without the mess.')
20
+ .version(packageVersion)
18
21
  .showHelpAfterError()
19
22
  .showSuggestionAfterError();
20
23
  registerCommands(program);
21
24
  return program;
22
25
  }
26
+ function readPackageVersion() {
27
+ const require = createRequire(import.meta.url);
28
+ const packageJson = require('../package.json');
29
+ return typeof packageJson.version === 'string' ? packageJson.version : '0.0.0';
30
+ }
23
31
  export async function runCli(argv, options = {}) {
24
32
  const program = createProgram();
25
33
  const cwd = options.cwd ?? process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solaqua/gji",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Git worktree CLI for fast context switching.",
5
5
  "license": "MIT",
6
6
  "author": "sjquant",