imdone-core 2.1.2 → 2.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.
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm test:*)",
5
+ "Bash(node test-debug.js:*)",
6
+ "Bash(cat:*)",
7
+ "Bash(node test-ignore-patterns.js:*)",
8
+ "Bash(node test-ignore-patterns-detailed.js:*)",
9
+ "Bash(node test-ignore-patterns-fixed.js:*)"
10
+ ]
11
+ }
12
+ }
@@ -0,0 +1,2 @@
1
+ backlogDir: backlog
2
+ provider: jira
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.1.3
2
+
3
+ - Update imdone-api dependency
4
+ - Fix Plugin unimplemented logging to only log in devMode
5
+ - Fix plugins not loading in imdone-cli
6
+
1
7
  ## 2.0.21
2
8
  - Make sure all project properties are available after init
3
9
 
package/_index.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # imdone-core
2
2
 
3
+ - [:file_folder: **backlog**](backlog/README)
3
4
  - [:file_folder: **docs**](docs/README)
4
5
  - [:file_folder: **notes**](notes/_index.md)
5
6
  - [CHANGELOG](CHANGELOG.md)
@@ -1,4 +1,3 @@
1
- import fetch from 'node-fetch';
2
1
  import AdmZip from 'adm-zip';
3
2
  import { cp, rm } from './file-gateway.js'
4
3
  import path from 'node:path'
@@ -52,4 +51,4 @@ function normalize(string) {
52
51
  name,
53
52
  branch
54
53
  };
55
- }
54
+ }
@@ -151,7 +151,7 @@ export class PluginManager extends Emitter {
151
151
 
152
152
  async loadPlugin(path) {
153
153
  logger.log('Loading plugin: ', path)
154
- const fullPath = path.endsWith('.js')
154
+ let fullPath = path.endsWith('.js')
155
155
  ? _path.resolve(path)
156
156
  : _path.join(_path.resolve(path), 'bundle.js')
157
157
 
@@ -159,10 +159,25 @@ export class PluginManager extends Emitter {
159
159
  // eslint-disable-next-line
160
160
  delete require.cache[require.resolve(fullPath)]
161
161
  // eslint-disable-next-line
162
- const pluginClass = await import(_path.resolve(path))
162
+ const pluginClass = await import(fullPath)
163
163
  const pluginInstance = await this.createPlugin(pluginClass.default, path)
164
164
  return pluginInstance
165
165
  } catch (e) {
166
+ // If bundle.js failed and path is a directory, try to use package.json main field
167
+ if (!path.endsWith('.js') && e.code === 'ERR_UNSUPPORTED_DIR_IMPORT') {
168
+ try {
169
+ const packageInfo = await this.getPackageInfo(path)
170
+ if (packageInfo.default.main) {
171
+ fullPath = _path.join(_path.resolve(path), packageInfo.default.main)
172
+ logger.log(`Trying package.json main: ${fullPath}`)
173
+ const pluginClass = await import(fullPath)
174
+ const pluginInstance = await this.createPlugin(pluginClass.default, path)
175
+ return pluginInstance
176
+ }
177
+ } catch (packageError) {
178
+ logger.error(`Error loading package.json or main file for plugin at: ${path}`, packageError)
179
+ }
180
+ }
166
181
  logger.error(`Error loading plugin at: ${path}`, e)
167
182
  }
168
183
  }
@@ -171,7 +186,7 @@ export class PluginManager extends Emitter {
171
186
  if (!path) return {}
172
187
  let info = { path }
173
188
  const packagePath = _path.join(path, 'package.json')
174
- const packageInfo = await import(packagePath)
189
+ const packageInfo = await import(packagePath, {with: { type: 'json' } })
175
190
  try {
176
191
  info = {...info, ...packageInfo }
177
192
  delete info.dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "imdone-core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,7 +58,7 @@
58
58
  "find-up-simple": "^1.0.1",
59
59
  "gray-matter": "^4.0.2",
60
60
  "ignore": "^5.2.0",
61
- "imdone-api": "^2.0.1",
61
+ "imdone-api": "^2.0.4",
62
62
  "isbinaryfile": "^5.0.4",
63
63
  "js-yaml": "^3.14.1",
64
64
  "json-fns": "^1.0.0",
@@ -86,7 +86,6 @@
86
86
  "moment": "^2.29.1",
87
87
  "monquery": "github:imdone/node-monquery#0.2.1",
88
88
  "multilang-extract-comments": "^0.4.0",
89
- "node-fetch": "^3.3.2",
90
89
  "open": "^9.1.0",
91
90
  "ora": "^8.2.0",
92
91
  "parse-code-context": "^1.0.0",