@nocobase/cli 1.9.0-beta.9 → 2.0.0-alpha.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/cli",
3
- "version": "1.9.0-beta.9",
3
+ "version": "2.0.0-alpha.11",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./src/index.js",
@@ -8,7 +8,7 @@
8
8
  "nocobase": "./bin/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@nocobase/app": "1.9.0-beta.9",
11
+ "@nocobase/app": "2.0.0-alpha.11",
12
12
  "@nocobase/license-kit": "^0.2.17",
13
13
  "@types/fs-extra": "^11.0.1",
14
14
  "@umijs/utils": "3.5.20",
@@ -27,12 +27,12 @@
27
27
  "tsx": "^4.19.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@nocobase/devtools": "1.9.0-beta.9"
30
+ "@nocobase/devtools": "2.0.0-alpha.11"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
34
34
  "url": "git+https://github.com/nocobase/nocobase.git",
35
35
  "directory": "packages/core/cli"
36
36
  },
37
- "gitHead": "b44464f1d1bbc96022d0f622e0a2f1d7e8d7142f"
37
+ "gitHead": "172b05411f66f7024d5294caf2852533569c3796"
38
38
  }
@@ -93,10 +93,18 @@ class Package {
93
93
  if (await fs.exists(file)) {
94
94
  return true;
95
95
  }
96
- file = path.resolve(process.cwd(), 'node_modules', this.packageName, 'package.json');
97
- if (await fs.exists(file)) {
98
- console.log(chalk.yellowBright(`Skipped: ${this.packageName} is in node_modules`));
99
- return true;
96
+ return false;
97
+ }
98
+
99
+ async isDepPackage() {
100
+ const pkg1 = path.resolve(process.cwd(), 'node_modules', this.packageName, 'package.json');
101
+ const pkg2 = path.resolve(process.cwd(), process.env.PLUGIN_STORAGE_PATH, this.packageName, 'package.json');
102
+ if (await fs.exists(pkg1) && await fs.exists(pkg2)) {
103
+ const readPath1 = fs.realpathSync(pkg1);
104
+ const readPath2 = fs.realpathSync(pkg2);
105
+ if (readPath1 !== readPath2) {
106
+ return true;
107
+ }
100
108
  }
101
109
  return false;
102
110
  }
@@ -117,6 +125,10 @@ class Package {
117
125
  console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dev package`));
118
126
  return;
119
127
  }
128
+ if (await this.isDepPackage()) {
129
+ console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dependency package`));
130
+ return;
131
+ }
120
132
  if (await this.isDownloaded(options.version)) {
121
133
  return;
122
134
  }
@@ -54,7 +54,7 @@ function addTestCommand(name, cli) {
54
54
  const first = paths?.[0];
55
55
  if (!process.env.TEST_ENV && first) {
56
56
  const key = first.split(path.sep).join('/');
57
- if (key.includes('/client/')) {
57
+ if (key.includes('/client/') || key.includes('/flow-engine/')) {
58
58
  process.env.TEST_ENV = 'client-side';
59
59
  } else {
60
60
  process.env.TEST_ENV = 'server-side';
@@ -22,8 +22,8 @@
22
22
  "cytoscape": "3.28.0",
23
23
  "@types/react": "18.3.18",
24
24
  "@types/react-dom": "^18.0.0",
25
- "react-router-dom": "6.28.1",
26
- "react-router": "6.28.1",
25
+ "react-router-dom": "^6.30.1",
26
+ "react-router": "^6.30.1",
27
27
  "async": "^3.2.6",
28
28
  "antd": "5.12.8",
29
29
  "rollup": "4.24.0",
@@ -1,21 +1 @@
1
- import { Plugin } from '@nocobase/client';
2
-
3
- export class {{{pascalCaseName}}}Client extends Plugin {
4
- async afterAdd() {
5
- // await this.app.pm.add()
6
- }
7
-
8
- async beforeLoad() {}
9
-
10
- // You can get and modify the app instance here
11
- async load() {
12
- console.log(this.app);
13
- // this.app.addComponents({})
14
- // this.app.addScopes({})
15
- // this.app.addProvider()
16
- // this.app.addProviders()
17
- // this.app.router.add()
18
- }
19
- }
20
-
21
- export default {{{pascalCaseName}}}Client;
1
+ export { default } from './plugin';
@@ -1,12 +1,21 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ import { tExpr as _tExpr, useFlowEngine } from '@nocobase/flow-engine';
1
11
  // @ts-ignore
2
12
  import pkg from './../../package.json';
3
- import { useApp } from '@nocobase/client';
4
13
 
5
14
  export function useT() {
6
- const app = useApp();
7
- return (str: string) => app.i18n.t(str, { ns: [pkg.name, 'client'] });
15
+ const engine = useFlowEngine();
16
+ return (str: string) => engine.context.t(str, { ns: [pkg.name, 'client'] });
8
17
  }
9
18
 
10
- export function tStr(key: string) {
11
- return `{{t(${JSON.stringify(key)}, { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`;
19
+ export function tExpr(key: string) {
20
+ return _tExpr(key, { ns: [pkg.name, 'client'] });
12
21
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ import { ModelConstructor } from '@nocobase/flow-engine';
11
+
12
+ export default {} as Record<string, ModelConstructor>;
@@ -0,0 +1,10 @@
1
+ import { Plugin } from '@nocobase/client';
2
+ import models from './models';
3
+
4
+ export class {{{pascalCaseName}}}Client extends Plugin {
5
+ async load() {
6
+ this.flowEngine.registerModels(models);
7
+ }
8
+ }
9
+
10
+ export default {{{pascalCaseName}}}Client;
@@ -1 +0,0 @@
1
- {}