@nocobase/plugin-license 2.1.0-beta.33 → 2.1.0-beta.35

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.
@@ -9,17 +9,17 @@
9
9
 
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
- "@nocobase/client": "2.1.0-beta.33",
12
+ "@nocobase/client": "2.1.0-beta.35",
13
13
  "antd": "5.24.2",
14
14
  "ahooks": "3.7.8",
15
15
  "@ant-design/icons": "5.6.1",
16
16
  "@formily/react": "2.3.7",
17
17
  "@nocobase/license-kit": "0.3.8",
18
18
  "react-i18next": "11.18.6",
19
- "@nocobase/server": "2.1.0-beta.33",
19
+ "@nocobase/server": "2.1.0-beta.35",
20
20
  "lodash": "4.18.1",
21
- "@nocobase/utils": "2.1.0-beta.33",
21
+ "@nocobase/utils": "2.1.0-beta.35",
22
22
  "koa": "3.2.0",
23
23
  "axios": "1.7.7",
24
- "@nocobase/logger": "2.1.0-beta.33"
24
+ "@nocobase/logger": "2.1.0-beta.35"
25
25
  };
@@ -7,5 +7,5 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  export declare function getInstanceId(): Promise<string>;
10
- export declare function createInstanceId(force?: boolean): Promise<unknown>;
10
+ export declare function createInstanceId(force?: boolean): Promise<string>;
11
11
  export declare function isLicenseKeyExists(): Promise<boolean>;
@@ -42,30 +42,35 @@ __export(instance_exports, {
42
42
  });
43
43
  module.exports = __toCommonJS(instance_exports);
44
44
  var import_fs = __toESM(require("fs"));
45
- var import_path = __toESM(require("path"));
46
45
  var import_utils = require("@nocobase/utils");
47
- var import_child_process = require("child_process");
46
+ var import_license_kit = require("@nocobase/license-kit");
48
47
  async function getInstanceId() {
49
- const dir = (0, import_utils.storagePathJoin)(".license");
50
- const filePath = import_path.default.resolve(dir, "instance-id");
48
+ const filePath = (0, import_utils.storagePathJoin)(".license", "instance-id");
51
49
  await createInstanceId(true);
52
- const id = import_fs.default.readFileSync(filePath, "utf-8");
53
- return id;
50
+ const id = await import_fs.default.promises.readFile(filePath, "utf-8");
51
+ return id.trim();
54
52
  }
55
53
  async function createInstanceId(force = false) {
56
- return new Promise((resolve, reject) => {
57
- (0, import_child_process.exec)(`yarn nocobase generate-instance-id ${force ? "--force" : ""}`, (err, stdout, stderr) => {
58
- if (err) {
59
- reject(err);
60
- return;
54
+ const dir = (0, import_utils.storagePathJoin)(".license");
55
+ const filePath = (0, import_utils.storagePathJoin)(".license", "instance-id");
56
+ if (!force) {
57
+ try {
58
+ const existing = await import_fs.default.promises.readFile(filePath, "utf-8");
59
+ const normalized = existing.trim();
60
+ if (normalized) {
61
+ return normalized;
61
62
  }
62
- resolve(stdout);
63
- });
64
- });
63
+ } catch (e) {
64
+ }
65
+ }
66
+ await import_fs.default.promises.mkdir(dir, { recursive: true });
67
+ const instanceId = String(await (0, import_license_kit.getInstanceIdAsync)()).trim();
68
+ await import_fs.default.promises.writeFile(filePath, `${instanceId}
69
+ `);
70
+ return instanceId;
65
71
  }
66
72
  async function isLicenseKeyExists() {
67
- const dir = (0, import_utils.storagePathJoin)(".license");
68
- const filePath = import_path.default.resolve(dir, "license-key");
73
+ const filePath = (0, import_utils.storagePathJoin)(".license", "license-key");
69
74
  return import_fs.default.existsSync(filePath);
70
75
  }
71
76
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-license",
3
- "version": "2.1.0-beta.33",
3
+ "version": "2.1.0-beta.35",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "License settings",
6
6
  "displayName.ru-RU": "Настройки лицензии",
@@ -17,5 +17,5 @@
17
17
  "ts:env": "tsc -p tsconfig.env.json"
18
18
  },
19
19
  "license": "Apache-2.0",
20
- "gitHead": "4815c394e80a264fa8ed619246280923c47aeb72"
20
+ "gitHead": "74310d8b9e9581fcde14b5a93d12b41ddb5bb325"
21
21
  }