@nocobase/server 2.1.0-beta.35 → 2.1.0-beta.36

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.
@@ -155,7 +155,11 @@ const _PluginManager = class _PluginManager {
155
155
  */
156
156
  static async getPackageJson(nameOrPkg) {
157
157
  const { packageName } = await this.parseName(nameOrPkg);
158
- const packageFile = (0, import_path.resolve)(process.env.NODE_MODULES_PATH, packageName, "package.json");
158
+ const nodeModulesPath = String(process.env.NODE_MODULES_PATH ?? "").trim();
159
+ if (!nodeModulesPath) {
160
+ throw new Error("NODE_MODULES_PATH is not configured");
161
+ }
162
+ const packageFile = (0, import_path.resolve)(nodeModulesPath, packageName, "package.json");
159
163
  if (!await import_fs_extra.default.exists(packageFile)) {
160
164
  throw new Error(`Cannot find plugin '${nameOrPkg}'`);
161
165
  }
@@ -297,8 +301,8 @@ const _PluginManager = class _PluginManager {
297
301
  }
298
302
  /* istanbul ignore next -- @preserve */
299
303
  async create(pluginName, options) {
300
- const createPlugin = /* @__PURE__ */ __name(async (name2) => {
301
- const pluginDir = (0, import_path.resolve)(process.cwd(), "packages/plugins", name2);
304
+ const createPlugin = /* @__PURE__ */ __name(async (name) => {
305
+ const pluginDir = (0, import_path.resolve)(process.cwd(), "packages/plugins", name);
302
306
  if (options == null ? void 0 : options.forceRecreate) {
303
307
  await import_fs_extra.default.rm(pluginDir, { recursive: true, force: true });
304
308
  }
@@ -307,21 +311,13 @@ const _PluginManager = class _PluginManager {
307
311
  cwd: process.cwd(),
308
312
  args: {},
309
313
  context: {
310
- name: name2
314
+ name
311
315
  }
312
316
  });
313
317
  await generator.run();
314
318
  }, "createPlugin");
315
319
  await createPlugin(pluginName);
316
320
  this.app.log.info("attempt to add the plugin to the app");
317
- const { name, packageName } = await _PluginManager.parseName(pluginName);
318
- const json = await _PluginManager.getPackageJson(packageName);
319
- this.app.log.info(`add plugin [${packageName}]`, {
320
- name,
321
- packageName,
322
- version: json.version
323
- });
324
- await (0, import_helper.tsxRerunning)();
325
321
  }
326
322
  async addOrThrow(plugin, options = {}, insert = false, isUpgrade = false) {
327
323
  if (!isUpgrade && this.has(plugin)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "2.1.0-beta.35",
3
+ "version": "2.1.0-beta.36",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -10,21 +10,21 @@
10
10
  "@koa/cors": "^5.0.0",
11
11
  "@koa/multer": "^3.1.0",
12
12
  "@koa/router": "^13.1.0",
13
- "@nocobase/acl": "2.1.0-beta.35",
14
- "@nocobase/actions": "2.1.0-beta.35",
15
- "@nocobase/ai": "2.1.0-beta.35",
16
- "@nocobase/auth": "2.1.0-beta.35",
17
- "@nocobase/cache": "2.1.0-beta.35",
18
- "@nocobase/data-source-manager": "2.1.0-beta.35",
19
- "@nocobase/database": "2.1.0-beta.35",
20
- "@nocobase/evaluators": "2.1.0-beta.35",
21
- "@nocobase/lock-manager": "2.1.0-beta.35",
22
- "@nocobase/logger": "2.1.0-beta.35",
23
- "@nocobase/resourcer": "2.1.0-beta.35",
24
- "@nocobase/sdk": "2.1.0-beta.35",
25
- "@nocobase/snowflake-id": "2.1.0-beta.35",
26
- "@nocobase/telemetry": "2.1.0-beta.35",
27
- "@nocobase/utils": "2.1.0-beta.35",
13
+ "@nocobase/acl": "2.1.0-beta.36",
14
+ "@nocobase/actions": "2.1.0-beta.36",
15
+ "@nocobase/ai": "2.1.0-beta.36",
16
+ "@nocobase/auth": "2.1.0-beta.36",
17
+ "@nocobase/cache": "2.1.0-beta.36",
18
+ "@nocobase/data-source-manager": "2.1.0-beta.36",
19
+ "@nocobase/database": "2.1.0-beta.36",
20
+ "@nocobase/evaluators": "2.1.0-beta.36",
21
+ "@nocobase/lock-manager": "2.1.0-beta.36",
22
+ "@nocobase/logger": "2.1.0-beta.36",
23
+ "@nocobase/resourcer": "2.1.0-beta.36",
24
+ "@nocobase/sdk": "2.1.0-beta.36",
25
+ "@nocobase/snowflake-id": "2.1.0-beta.36",
26
+ "@nocobase/telemetry": "2.1.0-beta.36",
27
+ "@nocobase/utils": "2.1.0-beta.36",
28
28
  "@types/decompress": "4.2.7",
29
29
  "@types/ini": "^1.3.31",
30
30
  "@types/koa-send": "^4.1.3",
@@ -61,5 +61,5 @@
61
61
  "@types/serve-handler": "^6.1.1",
62
62
  "@types/ws": "^8.5.5"
63
63
  },
64
- "gitHead": "74310d8b9e9581fcde14b5a93d12b41ddb5bb325"
64
+ "gitHead": "397d45c744f6eb48b3a0cd785c87cbf1257c3513"
65
65
  }