@kaluchi/jdtbridge 1.1.1 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaluchi/jdtbridge",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "CLI for Eclipse JDT Bridge — semantic Java analysis via Eclipse JDT SearchEngine",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -32,6 +32,9 @@ import {
32
32
  import { setup, help as setupHelp } from "./commands/setup.mjs";
33
33
  import { isConnectionError } from "./client.mjs";
34
34
  import { bold, red, dim } from "./color.mjs";
35
+ import { createRequire } from "node:module";
36
+
37
+ const { version } = createRequire(import.meta.url)("../package.json");
35
38
 
36
39
  const commands = {
37
40
  projects: { fn: projects, help: projectsHelp },
@@ -135,6 +138,11 @@ export async function run(argv) {
135
138
  return;
136
139
  }
137
140
 
141
+ if (command === "--version" || command === "-v") {
142
+ console.log(version);
143
+ return;
144
+ }
145
+
138
146
  if (command === "help") {
139
147
  const topic = rest[0];
140
148
  const resolved = topic ? resolve(topic) : null;
@@ -9,6 +9,9 @@ import { readConfig, writeConfig } from "../home.mjs";
9
9
  import { discoverInstances } from "../discovery.mjs";
10
10
  import { green, red, bold, dim } from "../color.mjs";
11
11
  import { parseFlags } from "../args.mjs";
12
+ import { createRequire } from "node:module";
13
+
14
+ const { version: cliVersion } = createRequire(import.meta.url)("../../package.json");
12
15
  import {
13
16
  eclipseExe,
14
17
  isEclipseRunning,
@@ -79,6 +82,7 @@ function checkMaven() {
79
82
 
80
83
  function showPrereqs() {
81
84
  console.log(bold("Prerequisites"));
85
+ ok(`CLI ${cliVersion}`);
82
86
  const checks = [checkNode(), checkJava(), checkMaven()];
83
87
  for (const c of checks) (c.ok ? ok : fail)(c.label);
84
88
  return checks.every((c) => c.ok);