@tego/core 1.3.54-alpha.4 → 1.3.54-alpha.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.
- package/lib/plugin-manager/plugin-manager.js +18 -1
- package/lib/plugin.js +27 -9
- package/package.json +13 -13
|
@@ -400,6 +400,24 @@ const _PluginManager = class _PluginManager {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
current = 0;
|
|
403
|
+
for (const [P, plugin] of this.getPlugins()) {
|
|
404
|
+
if (plugin.state.loaded) {
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
const name = plugin.name || P.name;
|
|
408
|
+
current += 1;
|
|
409
|
+
this.app.setMaintainingMessage(`loading collections for plugin [${name}], ${current}/${total}`);
|
|
410
|
+
if (!plugin.enabled) {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
this.app.logger.debug(`load collections for plugin [${name}]`, {
|
|
414
|
+
submodule: "plugin-manager",
|
|
415
|
+
method: "load",
|
|
416
|
+
name
|
|
417
|
+
});
|
|
418
|
+
await plugin.loadCollections();
|
|
419
|
+
}
|
|
420
|
+
current = 0;
|
|
403
421
|
for (const [P, plugin] of this.getPlugins()) {
|
|
404
422
|
if (plugin.state.loaded) {
|
|
405
423
|
continue;
|
|
@@ -412,7 +430,6 @@ const _PluginManager = class _PluginManager {
|
|
|
412
430
|
}
|
|
413
431
|
await this.app.emitAsync("beforeLoadPlugin", plugin, options);
|
|
414
432
|
this.app.logger.debug(`load plugin [${name}] `, { submodule: "plugin-manager", method: "load", name });
|
|
415
|
-
await plugin.loadCollections();
|
|
416
433
|
await plugin.load();
|
|
417
434
|
plugin.state.loaded = true;
|
|
418
435
|
await this.app.emitAsync("afterLoadPlugin", plugin, options);
|
package/lib/plugin.js
CHANGED
|
@@ -192,16 +192,31 @@ const _Plugin = class _Plugin {
|
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
const resolvedPath = (0, import_helper.resolveRequest)(this.options.packageName);
|
|
195
|
-
const
|
|
195
|
+
const possiblePaths = [
|
|
196
|
+
(0, import_node_path.resolve)(resolvedPath, "../server/collections"),
|
|
197
|
+
// src/index.ts -> src/server/collections
|
|
198
|
+
(0, import_node_path.resolve)(resolvedPath, "../../server/collections"),
|
|
199
|
+
// dist/index.js -> dist/../server/collections
|
|
200
|
+
(0, import_node_path.resolve)(resolvedPath, "../../src/server/collections")
|
|
201
|
+
// dist/index.js -> dist/../src/server/collections
|
|
202
|
+
];
|
|
203
|
+
let directory = null;
|
|
204
|
+
for (const path of possiblePaths) {
|
|
205
|
+
if (await (0, import_utils.fsExists)(path)) {
|
|
206
|
+
directory = path;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
196
210
|
this.app.logger.debug(`[Plugin.loadCollections] Loading collections for ${this.getName()}`, {
|
|
197
211
|
submodule: "Plugin",
|
|
198
212
|
method: "loadCollections",
|
|
199
213
|
packageName: this.options.packageName,
|
|
200
214
|
resolvedPath,
|
|
201
215
|
collectionsDirectory: directory,
|
|
202
|
-
directoryExists:
|
|
216
|
+
directoryExists: !!directory,
|
|
217
|
+
triedPaths: possiblePaths
|
|
203
218
|
});
|
|
204
|
-
if (
|
|
219
|
+
if (directory) {
|
|
205
220
|
await this.db.import({
|
|
206
221
|
directory,
|
|
207
222
|
from: this.options.packageName
|
|
@@ -211,12 +226,15 @@ const _Plugin = class _Plugin {
|
|
|
211
226
|
method: "loadCollections"
|
|
212
227
|
});
|
|
213
228
|
} else {
|
|
214
|
-
this.app.logger.warn(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
229
|
+
this.app.logger.warn(
|
|
230
|
+
`[Plugin.loadCollections] Collections directory not found. Tried paths: ${possiblePaths.join(", ")}`,
|
|
231
|
+
{
|
|
232
|
+
submodule: "Plugin",
|
|
233
|
+
method: "loadCollections",
|
|
234
|
+
packageName: this.options.packageName,
|
|
235
|
+
resolvedPath
|
|
236
|
+
}
|
|
237
|
+
);
|
|
220
238
|
}
|
|
221
239
|
}
|
|
222
240
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tego/core",
|
|
3
|
-
"version": "1.3.54-alpha.
|
|
3
|
+
"version": "1.3.54-alpha.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"winston": "^3.17.0",
|
|
32
32
|
"ws": "^8.18.3",
|
|
33
33
|
"xpipe": "^1.0.8",
|
|
34
|
-
"@tachybase/
|
|
35
|
-
"@tachybase/
|
|
36
|
-
"@tachybase/
|
|
37
|
-
"@tachybase/cache": "1.3.54-alpha.
|
|
38
|
-
"@tachybase/database": "1.3.54-alpha.
|
|
39
|
-
"@tachybase/data-source": "1.3.54-alpha.
|
|
40
|
-
"@tachybase/
|
|
41
|
-
"@tachybase/loader": "1.3.54-alpha.
|
|
42
|
-
"@tachybase/
|
|
43
|
-
"@tachybase/
|
|
44
|
-
"@tachybase/
|
|
45
|
-
"@tachybase/resourcer": "1.3.54-alpha.
|
|
34
|
+
"@tachybase/auth": "1.3.54-alpha.6",
|
|
35
|
+
"@tachybase/acl": "1.3.54-alpha.6",
|
|
36
|
+
"@tachybase/actions": "1.3.54-alpha.6",
|
|
37
|
+
"@tachybase/cache": "1.3.54-alpha.6",
|
|
38
|
+
"@tachybase/database": "1.3.54-alpha.6",
|
|
39
|
+
"@tachybase/data-source": "1.3.54-alpha.6",
|
|
40
|
+
"@tachybase/di": "1.3.54-alpha.6",
|
|
41
|
+
"@tachybase/loader": "1.3.54-alpha.6",
|
|
42
|
+
"@tachybase/logger": "1.3.54-alpha.6",
|
|
43
|
+
"@tachybase/utils": "1.3.54-alpha.6",
|
|
44
|
+
"@tachybase/globals": "1.3.54-alpha.6",
|
|
45
|
+
"@tachybase/resourcer": "1.3.54-alpha.6"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/fs-extra": "11.0.4",
|