isy-nodejs 1.0.1-alpha.16 → 1.0.1-alpha.18

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
@@ -2,7 +2,7 @@
2
2
  "name": "isy-nodejs",
3
3
  "description": "Node.js wrapper for ISY interface including websockets for change notifications. Fork of isy-js by Rod Toll. Designed to be used in a node.js application.",
4
4
  "license": "MIT",
5
- "version": "1.0.1-alpha.16",
5
+ "version": "1.0.1-alpha.18",
6
6
  "author": {
7
7
  "name": "Pradeep Mouli"
8
8
  },
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "b4a88111ae80ba556773857491645f48f15f7f33"
72
+ "gitHead": "98360c70b5fe830599dcbc8fd9c7ad44dcd55085"
73
73
  }
package/src/Utils.ts CHANGED
@@ -276,16 +276,21 @@ function getImportMeta() {
276
276
  return { dirname, filename };
277
277
  }
278
278
  }
279
- export async function findPackageJson(currentPath: string = getImportMeta()?.dirname): Promise<PackageJson> {
279
+ export async function findPackageJson(currentPath: string = './'): Promise<PackageJson> {
280
280
  try {
281
281
  while (currentPath !== '/') {
282
282
  const packageJsonPath = path.join(currentPath, 'package.json');
283
283
  if (existsSync(packageJsonPath)) {
284
- return await import(packageJsonPath);
284
+ try {
285
+ return await import(packageJsonPath);
286
+ } catch {}
285
287
  }
286
288
  currentPath = path.join(currentPath, '..');
287
289
  }
288
- } catch {}
290
+ } catch {
291
+ //@ts-expect-error
292
+ return await import('package.json');
293
+ }
289
294
  return null;
290
295
  }
291
296