heyio 0.1.2 → 0.1.4

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/update.js +12 -8
  2. package/package.json +1 -1
package/dist/update.js CHANGED
@@ -1,19 +1,23 @@
1
1
  import { execSync } from "child_process";
2
2
  import { readFileSync } from "fs";
3
- import { createRequire } from "module";
3
+ import { fileURLToPath } from "url";
4
+ import { dirname, join } from "path";
4
5
  const PACKAGE_NAME = "heyio";
5
6
  function getInstalledVersion() {
6
7
  try {
7
- const require = createRequire(import.meta.url);
8
- const pkgPath = require.resolve(`${PACKAGE_NAME}/package.json`);
9
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
10
- return pkg.version ?? "0.0.0";
8
+ // Ask npm what version is installed globally — completely reliable
9
+ const output = execSync(`npm list -g ${PACKAGE_NAME} --depth=0 --json 2>/dev/null`, {
10
+ encoding: "utf-8",
11
+ timeout: 10_000,
12
+ });
13
+ const data = JSON.parse(output);
14
+ return data.dependencies?.[PACKAGE_NAME]?.version ?? "0.0.0";
11
15
  }
12
16
  catch {
13
- // Fallback: read our own package.json
17
+ // Fallback: read package.json relative to this file
14
18
  try {
15
- const require = createRequire(import.meta.url);
16
- const pkgPath = require.resolve("../package.json");
19
+ const __dirname = dirname(fileURLToPath(import.meta.url));
20
+ const pkgPath = join(__dirname, "..", "package.json");
17
21
  const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
18
22
  return pkg.version ?? "0.0.0";
19
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyio",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "IO — a personal AI assistant built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "io": "dist/index.js"