@nocobase/devtools 0.8.0-alpha.9 → 0.8.1-alpha.3
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 +3 -3
- package/umiConfig.js +43 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/devtools",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "./src/index.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@nocobase/build": "0.8.
|
|
14
|
+
"@nocobase/build": "0.8.1-alpha.3",
|
|
15
15
|
"@testing-library/react": "^12.1.2",
|
|
16
16
|
"@types/jest": "^26.0.0",
|
|
17
17
|
"@types/koa": "^2.13.4",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
62
62
|
"directory": "packages/core/devtools"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e03df3df5962b99d9fbf5b6e33fbe2b23f14f3d3"
|
|
65
65
|
}
|
package/umiConfig.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const { existsSync } = require('fs');
|
|
2
|
-
const { resolve } = require('path');
|
|
2
|
+
const { resolve, sep } = require('path');
|
|
3
3
|
const packageJson = require('./package.json');
|
|
4
4
|
const fs = require('fs');
|
|
5
|
+
const glob = require('glob');
|
|
5
6
|
|
|
6
7
|
console.log('VERSION: ', packageJson.version);
|
|
7
8
|
|
|
@@ -44,34 +45,49 @@ function getUmiConfig() {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
function getNamespace() {
|
|
49
|
+
const content = fs.readFileSync(resolve(process.cwd(), 'package.json'), 'utf-8');
|
|
50
|
+
const json = JSON.parse(content);
|
|
51
|
+
return json.name;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getTsconfigPaths() {
|
|
55
|
+
const content = fs.readFileSync(resolve(process.cwd(), 'tsconfig.json'), 'utf-8');
|
|
56
|
+
const json = JSON.parse(content);
|
|
57
|
+
return json.compilerOptions.paths;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getPackagePaths() {
|
|
61
|
+
const paths = getTsconfigPaths();
|
|
62
|
+
const pkgs = [];
|
|
63
|
+
for (const key in paths) {
|
|
64
|
+
if (Object.hasOwnProperty.call(paths, key)) {
|
|
65
|
+
const dir = paths[key][0];
|
|
66
|
+
if (dir.includes('*')) {
|
|
67
|
+
const files = glob.sync(dir);
|
|
68
|
+
for (const file of files) {
|
|
69
|
+
const dirname = resolve(process.cwd(), file);
|
|
70
|
+
if (existsSync(dirname)) {
|
|
71
|
+
const re = new RegExp(dir.replace('*', '(.+)'));
|
|
72
|
+
const p = dirname.substring(process.cwd().length + 1).split(sep).join('/');
|
|
73
|
+
const match = re.exec(p);
|
|
74
|
+
pkgs.push([key.replace('*', match?.[1]), dirname]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
const dirname = resolve(process.cwd(), dir);
|
|
79
|
+
pkgs.push([key, dirname]);
|
|
80
|
+
}
|
|
66
81
|
}
|
|
67
82
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
return pkgs;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function resolveNocobasePackagesAlias(config) {
|
|
87
|
+
const pkgs = getPackagePaths();
|
|
88
|
+
for (const [pkg, dir] of pkgs) {
|
|
89
|
+
config.module.rules.get('ts-in-node_modules').include.add(dir);
|
|
90
|
+
config.resolve.alias.set(pkg, dir);
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
|