@nocobase/devtools 1.4.0-alpha.20240914095808 → 1.4.0-alpha.20240918085507
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 +5 -5
- package/umiConfig.d.ts +2 -0
- package/umiConfig.js +25 -11
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/devtools",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.20240918085507",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@nocobase/build": "1.4.0-alpha.
|
|
9
|
-
"@nocobase/client": "1.4.0-alpha.
|
|
10
|
-
"@nocobase/test": "1.4.0-alpha.
|
|
8
|
+
"@nocobase/build": "1.4.0-alpha.20240918085507",
|
|
9
|
+
"@nocobase/client": "1.4.0-alpha.20240918085507",
|
|
10
|
+
"@nocobase/test": "1.4.0-alpha.20240918085507",
|
|
11
11
|
"@types/koa": "^2.13.4",
|
|
12
12
|
"@types/koa-bodyparser": "^4.3.4",
|
|
13
13
|
"@types/lodash": "^4.14.177",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
50
50
|
"directory": "packages/core/devtools"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "f7e20e88102e8ed8200ad0213c32d8815770e2f1"
|
|
53
53
|
}
|
package/umiConfig.d.ts
CHANGED
package/umiConfig.js
CHANGED
|
@@ -137,14 +137,14 @@ class IndexGenerator {
|
|
|
137
137
|
generate() {
|
|
138
138
|
this.generatePluginContent();
|
|
139
139
|
if (process.env.NODE_ENV === 'production') return;
|
|
140
|
-
this.pluginsPath.forEach((pluginPath) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
});
|
|
140
|
+
// this.pluginsPath.forEach((pluginPath) => {
|
|
141
|
+
// if (!fs.existsSync(pluginPath)) {
|
|
142
|
+
// return;
|
|
143
|
+
// }
|
|
144
|
+
// fs.watch(pluginPath, { recursive: false }, () => {
|
|
145
|
+
// this.generatePluginContent();
|
|
146
|
+
// });
|
|
147
|
+
// });
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
get indexContent() {
|
|
@@ -156,7 +156,11 @@ function devDynamicImport(packageName: string): Promise<any> {
|
|
|
156
156
|
if (!fileName) {
|
|
157
157
|
return Promise.resolve(null);
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
try {
|
|
160
|
+
return import(\`./packages/\${fileName}\`)
|
|
161
|
+
} catch (error) {
|
|
162
|
+
return Promise.resolve(null);
|
|
163
|
+
}
|
|
160
164
|
}
|
|
161
165
|
export default devDynamicImport;`;
|
|
162
166
|
}
|
|
@@ -170,9 +174,9 @@ export default function devDynamicImport(packageName: string): Promise<any> {
|
|
|
170
174
|
|
|
171
175
|
generatePluginContent() {
|
|
172
176
|
if (fs.existsSync(this.outputPath)) {
|
|
173
|
-
fs.
|
|
177
|
+
fs.rmSync(this.outputPath, { recursive: true, force: true });
|
|
174
178
|
}
|
|
175
|
-
fs.mkdirSync(this.outputPath);
|
|
179
|
+
fs.mkdirSync(this.outputPath, { recursive: true, force: true });
|
|
176
180
|
const validPluginPaths = this.pluginsPath.filter((pluginsPath) => fs.existsSync(pluginsPath));
|
|
177
181
|
if (!validPluginPaths.length || process.env.NODE_ENV === 'production') {
|
|
178
182
|
fs.writeFileSync(this.indexPath, this.emptyIndexContent);
|
|
@@ -247,3 +251,13 @@ export default function devDynamicImport(packageName: string): Promise<any> {
|
|
|
247
251
|
exports.getUmiConfig = getUmiConfig;
|
|
248
252
|
exports.resolveNocobasePackagesAlias = resolveNocobasePackagesAlias;
|
|
249
253
|
exports.IndexGenerator = IndexGenerator;
|
|
254
|
+
|
|
255
|
+
exports.generatePlugins = function () {
|
|
256
|
+
const pluginDirs = (process.env.PLUGIN_PATH || 'packages/plugins/,packages/samples/,packages/pro-plugins/')
|
|
257
|
+
.split(',')
|
|
258
|
+
.map((item) => path.join(process.cwd(), item));
|
|
259
|
+
|
|
260
|
+
const outputPluginPath = path.join(process.env.APP_PACKAGE_ROOT, 'client', 'src', '.plugins');
|
|
261
|
+
const indexGenerator = new IndexGenerator(outputPluginPath, pluginDirs);
|
|
262
|
+
indexGenerator.generate();
|
|
263
|
+
};
|