@nocobase/cli 1.9.0-beta.8 → 2.0.0-alpha.10
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 +4 -4
- package/src/commands/pkg.js +17 -0
- package/src/commands/test.js +1 -1
- package/templates/create-app-package.json +2 -2
- package/templates/plugin/src/client/index.tsx.tpl +1 -21
- package/templates/plugin/src/client/locale.ts +14 -5
- package/templates/plugin/src/client/models/index.ts +12 -0
- package/templates/plugin/src/client/plugin.tsx.tpl +10 -0
- package/templates/plugin/src/locale/nl-NL.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.10",
|
|
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": "
|
|
11
|
+
"@nocobase/app": "2.0.0-alpha.10",
|
|
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": "
|
|
30
|
+
"@nocobase/devtools": "2.0.0-alpha.10"
|
|
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": "
|
|
37
|
+
"gitHead": "6422cfb6fa6c8450de2efa3294fd29a28b228990"
|
|
38
38
|
}
|
package/src/commands/pkg.js
CHANGED
|
@@ -96,6 +96,19 @@ class Package {
|
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
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
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
async isDownloaded(version) {
|
|
100
113
|
const packageFile = path.resolve(process.env.PLUGIN_STORAGE_PATH, this.packageName, 'package.json');
|
|
101
114
|
if (await fs.exists(packageFile)) {
|
|
@@ -112,6 +125,10 @@ class Package {
|
|
|
112
125
|
console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dev package`));
|
|
113
126
|
return;
|
|
114
127
|
}
|
|
128
|
+
if (await this.isDepPackage()) {
|
|
129
|
+
console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dependency package`));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
115
132
|
if (await this.isDownloaded(options.version)) {
|
|
116
133
|
return;
|
|
117
134
|
}
|
package/src/commands/test.js
CHANGED
|
@@ -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.
|
|
26
|
-
"react-router": "6.
|
|
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
|
-
|
|
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
|
|
7
|
-
return (str: string) =>
|
|
15
|
+
const engine = useFlowEngine();
|
|
16
|
+
return (str: string) => engine.context.t(str, { ns: [pkg.name, 'client'] });
|
|
8
17
|
}
|
|
9
18
|
|
|
10
|
-
export function
|
|
11
|
-
return
|
|
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>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|