imdone-core 2.0.5 → 2.0.6
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Plugin from 'imdone-api'
|
|
2
2
|
import _path from 'path'
|
|
3
3
|
import { exists } from '../adapters/file-gateway.js'
|
|
4
|
-
import { createRequire } from 'node:module';
|
|
4
|
+
// import { createRequire } from 'node:module';
|
|
5
5
|
import { logger } from '../adapters/logger.js';
|
|
6
6
|
import { URL } from 'node:url';
|
|
7
|
-
const require = createRequire(new URL(import.meta.url));
|
|
7
|
+
// const require = createRequire(new URL(import.meta.url));
|
|
8
8
|
|
|
9
9
|
export default class ExtensionPlugin extends Plugin {
|
|
10
10
|
constructor(project) {
|
|
@@ -61,17 +61,17 @@ export default class ExtensionPlugin extends Plugin {
|
|
|
61
61
|
}))
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
getExtensionPath(relativePath) {
|
|
65
65
|
return _path.resolve(_path.join(this.configDir, ...relativePath) + '.js')
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async loadExtensionModule(_default, ...path) {
|
|
69
69
|
let extension = _default
|
|
70
|
-
const extensionPath = this.
|
|
70
|
+
const extensionPath = this.getExtensionPath(path)
|
|
71
71
|
try {
|
|
72
72
|
await exists(extensionPath)
|
|
73
|
-
delete require.cache[extensionPath]
|
|
74
|
-
extension =
|
|
73
|
+
// delete require.cache[extensionPath]
|
|
74
|
+
extension = await import(extensionPath)
|
|
75
75
|
} catch (e) {
|
|
76
76
|
if (e.code === 'ENOENT') {
|
|
77
77
|
logger.log('No extension found at:', extensionPath)
|
|
@@ -7,7 +7,7 @@ import chokidar from 'chokidar'
|
|
|
7
7
|
import debounce from 'lodash.debounce'
|
|
8
8
|
import { exists, mkdir, readdir } from '../adapters/file-gateway.js'
|
|
9
9
|
import { appContext } from '../context/ApplicationContext.js'
|
|
10
|
-
import { createRequire } from 'node:module';
|
|
10
|
+
// import { createRequire } from 'node:module';
|
|
11
11
|
|
|
12
12
|
import PersistTagsPlugin from './persist-tags-plugin.js'
|
|
13
13
|
import DefaultBoardPropertiesPlugin from './default-board-properties-plugin.js'
|
|
@@ -16,9 +16,9 @@ import ArchivePlugin from './archive-plugin.js'
|
|
|
16
16
|
import EpicPlugin from './epic-plugin.js'
|
|
17
17
|
import ExtensionPlugin from './extension-plugin.js'
|
|
18
18
|
import { logger } from '../adapters/logger.js'
|
|
19
|
-
import { URL } from 'node:url'
|
|
19
|
+
// import { URL } from 'node:url'
|
|
20
20
|
|
|
21
|
-
const require = createRequire(new URL(import.meta.url));
|
|
21
|
+
// const require = createRequire(new URL(import.meta.url));
|
|
22
22
|
|
|
23
23
|
export class PluginManager extends Emitter {
|
|
24
24
|
constructor(project) {
|
|
@@ -173,11 +173,13 @@ export class PluginManager extends Emitter {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
getPackageInfo(path) {
|
|
176
|
+
async getPackageInfo(path) {
|
|
177
177
|
if (!path) return {}
|
|
178
178
|
let info = { path }
|
|
179
|
+
const packagePath = _path.join(path, 'package.json')
|
|
180
|
+
const packageInfo = await import(packagePath)
|
|
179
181
|
try {
|
|
180
|
-
info = {...info, ...
|
|
182
|
+
info = {...info, ...packageInfo }
|
|
181
183
|
delete info.dependencies
|
|
182
184
|
delete info.devDependencies
|
|
183
185
|
delete info.scripts
|
|
@@ -192,9 +194,10 @@ export class PluginManager extends Emitter {
|
|
|
192
194
|
throw new Error(`${pluginClass.name} is not a plugin`)
|
|
193
195
|
const name = pluginClass.name.toString()
|
|
194
196
|
const pluginInstance = new pluginClass(this.project)
|
|
197
|
+
const packageInfo = await this.getPackageInfo(path)
|
|
195
198
|
let info = {
|
|
196
199
|
name,
|
|
197
|
-
...
|
|
200
|
+
...packageInfo,
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
pluginInstance.getSettings = () => {
|
package/lib/repository.js
CHANGED
|
@@ -1396,7 +1396,7 @@ export class Repository extends Emitter {
|
|
|
1396
1396
|
// order:-350
|
|
1397
1397
|
// -->
|
|
1398
1398
|
async moveTasks (tasks, newList, newPos = 0, noEmit = false) {
|
|
1399
|
-
const log =
|
|
1399
|
+
const log = debug('moveTasks')
|
|
1400
1400
|
if (this.getList(newList).filter)
|
|
1401
1401
|
throw new Error(`Tasks can\'t be moved to a filtered list ${newList}.`)
|
|
1402
1402
|
|
package/package.json
CHANGED
|
@@ -10,6 +10,6 @@ export default class ExtensionPlugin {
|
|
|
10
10
|
getBoardProperties(): Promise<any>;
|
|
11
11
|
getCardActions(task: any): any;
|
|
12
12
|
getBoardActions(): any;
|
|
13
|
-
|
|
13
|
+
getExtensionPath(relativePath: any): string;
|
|
14
14
|
loadExtensionModule(_default: any, ...path: any[]): Promise<any>;
|
|
15
15
|
}
|
|
@@ -19,7 +19,7 @@ export class PluginManager extends Emitter<[never]> {
|
|
|
19
19
|
loadInstalledPlugins(): Promise<void>;
|
|
20
20
|
loadPluginsNotInstalled(): Promise<void>;
|
|
21
21
|
loadPlugin(path: any): Promise<any>;
|
|
22
|
-
getPackageInfo(path: any): {} | undefined
|
|
22
|
+
getPackageInfo(path: any): Promise<{} | undefined>;
|
|
23
23
|
createPlugin(pluginClass: any, path?: undefined): Promise<any>;
|
|
24
24
|
destroyPlugins(): void;
|
|
25
25
|
isPlugin(pluginClass: any): boolean;
|