@tego/core 1.3.55-alpha.0 → 1.6.0-alpha.1
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/application.js +1 -1
- package/lib/commands/start.js +1 -1
- package/lib/plugin-manager/deps.js +1 -1
- package/lib/plugin-manager/plugin-manager.js +18 -1
- package/lib/plugin.js +50 -2
- package/package.json +13 -13
package/lib/application.js
CHANGED
|
@@ -547,7 +547,7 @@ const _Application = class _Application extends import_node_stream.EventEmitter
|
|
|
547
547
|
this._started = true;
|
|
548
548
|
if (options.checkInstall && !await this.isInstalled()) {
|
|
549
549
|
throw new import_application_not_install.ApplicationNotInstall(
|
|
550
|
-
`Application ${this.name} is not installed, Please run 'pnpm
|
|
550
|
+
`Application ${this.name} is not installed, Please run 'pnpm tego install' command first`
|
|
551
551
|
);
|
|
552
552
|
}
|
|
553
553
|
this.setMaintainingMessage("starting app...");
|
package/lib/commands/start.js
CHANGED
|
@@ -59,7 +59,7 @@ var start_default = /* @__PURE__ */ __name((app) => {
|
|
|
59
59
|
if (!await app.isInstalled()) {
|
|
60
60
|
app["_started"] = true;
|
|
61
61
|
throw new import_application_not_install.ApplicationNotInstall(
|
|
62
|
-
`Application ${app.name} is not installed, Please run 'pnpm
|
|
62
|
+
`Application ${app.name} is not installed, Please run 'pnpm tego install' command first`
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
await app.load();
|
|
@@ -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
|
@@ -185,14 +185,62 @@ const _Plugin = class _Plugin {
|
|
|
185
185
|
*/
|
|
186
186
|
async loadCollections() {
|
|
187
187
|
if (!this.options.packageName) {
|
|
188
|
+
if (this.getName() === "tachybase") {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.app.logger.warn(
|
|
192
|
+
`[Plugin.loadCollections] packageName not set for plugin ${this.getName()}, skipping loadCollections`,
|
|
193
|
+
{
|
|
194
|
+
submodule: "Plugin",
|
|
195
|
+
method: "loadCollections"
|
|
196
|
+
}
|
|
197
|
+
);
|
|
188
198
|
return;
|
|
189
199
|
}
|
|
190
|
-
const
|
|
191
|
-
|
|
200
|
+
const resolvedPath = (0, import_helper.resolveRequest)(this.options.packageName);
|
|
201
|
+
const possiblePaths = [
|
|
202
|
+
(0, import_node_path.resolve)(resolvedPath, "../server/collections"),
|
|
203
|
+
// src/index.ts -> src/server/collections
|
|
204
|
+
(0, import_node_path.resolve)(resolvedPath, "../../server/collections"),
|
|
205
|
+
// dist/index.js -> dist/../server/collections
|
|
206
|
+
(0, import_node_path.resolve)(resolvedPath, "../../src/server/collections")
|
|
207
|
+
// dist/index.js -> dist/../src/server/collections
|
|
208
|
+
];
|
|
209
|
+
let directory = null;
|
|
210
|
+
for (const path of possiblePaths) {
|
|
211
|
+
if (await (0, import_utils.fsExists)(path)) {
|
|
212
|
+
directory = path;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
this.app.logger.debug(`[Plugin.loadCollections] Loading collections for ${this.getName()}`, {
|
|
217
|
+
submodule: "Plugin",
|
|
218
|
+
method: "loadCollections",
|
|
219
|
+
packageName: this.options.packageName,
|
|
220
|
+
resolvedPath,
|
|
221
|
+
collectionsDirectory: directory,
|
|
222
|
+
directoryExists: !!directory,
|
|
223
|
+
triedPaths: possiblePaths
|
|
224
|
+
});
|
|
225
|
+
if (directory) {
|
|
192
226
|
await this.db.import({
|
|
193
227
|
directory,
|
|
194
228
|
from: this.options.packageName
|
|
195
229
|
});
|
|
230
|
+
this.app.logger.debug(`[Plugin.loadCollections] Successfully imported collections from ${directory}`, {
|
|
231
|
+
submodule: "Plugin",
|
|
232
|
+
method: "loadCollections"
|
|
233
|
+
});
|
|
234
|
+
} else {
|
|
235
|
+
this.app.logger.warn(
|
|
236
|
+
`[Plugin.loadCollections] Collections directory for ${this.options.packageName} not found, skipping import. Notice this may a mistake.`,
|
|
237
|
+
{
|
|
238
|
+
submodule: "Plugin",
|
|
239
|
+
method: "loadCollections",
|
|
240
|
+
packageName: this.options.packageName,
|
|
241
|
+
resolvedPath
|
|
242
|
+
}
|
|
243
|
+
);
|
|
196
244
|
}
|
|
197
245
|
}
|
|
198
246
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tego/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-alpha.1",
|
|
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/acl": "1.
|
|
35
|
-
"@tachybase/actions": "1.
|
|
36
|
-
"@tachybase/
|
|
37
|
-
"@tachybase/data-source": "1.
|
|
38
|
-
"@tachybase/
|
|
39
|
-
"@tachybase/
|
|
40
|
-
"@tachybase/
|
|
41
|
-
"@tachybase/
|
|
42
|
-
"@tachybase/logger": "1.
|
|
43
|
-
"@tachybase/
|
|
44
|
-
"@tachybase/resourcer": "1.
|
|
45
|
-
"@tachybase/
|
|
34
|
+
"@tachybase/acl": "1.6.0-alpha.1",
|
|
35
|
+
"@tachybase/actions": "1.6.0-alpha.1",
|
|
36
|
+
"@tachybase/auth": "1.6.0-alpha.1",
|
|
37
|
+
"@tachybase/data-source": "1.6.0-alpha.1",
|
|
38
|
+
"@tachybase/database": "1.6.0-alpha.1",
|
|
39
|
+
"@tachybase/cache": "1.6.0-alpha.1",
|
|
40
|
+
"@tachybase/globals": "1.6.0-alpha.1",
|
|
41
|
+
"@tachybase/di": "1.6.0-alpha.1",
|
|
42
|
+
"@tachybase/logger": "1.6.0-alpha.1",
|
|
43
|
+
"@tachybase/loader": "1.6.0-alpha.1",
|
|
44
|
+
"@tachybase/resourcer": "1.6.0-alpha.1",
|
|
45
|
+
"@tachybase/utils": "1.6.0-alpha.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/fs-extra": "11.0.4",
|