@cabloy/module-glob 1.0.0 → 5.0.0
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/dist/index.d.ts +13 -14
- package/dist/index.js +135 -205
- package/dist/interface.d.ts +24 -0
- package/dist/interface.js +3 -0
- package/dist/meta.d.ts +27 -0
- package/dist/meta.js +58 -0
- package/package.json +18 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
1
|
+
import { IModuleGlobOptions } from './interface.js';
|
|
2
|
+
import { IModule, ISuite } from '@cabloy/module-info';
|
|
3
|
+
export * from './interface.js';
|
|
4
|
+
export declare function glob(options: IModuleGlobOptions): Promise<{
|
|
5
|
+
suites: Record<string, ISuite>;
|
|
6
|
+
modules: Record<string, IModule>;
|
|
7
|
+
modulesArray: IModule[];
|
|
8
|
+
modulesLocal: Record<string, IModule>;
|
|
9
|
+
modulesGlobal: Record<string, IModule>;
|
|
10
|
+
modulesMonkey: Record<string, IModule>;
|
|
11
|
+
suitesLocal: Record<string, ISuite>;
|
|
12
|
+
suitesVendor: Record<string, ISuite>;
|
|
13
|
+
}>;
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,92 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
2
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
exports.glob = void 0;
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
23
|
+
const semver_1 = __importDefault(require("semver"));
|
|
24
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
25
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
26
|
+
const egg_born_utils_1 = __importDefault(require("egg-born-utils"));
|
|
27
|
+
const meta_js_1 = require("./meta.js");
|
|
28
|
+
const module_info_1 = require("@cabloy/module-info");
|
|
29
|
+
__exportStar(require("./interface.js"), exports);
|
|
30
|
+
const boxenOptions = {
|
|
31
|
+
padding: 1,
|
|
32
|
+
margin: 1,
|
|
33
|
+
align: 'center',
|
|
34
|
+
borderColor: 'yellow',
|
|
35
|
+
borderStyle: 'round',
|
|
13
36
|
};
|
|
14
|
-
const __pathSuites = [
|
|
15
|
-
{
|
|
16
|
-
prefix: 'src/suite/',
|
|
17
|
-
vendor: false,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
prefix: 'src/suite-vendor/',
|
|
21
|
-
vendor: true,
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
const __pathsModules = [
|
|
25
|
-
{
|
|
26
|
-
prefix: 'src/module/',
|
|
27
|
-
vendor: false,
|
|
28
|
-
public: false,
|
|
29
|
-
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
30
|
-
backends: [
|
|
31
|
-
{ js: 'backend/src/main.js', static: 'backend/static' },
|
|
32
|
-
{ js: 'dist/backend.js', static: 'dist/staticBackend' },
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
prefix: 'src/module-system/',
|
|
37
|
-
vendor: false,
|
|
38
|
-
public: false,
|
|
39
|
-
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
40
|
-
backends: [
|
|
41
|
-
{ js: 'backend/src/main.js', static: 'backend/static' },
|
|
42
|
-
{ js: 'dist/backend.js', static: 'dist/staticBackend' },
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
prefix: 'src/suite/*/modules/',
|
|
47
|
-
vendor: false,
|
|
48
|
-
public: false,
|
|
49
|
-
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
50
|
-
backends: [
|
|
51
|
-
{ js: 'backend/src/main.js', static: 'backend/static' },
|
|
52
|
-
{ js: 'dist/backend.js', static: 'dist/staticBackend' },
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
prefix: 'src/module-vendor/',
|
|
57
|
-
vendor: true,
|
|
58
|
-
public: false,
|
|
59
|
-
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
60
|
-
backends: [
|
|
61
|
-
{ js: 'dist/backend.js', static: 'dist/staticBackend' },
|
|
62
|
-
{ js: 'backend/src/main.js', static: 'backend/static' },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
prefix: 'src/suite-vendor/*/modules/',
|
|
67
|
-
vendor: true,
|
|
68
|
-
public: false,
|
|
69
|
-
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
70
|
-
backends: [
|
|
71
|
-
{ js: 'dist/backend.js', static: 'dist/staticBackend' },
|
|
72
|
-
{ js: 'backend/src/main.js', static: 'backend/static' },
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
prefix: 'node_modules/egg-born-module-',
|
|
77
|
-
vendor: true,
|
|
78
|
-
public: true,
|
|
79
|
-
node_modules: true,
|
|
80
|
-
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
81
|
-
backends: [
|
|
82
|
-
{ js: 'dist/backend.js', static: 'dist/staticBackend' },
|
|
83
|
-
{ js: 'backend/src/main.js', static: 'backend/static' },
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
];
|
|
87
37
|
// type: front/backend/all
|
|
88
|
-
function
|
|
89
|
-
const { projectPath, disabledModules, disabledSuites, log, type } = options;
|
|
38
|
+
async function glob(options) {
|
|
39
|
+
const { projectPath, disabledModules, disabledSuites, log, type, loadPackage } = options;
|
|
90
40
|
// context
|
|
91
41
|
const context = {
|
|
92
42
|
options,
|
|
@@ -105,16 +55,28 @@ function eggBornMglob(options) {
|
|
|
105
55
|
disabledModules: __getDisabledModules(disabledModules),
|
|
106
56
|
disabledSuites: __getDisabledSuites(disabledSuites),
|
|
107
57
|
};
|
|
58
|
+
// cabloy config
|
|
59
|
+
const cabloyConfig = await __loadCabloyConfig();
|
|
108
60
|
// parse suites
|
|
109
61
|
const suites = __parseSuites(projectPath);
|
|
110
62
|
// parse modules
|
|
111
|
-
const modules = __parseModules(projectPath,
|
|
63
|
+
const modules = __parseModules(projectPath, cabloyConfig);
|
|
64
|
+
// load package
|
|
65
|
+
if (loadPackage !== false) {
|
|
66
|
+
await __loadPackage(suites);
|
|
67
|
+
await __loadPackage(modules);
|
|
68
|
+
}
|
|
112
69
|
// bind suites modules
|
|
113
70
|
__bindSuitesModules(suites, modules);
|
|
114
71
|
// check suites
|
|
115
72
|
__checkSuites(context, suites);
|
|
116
73
|
// order
|
|
117
|
-
|
|
74
|
+
if (type === 'backend' && loadPackage !== false) {
|
|
75
|
+
__orderModules(context, modules);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
context.modules = modules;
|
|
79
|
+
}
|
|
118
80
|
// log
|
|
119
81
|
__logModules(context, log);
|
|
120
82
|
__logSuites(context, log);
|
|
@@ -132,6 +94,21 @@ function eggBornMglob(options) {
|
|
|
132
94
|
suitesVendor: context.suitesVendor,
|
|
133
95
|
};
|
|
134
96
|
}
|
|
97
|
+
exports.glob = glob;
|
|
98
|
+
async function __loadPackage(modules) {
|
|
99
|
+
const promises = [];
|
|
100
|
+
const modulesArray = [];
|
|
101
|
+
for (const moduleName in modules) {
|
|
102
|
+
const module = modules[moduleName];
|
|
103
|
+
promises.push(fs_extra_1.default.readFile(module.pkg));
|
|
104
|
+
modulesArray.push(moduleName);
|
|
105
|
+
}
|
|
106
|
+
const modulesPackage = await Promise.all(promises);
|
|
107
|
+
for (let i = 0; i < modulesPackage.length; i++) {
|
|
108
|
+
const moduleName = modulesArray[i];
|
|
109
|
+
modules[moduleName].package = JSON.parse(modulesPackage[i].toString());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
135
112
|
function __orderModules(context, modules) {
|
|
136
113
|
// 'a-version' first
|
|
137
114
|
__pushModule(context, modules, 'a-version');
|
|
@@ -180,16 +157,16 @@ function __orderDependencies(context, modules, module, moduleRelativeName) {
|
|
|
180
157
|
for (const key in dependencies) {
|
|
181
158
|
const subModule = modules[key];
|
|
182
159
|
if (!subModule) {
|
|
183
|
-
const message =
|
|
160
|
+
const message = chalk_1.default.keyword('orange')(`module ${moduleRelativeName} disabled`) +
|
|
184
161
|
', because ' +
|
|
185
|
-
|
|
186
|
-
console.log('\n' +
|
|
162
|
+
chalk_1.default.keyword('cyan')(`module ${key} not exists`);
|
|
163
|
+
console.log('\n' + (0, boxen_1.default)(message, boxenOptions) + '\n');
|
|
187
164
|
enabled = false; // process.exit(0);
|
|
188
165
|
continue;
|
|
189
166
|
}
|
|
190
167
|
const subModuleVersion = dependencies[key];
|
|
191
|
-
if (
|
|
192
|
-
console.warn(
|
|
168
|
+
if (semver_1.default.lt(subModule.package.version, subModuleVersion)) {
|
|
169
|
+
console.warn(chalk_1.default.cyan(`module ${key} is old`));
|
|
193
170
|
process.exit(0);
|
|
194
171
|
}
|
|
195
172
|
if (!__pushModule(context, modules, key)) {
|
|
@@ -198,98 +175,52 @@ function __orderDependencies(context, modules, module, moduleRelativeName) {
|
|
|
198
175
|
}
|
|
199
176
|
return enabled;
|
|
200
177
|
}
|
|
201
|
-
function __parseModules(projectPath,
|
|
178
|
+
function __parseModules(projectPath, cabloyConfig) {
|
|
179
|
+
const entities = cabloyConfig.source?.entities;
|
|
202
180
|
const modules = {};
|
|
203
|
-
for (const __path of __pathsModules) {
|
|
181
|
+
for (const __path of meta_js_1.__pathsModules) {
|
|
204
182
|
const prefix = `${projectPath}/${__path.prefix}`;
|
|
205
|
-
const filePkgs =
|
|
206
|
-
for (
|
|
183
|
+
const filePkgs = egg_born_utils_1.default.tools.globbySync(`${prefix}*/package.json`);
|
|
184
|
+
for (const filePkg of filePkgs) {
|
|
207
185
|
// name
|
|
208
|
-
|
|
186
|
+
const name = filePkg.split('/').slice(-2)[0];
|
|
209
187
|
// check if '-' prefix exists
|
|
210
188
|
if (name.substring(0, 1) === '-') {
|
|
211
189
|
// skip
|
|
212
190
|
continue;
|
|
213
191
|
}
|
|
214
|
-
// check if full name
|
|
215
|
-
if (!__path.public && name.indexOf('egg-born-module-') > -1) {
|
|
216
|
-
const pathSrc = path.join(prefix, name);
|
|
217
|
-
name = name.substring('egg-born-module-'.length);
|
|
218
|
-
filePkg = path.join(prefix, name, 'package.json');
|
|
219
|
-
const pathDest = path.join(prefix, name);
|
|
220
|
-
fse.moveSync(pathSrc, pathDest);
|
|
221
|
-
// throw new Error(`Should use relative name for local module: ${name}`);
|
|
222
|
-
}
|
|
223
192
|
// info
|
|
224
|
-
const info =
|
|
193
|
+
const info = (0, module_info_1.parseInfo)(name, 'module');
|
|
225
194
|
if (!info) {
|
|
226
195
|
throw new Error(`module name is not valid: ${name}`);
|
|
227
196
|
}
|
|
197
|
+
// check if exists
|
|
198
|
+
if (modules[info.relativeName])
|
|
199
|
+
continue;
|
|
200
|
+
// info
|
|
228
201
|
info.vendor = __path.vendor;
|
|
229
|
-
info.
|
|
202
|
+
info.source = __path.source;
|
|
230
203
|
info.node_modules = __path.node_modules;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const moduleMeta = {
|
|
237
|
-
name,
|
|
238
|
-
info,
|
|
239
|
-
root,
|
|
240
|
-
pkg: filePkg,
|
|
241
|
-
package: _package,
|
|
242
|
-
js: {},
|
|
243
|
-
static: {},
|
|
244
|
-
};
|
|
245
|
-
const _moduleMeta = __parseModule(__path, moduleMeta, type);
|
|
246
|
-
if (_moduleMeta) {
|
|
247
|
-
// enhance check public
|
|
248
|
-
// if (_moduleMeta.info.public) {
|
|
249
|
-
const file = _moduleMeta.js.front || _moduleMeta.js.backend;
|
|
250
|
-
_moduleMeta.info.public = file.replace(/\\/g, '/').indexOf('/dist/') > -1;
|
|
251
|
-
// }
|
|
252
|
-
// record
|
|
253
|
-
modules[info.relativeName] = _moduleMeta;
|
|
254
|
-
}
|
|
204
|
+
info.originalName = name;
|
|
205
|
+
// source
|
|
206
|
+
const entity = entities?.[info.relativeName];
|
|
207
|
+
if (entity === true || entity === false) {
|
|
208
|
+
info.source = entity;
|
|
255
209
|
}
|
|
210
|
+
// resource
|
|
211
|
+
const root = path_1.default.dirname(filePkg);
|
|
212
|
+
const module = {
|
|
213
|
+
name,
|
|
214
|
+
info,
|
|
215
|
+
root,
|
|
216
|
+
pkg: filePkg,
|
|
217
|
+
};
|
|
218
|
+
// record
|
|
219
|
+
modules[info.relativeName] = module;
|
|
256
220
|
}
|
|
257
221
|
}
|
|
258
222
|
return modules;
|
|
259
223
|
}
|
|
260
|
-
function __parseModule(__path, moduleMeta, type) {
|
|
261
|
-
const root = moduleMeta.root;
|
|
262
|
-
// front
|
|
263
|
-
if (type !== 'backend') {
|
|
264
|
-
for (const item of __path.fronts) {
|
|
265
|
-
const file = path.join(root, item.js);
|
|
266
|
-
if (fse.existsSync(file)) {
|
|
267
|
-
moduleMeta.js.front = file;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (!moduleMeta.js.front) {
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
// backend
|
|
276
|
-
if (type !== 'front') {
|
|
277
|
-
for (const item of __path.backends) {
|
|
278
|
-
const file = path.join(root, item.js);
|
|
279
|
-
if (fse.existsSync(file)) {
|
|
280
|
-
moduleMeta.js.backend = file;
|
|
281
|
-
const staticBackendPath = path.normalize(path.join(root, item.static));
|
|
282
|
-
moduleMeta.static.backend = staticBackendPath;
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
if (!moduleMeta.js.backend) {
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
// ok
|
|
291
|
-
return moduleMeta;
|
|
292
|
-
}
|
|
293
224
|
function __logModules(context, log) {
|
|
294
225
|
for (const module of context.modulesArray) {
|
|
295
226
|
const relativeName = module.info.relativeName;
|
|
@@ -306,19 +237,19 @@ function __logModules(context, log) {
|
|
|
306
237
|
if (!log)
|
|
307
238
|
return;
|
|
308
239
|
// log
|
|
309
|
-
console.log(
|
|
240
|
+
console.log(chalk_1.default.yellow('\n=== Local Modules ==='));
|
|
310
241
|
for (const key in context.modulesLocal) {
|
|
311
|
-
console.log(
|
|
242
|
+
console.log(chalk_1.default.cyan('> ' + key));
|
|
312
243
|
}
|
|
313
|
-
console.log(
|
|
244
|
+
console.log(chalk_1.default.yellow('\n=== Global Modules ==='));
|
|
314
245
|
for (const key in context.modulesGlobal) {
|
|
315
|
-
console.log(
|
|
246
|
+
console.log(chalk_1.default.cyan('> ' + key));
|
|
316
247
|
}
|
|
317
|
-
console.log(
|
|
248
|
+
console.log(chalk_1.default.yellow('\n=== Monkey Modules ==='));
|
|
318
249
|
for (const key in context.modulesMonkey) {
|
|
319
|
-
console.log(
|
|
250
|
+
console.log(chalk_1.default.cyan('> ' + key));
|
|
320
251
|
}
|
|
321
|
-
console.log(
|
|
252
|
+
console.log(chalk_1.default.keyword('orange')(`\n=== Total Modules: ${context.modulesArray.length} ===`));
|
|
322
253
|
// console.log('\n');
|
|
323
254
|
}
|
|
324
255
|
function __logSuites(context, log) {
|
|
@@ -334,15 +265,15 @@ function __logSuites(context, log) {
|
|
|
334
265
|
if (!log)
|
|
335
266
|
return;
|
|
336
267
|
// log
|
|
337
|
-
console.log(
|
|
268
|
+
console.log(chalk_1.default.yellow('\n=== Local Suites ==='));
|
|
338
269
|
for (const key in context.suitesLocal) {
|
|
339
|
-
console.log(
|
|
270
|
+
console.log(chalk_1.default.cyan('> ' + key));
|
|
340
271
|
}
|
|
341
|
-
console.log(
|
|
272
|
+
console.log(chalk_1.default.yellow('\n=== Vendor Suites ==='));
|
|
342
273
|
for (const key in context.suitesVendor) {
|
|
343
|
-
console.log(
|
|
274
|
+
console.log(chalk_1.default.cyan('> ' + key));
|
|
344
275
|
}
|
|
345
|
-
console.log(
|
|
276
|
+
console.log(chalk_1.default.keyword('orange')(`\n=== Total Suites: ${Object.keys(context.suites).length} ===`));
|
|
346
277
|
console.log('\n');
|
|
347
278
|
}
|
|
348
279
|
function __getDisabledModules(disabledModules) {
|
|
@@ -365,46 +296,40 @@ function __getDisabledSuites(disabledSuites) {
|
|
|
365
296
|
}
|
|
366
297
|
function __parseSuites(projectPath) {
|
|
367
298
|
const suites = {};
|
|
368
|
-
for (const __path of __pathSuites) {
|
|
299
|
+
for (const __path of meta_js_1.__pathSuites) {
|
|
369
300
|
const prefix = `${projectPath}/${__path.prefix}`;
|
|
370
|
-
const filePkgs =
|
|
371
|
-
for (
|
|
301
|
+
const filePkgs = egg_born_utils_1.default.tools.globbySync(`${prefix}*/package.json`);
|
|
302
|
+
for (const filePkg of filePkgs) {
|
|
372
303
|
// name
|
|
373
|
-
|
|
304
|
+
const name = filePkg.split('/').slice(-2)[0];
|
|
374
305
|
// check if '-' prefix exists
|
|
375
306
|
if (name.substring(0, 1) === '-') {
|
|
376
307
|
// skip
|
|
377
308
|
continue;
|
|
378
309
|
}
|
|
379
|
-
// check if full name
|
|
380
|
-
if (name.indexOf('egg-born-suite-') > -1) {
|
|
381
|
-
const pathSrc = path.join(prefix, name);
|
|
382
|
-
name = name.substring('egg-born-suite-'.length);
|
|
383
|
-
filePkg = path.join(prefix, name, 'package.json');
|
|
384
|
-
const pathDest = path.join(prefix, name);
|
|
385
|
-
fse.moveSync(pathSrc, pathDest);
|
|
386
|
-
// throw new Error(`Should use relative name for local suite: ${name}`);
|
|
387
|
-
}
|
|
388
310
|
// info
|
|
389
|
-
const info =
|
|
311
|
+
const info = (0, module_info_1.parseInfo)(name, 'suite');
|
|
390
312
|
if (!info) {
|
|
391
313
|
throw new Error(`suite name is not valid: ${name}`);
|
|
392
314
|
}
|
|
393
|
-
info.vendor = __path.vendor;
|
|
394
315
|
// check if exists
|
|
395
|
-
if (
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
316
|
+
if (suites[info.relativeName])
|
|
317
|
+
continue;
|
|
318
|
+
// info
|
|
319
|
+
info.vendor = __path.vendor;
|
|
320
|
+
info.node_modules = __path.node_modules;
|
|
321
|
+
info.originalName = name;
|
|
322
|
+
// suite
|
|
323
|
+
const root = path_1.default.dirname(filePkg);
|
|
324
|
+
const suite = {
|
|
325
|
+
name,
|
|
326
|
+
info,
|
|
327
|
+
root,
|
|
328
|
+
pkg: filePkg,
|
|
329
|
+
modules: [],
|
|
330
|
+
};
|
|
331
|
+
// record
|
|
332
|
+
suites[info.relativeName] = suite;
|
|
408
333
|
}
|
|
409
334
|
}
|
|
410
335
|
// ok
|
|
@@ -451,4 +376,9 @@ function __checkSuites(context, suites) {
|
|
|
451
376
|
}
|
|
452
377
|
}
|
|
453
378
|
}
|
|
379
|
+
async function __loadCabloyConfig() {
|
|
380
|
+
const __cabloyConfig = egg_born_utils_1.default.cabloyConfig;
|
|
381
|
+
const { config } = await __cabloyConfig.load();
|
|
382
|
+
return config;
|
|
383
|
+
}
|
|
454
384
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IModule, ISuite } from '@cabloy/module-info';
|
|
2
|
+
export interface IModuleGlobOptions {
|
|
3
|
+
projectPath: string;
|
|
4
|
+
disabledModules?: string[];
|
|
5
|
+
disabledSuites?: string[];
|
|
6
|
+
log?: boolean;
|
|
7
|
+
type: 'front' | 'backend';
|
|
8
|
+
loadPackage?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IModuleGlobContext {
|
|
11
|
+
options: IModuleGlobOptions;
|
|
12
|
+
suites: Record<string, ISuite>;
|
|
13
|
+
modules: Record<string, IModule>;
|
|
14
|
+
modulesArray: IModule[];
|
|
15
|
+
modulesLast: IModule[];
|
|
16
|
+
modulesLocal: Record<string, IModule>;
|
|
17
|
+
modulesGlobal: Record<string, IModule>;
|
|
18
|
+
modulesMonkey: Record<string, IModule>;
|
|
19
|
+
suitesLocal: Record<string, ISuite>;
|
|
20
|
+
suitesVendor: Record<string, ISuite>;
|
|
21
|
+
disabledModules: Record<string, boolean>;
|
|
22
|
+
disabledSuites: Record<string, boolean>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=interface.d.ts.map
|
package/dist/meta.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const __pathSuites: ({
|
|
2
|
+
prefix: string;
|
|
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
|
+
})[];
|
|
27
|
+
//# sourceMappingURL=meta.d.ts.map
|
package/dist/meta.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__pathsModules = exports.__pathSuites = void 0;
|
|
4
|
+
exports.__pathSuites = [
|
|
5
|
+
{
|
|
6
|
+
prefix: 'src/suite/',
|
|
7
|
+
vendor: false,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
prefix: 'src/suite-vendor/',
|
|
11
|
+
vendor: true,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
prefix: 'node_modules/cabloy-suite-api-',
|
|
15
|
+
vendor: true,
|
|
16
|
+
node_modules: true,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
exports.__pathsModules = [
|
|
20
|
+
{
|
|
21
|
+
prefix: 'src/module/',
|
|
22
|
+
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
|
+
},
|
|
32
|
+
{
|
|
33
|
+
prefix: 'src/suite/*/modules/',
|
|
34
|
+
vendor: false,
|
|
35
|
+
source: true,
|
|
36
|
+
fronts: [{ js: 'front/src/main.js' }, { js: 'dist/front.js' }],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
prefix: 'src/module-vendor/',
|
|
40
|
+
vendor: true,
|
|
41
|
+
source: false,
|
|
42
|
+
fronts: [{ js: 'dist/front.js' }, { js: 'front/src/main.js' }],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
prefix: 'src/suite-vendor/*/modules/',
|
|
46
|
+
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
|
+
},
|
|
57
|
+
];
|
|
58
|
+
//# sourceMappingURL=meta.js.map
|
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/module-glob",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "cabloy module-glob",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": [
|
|
11
|
+
"./src/index.ts",
|
|
12
|
+
"./dist/index.d.ts"
|
|
13
|
+
],
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"default": "./src/index.ts"
|
|
17
|
+
},
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
10
20
|
"files": [
|
|
11
21
|
"dist/**/*.js",
|
|
12
22
|
"dist/**/*.d.ts"
|
|
@@ -21,6 +31,9 @@
|
|
|
21
31
|
"cabloy"
|
|
22
32
|
],
|
|
23
33
|
"author": "zhennann",
|
|
24
|
-
"
|
|
25
|
-
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@cabloy/module-info": "workspace:^",
|
|
36
|
+
"boxen": "^4.2.0",
|
|
37
|
+
"egg-born-utils": "^1.1.9"
|
|
38
|
+
}
|
|
26
39
|
}
|