@cabloy/module-glob 5.2.56 → 5.2.58

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.js CHANGED
@@ -1,10 +1,10 @@
1
- import path from 'node:path';
2
1
  import { parseInfoPro } from '@cabloy/module-info';
3
2
  import { checkMeta } from '@cabloy/utils';
4
3
  import boxen from 'boxen';
5
4
  import chalk from 'chalk';
6
5
  import fse from 'fs-extra';
7
6
  import { globbySync } from 'globby';
7
+ import path from 'node:path';
8
8
  import semver from 'semver';
9
9
 
10
10
  const __pathSuites = [{
@@ -115,6 +115,9 @@ async function glob(options) {
115
115
  // order
116
116
  __orderModules(context, modules);
117
117
 
118
+ // check disables, after __orderModules
119
+ __checkModulesDisables(context);
120
+
118
121
  // log
119
122
  __logModules(context, log);
120
123
  __logSuites(context, log);
@@ -136,6 +139,21 @@ async function glob(options) {
136
139
  function getPackageModuleNode(projectMode) {
137
140
  return ['zova', 'vona'].includes(projectMode) ? `${projectMode}Module` : 'cabloyModule';
138
141
  }
142
+ function __checkModulesDisables(context) {
143
+ for (const key of Object.keys(context.modules)) {
144
+ const module = context.modules[key];
145
+ if (!module) continue;
146
+ const disables = module.package.zovaModule?.disables ?? module.package.vonaModule?.disables;
147
+ if (!disables) continue;
148
+ for (const name of disables) {
149
+ delete context.modules[name];
150
+ const index = context.modulesArray.findIndex(item => item.info.relativeName === name);
151
+ if (index > -1) {
152
+ context.modulesArray.splice(index, 1);
153
+ }
154
+ }
155
+ }
156
+ }
139
157
  async function __loadPackage(context, modules) {
140
158
  const promises = [];
141
159
  const modulesArray = [];
@@ -213,18 +231,20 @@ function __orderDependencies(context, modules, module, moduleRelativeName) {
213
231
  const dependencies = module.package[moduleNode].dependencies;
214
232
  for (const key in dependencies) {
215
233
  const subModule = modules[key];
216
- if (!subModule) {
217
- const message = `${chalk.keyword('orange')(`module ${moduleRelativeName} disabled`)}, because ${chalk.keyword('cyan')(`module ${key} not exists`)}`;
218
- console.log(`\n${boxen(message, boxenOptions)}\n`);
219
- enabled = false; // process.exit(0);
220
- continue;
221
- }
222
- const subModuleVersion = dependencies[key];
223
- if (semver.lt(subModule.package.version, subModuleVersion)) {
224
- console.warn(chalk.cyan(`module ${key} is old`));
225
- process.exit(0);
234
+ if (context.options.check !== false) {
235
+ if (!subModule) {
236
+ const message = `${chalk.keyword('orange')(`module ${moduleRelativeName} disabled`)}, because ${chalk.keyword('cyan')(`module ${key} not exists`)}`;
237
+ console.log(`\n${boxen(message, boxenOptions)}\n`);
238
+ enabled = false; // process.exit(0);
239
+ continue;
240
+ }
241
+ const subModuleVersion = dependencies[key];
242
+ if (semver.lt(subModule.package.version, subModuleVersion)) {
243
+ console.warn(chalk.cyan(`module ${key} is old`));
244
+ process.exit(0);
245
+ }
226
246
  }
227
- if (!__pushModule(context, modules, key)) {
247
+ if (subModule && !__pushModule(context, modules, key)) {
228
248
  enabled = false;
229
249
  }
230
250
  }
@@ -5,6 +5,7 @@ export interface IModuleGlobOptions {
5
5
  disabledModules?: string[] | string;
6
6
  disabledSuites?: string[] | string;
7
7
  log?: boolean;
8
+ check?: boolean;
8
9
  meta?: {};
9
10
  disableCheckDependencies?: boolean;
10
11
  }
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@cabloy/module-glob",
3
- "type": "module",
4
- "version": "5.2.56",
3
+ "version": "5.2.58",
4
+ "gitHead": "0eab9dc4a5622caffe89e7b1b3f02c08ccbc4c4b",
5
5
  "description": "cabloy module-glob",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "author": "zhennann",
10
6
  "keywords": [
11
- "framework",
12
- "cabloy"
7
+ "cabloy",
8
+ "framework"
9
+ ],
10
+ "author": "zhennann",
11
+ "files": [
12
+ "dist"
13
13
  ],
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "types": [
@@ -21,11 +22,11 @@
21
22
  },
22
23
  "./package.json": "./package.json"
23
24
  },
24
- "files": [
25
- "dist"
26
- ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
27
28
  "dependencies": {
28
- "@cabloy/module-info": "^1.3.41",
29
+ "@cabloy/module-info": "^2.0.0",
29
30
  "@cabloy/utils": "^2.0.24",
30
31
  "boxen": "^4.2.0",
31
32
  "chalk": "^3.0.0",
@@ -33,7 +34,6 @@
33
34
  "globby": "^16.0.0",
34
35
  "semver": "^7.7.1"
35
36
  },
36
- "gitHead": "0eab9dc4a5622caffe89e7b1b3f02c08ccbc4c4b",
37
37
  "scripts": {
38
38
  "clean": "rimraf dist tsconfig.tsbuildinfo",
39
39
  "tsc:publish": "npm run clean && vona :bin:buildGeneral && tsc"