@mantiq/cli 0.1.3 → 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/package.json +1 -1
  2. package/src/Kernel.ts +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantiq/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Command runner, code generators, dev server",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/Kernel.ts CHANGED
@@ -37,8 +37,14 @@ export class Kernel {
37
37
  try {
38
38
  const mod = await import(dir + '/' + file)
39
39
  for (const exported of Object.values(mod)) {
40
- if (typeof exported === 'function' && (exported as any).prototype?.name && (exported as any).prototype?.handle) {
41
- this.register(new (exported as any)())
40
+ if (typeof exported !== 'function') continue
41
+ try {
42
+ const instance = new (exported as any)()
43
+ if (instance.name && typeof instance.handle === 'function') {
44
+ this.register(instance)
45
+ }
46
+ } catch {
47
+ // Not instantiable or not a command
42
48
  }
43
49
  }
44
50
  } catch {