heyio 0.1.1 → 0.1.2

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 +23 -2
  2. package/package.json +1 -1
package/dist/update.js CHANGED
@@ -1,9 +1,30 @@
1
1
  import { execSync } from "child_process";
2
+ import { readFileSync } from "fs";
3
+ import { createRequire } from "module";
2
4
  const PACKAGE_NAME = "heyio";
5
+ function getInstalledVersion() {
6
+ 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";
11
+ }
12
+ catch {
13
+ // Fallback: read our own package.json
14
+ try {
15
+ const require = createRequire(import.meta.url);
16
+ const pkgPath = require.resolve("../package.json");
17
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
18
+ return pkg.version ?? "0.0.0";
19
+ }
20
+ catch {
21
+ return "0.0.0";
22
+ }
23
+ }
24
+ }
3
25
  export async function checkForUpdate() {
4
26
  try {
5
- const packageJson = await import("../package.json", { with: { type: "json" } }).catch(() => null);
6
- const current = packageJson?.default?.version ?? "0.0.0";
27
+ const current = getInstalledVersion();
7
28
  const latest = execSync(`npm view ${PACKAGE_NAME} version 2>/dev/null`, {
8
29
  encoding: "utf-8",
9
30
  timeout: 10_000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyio",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "IO — a personal AI assistant built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "io": "dist/index.js"