bob-core 0.6.1 → 0.6.3

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.
@@ -33,7 +33,7 @@ const CommandNotFoundError_1 = require("./errors/CommandNotFoundError");
33
33
  class CommandRegistry {
34
34
  commands = {};
35
35
  get commandSuffix() {
36
- return "Command.ts";
36
+ return "Command";
37
37
  }
38
38
  constructor() { }
39
39
  getAvailableCommands() {
@@ -43,9 +43,15 @@ class CommandRegistry {
43
43
  return Object.values(this.commands);
44
44
  }
45
45
  commandResolver = async (path) => {
46
- let CommandClass;
47
- CommandClass = (await import(path)).default;
48
- return new CommandClass();
46
+ const CommandClass = (await import(path)).default;
47
+ let command;
48
+ if (CommandClass?.default) {
49
+ command = new CommandClass.default();
50
+ }
51
+ else {
52
+ command = new CommandClass();
53
+ }
54
+ return command;
49
55
  };
50
56
  setCommandResolver(resolver) {
51
57
  this.commandResolver = resolver;
@@ -86,7 +92,7 @@ class CommandRegistry {
86
92
  yield* this.listCommandsFiles(path_1.default.resolve(basePath, dirent.name));
87
93
  }
88
94
  else {
89
- if (!direntPath.endsWith(this.commandSuffix)) {
95
+ if (!direntPath.endsWith(`${this.commandSuffix}.ts`) && !direntPath.endsWith(`${this.commandSuffix}.js`)) {
90
96
  continue;
91
97
  }
92
98
  yield direntPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bob-core",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "BOB Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",