xcraft-core-utils 4.3.1 → 4.3.4

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.
Files changed (2) hide show
  1. package/lib/modules.js +20 -7
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -93,7 +93,10 @@ exports.extractConfigDeps = (libDir, configJson) => {
93
93
 
94
94
  Object.keys(configJson).forEach((appId) => {
95
95
  const appCfg = configJson[appId];
96
- if (appCfg['xcraft-core-horde']) {
96
+ if (
97
+ appCfg['xcraft-core-horde'] &&
98
+ fse.existsSync(path.join(libDir, 'xcraft-core-horde'))
99
+ ) {
97
100
  deps['xcraft-core-horde'] = true;
98
101
  }
99
102
 
@@ -102,9 +105,11 @@ exports.extractConfigDeps = (libDir, configJson) => {
102
105
  return;
103
106
  }
104
107
 
105
- serverCfg.modules.forEach((mod) => {
106
- deps[mod] = true;
107
- });
108
+ serverCfg.modules
109
+ .filter((mod) => fse.existsSync(path.join(libDir, mod)))
110
+ .forEach((mod) => {
111
+ deps[mod] = true;
112
+ });
108
113
  });
109
114
 
110
115
  if (!Object.keys(deps).length) {
@@ -169,9 +174,17 @@ exports.extractAllJs = (libDir, modules) => {
169
174
  const location = path.join(libDir, mod);
170
175
  const files = xFs
171
176
  .lsall(location, true)
172
- .filter(
173
- (file) => !/node_modules/.test(file.substring(location.length + 1))
174
- )
177
+ .filter((file) => {
178
+ const relativePath = file.substring(location.length + 1);
179
+ const items = relativePath.split(path.sep);
180
+ if (items.includes('node_modules')) {
181
+ return false;
182
+ }
183
+ if (items[0] === 'test' || items[0] === 'species') {
184
+ return false;
185
+ }
186
+ return true;
187
+ })
175
188
  .filter((file) => /\.js$/.test(file));
176
189
  list = list.concat(files);
177
190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xcraft-core-utils",
3
- "version": "4.3.1",
3
+ "version": "4.3.4",
4
4
  "description": "Xcraft utils",
5
5
  "main": "index.js",
6
6
  "engines": {