@cabloy/module-glob 5.0.0 → 5.0.2
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/README.md +0 -0
- package/dist/index.js +9 -21
- package/dist/interface.d.ts +10 -0
- package/dist/meta.d.ts +2 -26
- package/dist/meta.js +25 -29
- package/package.json +7 -7
package/README.md
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const boxenOptions = {
|
|
|
34
34
|
borderColor: 'yellow',
|
|
35
35
|
borderStyle: 'round',
|
|
36
36
|
};
|
|
37
|
-
// type: front/backend
|
|
37
|
+
// type: front/backend
|
|
38
38
|
async function glob(options) {
|
|
39
39
|
const { projectPath, disabledModules, disabledSuites, log, type, loadPackage } = options;
|
|
40
40
|
// context
|
|
@@ -54,13 +54,13 @@ async function glob(options) {
|
|
|
54
54
|
//
|
|
55
55
|
disabledModules: __getDisabledModules(disabledModules),
|
|
56
56
|
disabledSuites: __getDisabledSuites(disabledSuites),
|
|
57
|
+
//
|
|
58
|
+
pathsMeta: (0, meta_js_1.getPathsMeta)(type),
|
|
57
59
|
};
|
|
58
|
-
// cabloy config
|
|
59
|
-
const cabloyConfig = await __loadCabloyConfig();
|
|
60
60
|
// parse suites
|
|
61
|
-
const suites = __parseSuites(projectPath);
|
|
61
|
+
const suites = __parseSuites(context, projectPath);
|
|
62
62
|
// parse modules
|
|
63
|
-
const modules = __parseModules(
|
|
63
|
+
const modules = __parseModules(context, projectPath);
|
|
64
64
|
// load package
|
|
65
65
|
if (loadPackage !== false) {
|
|
66
66
|
await __loadPackage(suites);
|
|
@@ -175,10 +175,9 @@ function __orderDependencies(context, modules, module, moduleRelativeName) {
|
|
|
175
175
|
}
|
|
176
176
|
return enabled;
|
|
177
177
|
}
|
|
178
|
-
function __parseModules(
|
|
179
|
-
const entities = cabloyConfig.source?.entities;
|
|
178
|
+
function __parseModules(context, projectPath) {
|
|
180
179
|
const modules = {};
|
|
181
|
-
for (const __path of
|
|
180
|
+
for (const __path of context.pathsMeta.modules) {
|
|
182
181
|
const prefix = `${projectPath}/${__path.prefix}`;
|
|
183
182
|
const filePkgs = egg_born_utils_1.default.tools.globbySync(`${prefix}*/package.json`);
|
|
184
183
|
for (const filePkg of filePkgs) {
|
|
@@ -199,14 +198,8 @@ function __parseModules(projectPath, cabloyConfig) {
|
|
|
199
198
|
continue;
|
|
200
199
|
// info
|
|
201
200
|
info.vendor = __path.vendor;
|
|
202
|
-
info.source = __path.source;
|
|
203
201
|
info.node_modules = __path.node_modules;
|
|
204
202
|
info.originalName = name;
|
|
205
|
-
// source
|
|
206
|
-
const entity = entities?.[info.relativeName];
|
|
207
|
-
if (entity === true || entity === false) {
|
|
208
|
-
info.source = entity;
|
|
209
|
-
}
|
|
210
203
|
// resource
|
|
211
204
|
const root = path_1.default.dirname(filePkg);
|
|
212
205
|
const module = {
|
|
@@ -294,9 +287,9 @@ function __getDisabledSuites(disabledSuites) {
|
|
|
294
287
|
}
|
|
295
288
|
return disabledSuitesMap;
|
|
296
289
|
}
|
|
297
|
-
function __parseSuites(projectPath) {
|
|
290
|
+
function __parseSuites(context, projectPath) {
|
|
298
291
|
const suites = {};
|
|
299
|
-
for (const __path of
|
|
292
|
+
for (const __path of context.pathsMeta.suites) {
|
|
300
293
|
const prefix = `${projectPath}/${__path.prefix}`;
|
|
301
294
|
const filePkgs = egg_born_utils_1.default.tools.globbySync(`${prefix}*/package.json`);
|
|
302
295
|
for (const filePkg of filePkgs) {
|
|
@@ -376,9 +369,4 @@ function __checkSuites(context, suites) {
|
|
|
376
369
|
}
|
|
377
370
|
}
|
|
378
371
|
}
|
|
379
|
-
async function __loadCabloyConfig() {
|
|
380
|
-
const __cabloyConfig = egg_born_utils_1.default.cabloyConfig;
|
|
381
|
-
const { config } = await __cabloyConfig.load();
|
|
382
|
-
return config;
|
|
383
|
-
}
|
|
384
372
|
//# sourceMappingURL=index.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -20,5 +20,15 @@ export interface IModuleGlobContext {
|
|
|
20
20
|
suitesVendor: Record<string, ISuite>;
|
|
21
21
|
disabledModules: Record<string, boolean>;
|
|
22
22
|
disabledSuites: Record<string, boolean>;
|
|
23
|
+
pathsMeta: IModuleGlobPathsMeta;
|
|
24
|
+
}
|
|
25
|
+
export interface IModuleGlobPathMetaItem {
|
|
26
|
+
prefix: string;
|
|
27
|
+
vendor: boolean;
|
|
28
|
+
node_modules?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface IModuleGlobPathsMeta {
|
|
31
|
+
suites: IModuleGlobPathMetaItem[];
|
|
32
|
+
modules: IModuleGlobPathMetaItem[];
|
|
23
33
|
}
|
|
24
34
|
//# sourceMappingURL=interface.d.ts.map
|
package/dist/meta.d.ts
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
vendor: boolean;
|
|
4
|
-
node_modules?: undefined;
|
|
5
|
-
} | {
|
|
6
|
-
prefix: string;
|
|
7
|
-
vendor: boolean;
|
|
8
|
-
node_modules: boolean;
|
|
9
|
-
})[];
|
|
10
|
-
export declare const __pathsModules: ({
|
|
11
|
-
prefix: string;
|
|
12
|
-
vendor: boolean;
|
|
13
|
-
source: boolean;
|
|
14
|
-
fronts: {
|
|
15
|
-
js: string;
|
|
16
|
-
}[];
|
|
17
|
-
node_modules?: undefined;
|
|
18
|
-
} | {
|
|
19
|
-
prefix: string;
|
|
20
|
-
vendor: boolean;
|
|
21
|
-
source: boolean;
|
|
22
|
-
node_modules: boolean;
|
|
23
|
-
fronts: {
|
|
24
|
-
js: string;
|
|
25
|
-
}[];
|
|
26
|
-
})[];
|
|
1
|
+
import { IModuleGlobPathsMeta } from './interface.js';
|
|
2
|
+
export declare function getPathsMeta(type: any): IModuleGlobPathsMeta;
|
|
27
3
|
//# sourceMappingURL=meta.d.ts.map
|
package/dist/meta.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.getPathsMeta = void 0;
|
|
4
|
+
const __pathSuites = [
|
|
5
5
|
{
|
|
6
6
|
prefix: 'src/suite/',
|
|
7
7
|
vendor: false,
|
|
@@ -10,49 +10,45 @@ exports.__pathSuites = [
|
|
|
10
10
|
prefix: 'src/suite-vendor/',
|
|
11
11
|
vendor: true,
|
|
12
12
|
},
|
|
13
|
-
{
|
|
14
|
-
prefix: 'node_modules/cabloy-suite-api-',
|
|
15
|
-
vendor: true,
|
|
16
|
-
node_modules: true,
|
|
17
|
-
},
|
|
18
13
|
];
|
|
19
|
-
|
|
14
|
+
const __pathsModules = [
|
|
20
15
|
{
|
|
21
16
|
prefix: 'src/module/',
|
|
22
17
|
vendor: false,
|
|
23
|
-
source: true,
|
|
24
|
-
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
prefix: 'src/module-system/',
|
|
28
|
-
vendor: false,
|
|
29
|
-
source: true,
|
|
30
|
-
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
31
18
|
},
|
|
32
19
|
{
|
|
33
20
|
prefix: 'src/suite/*/modules/',
|
|
34
21
|
vendor: false,
|
|
35
|
-
source: true,
|
|
36
|
-
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
37
22
|
},
|
|
38
23
|
{
|
|
39
24
|
prefix: 'src/module-vendor/',
|
|
40
25
|
vendor: true,
|
|
41
|
-
source: false,
|
|
42
|
-
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
43
26
|
},
|
|
44
27
|
{
|
|
45
28
|
prefix: 'src/suite-vendor/*/modules/',
|
|
46
29
|
vendor: true,
|
|
47
|
-
source: false,
|
|
48
|
-
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
prefix: 'node_modules/cabloy-module-api-',
|
|
52
|
-
vendor: true,
|
|
53
|
-
source: false,
|
|
54
|
-
node_modules: true,
|
|
55
|
-
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
56
30
|
},
|
|
57
31
|
];
|
|
32
|
+
function getPathsMeta(type) {
|
|
33
|
+
const suites = __pathSuites.concat([
|
|
34
|
+
{
|
|
35
|
+
prefix: type === 'backend' ? 'node_modules/cabloy-suite-api-' : 'node_modules/cabloy-suite-front-',
|
|
36
|
+
vendor: true,
|
|
37
|
+
node_modules: true,
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
const modules = __pathsModules.concat([
|
|
41
|
+
{
|
|
42
|
+
prefix: type === 'backend' ? 'node_modules/cabloy-module-api-' : 'node_modules/cabloy-module-front-',
|
|
43
|
+
vendor: true,
|
|
44
|
+
node_modules: true,
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
const pathsMeta = {
|
|
48
|
+
suites,
|
|
49
|
+
modules,
|
|
50
|
+
};
|
|
51
|
+
return pathsMeta;
|
|
52
|
+
}
|
|
53
|
+
exports.getPathsMeta = getPathsMeta;
|
|
58
54
|
//# sourceMappingURL=meta.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/module-glob",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "cabloy module-glob",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
"dist/**/*.js",
|
|
22
22
|
"dist/**/*.d.ts"
|
|
23
23
|
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"lint": "eslint ."
|
|
26
|
-
},
|
|
27
24
|
"keywords": [
|
|
28
25
|
"egg",
|
|
29
26
|
"egg-born",
|
|
@@ -32,8 +29,11 @@
|
|
|
32
29
|
],
|
|
33
30
|
"author": "zhennann",
|
|
34
31
|
"dependencies": {
|
|
35
|
-
"@cabloy/module-info": "workspace:^",
|
|
36
32
|
"boxen": "^4.2.0",
|
|
37
|
-
"egg-born-utils": "^1.1.9"
|
|
33
|
+
"egg-born-utils": "^1.1.9",
|
|
34
|
+
"@cabloy/module-info": "^1.0.7"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"lint": "eslint ."
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|