msfs-layout-generator 0.3.3 → 0.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.
@@ -41,22 +41,31 @@ const getAllFiles = async (dirPath) => {
41
41
  const files = [];
42
42
  async function readDirectory(currentPath) {
43
43
  try {
44
- for (const item of await (0, promises_1.readdir)(currentPath)) {
45
- const itemPath = path.join(currentPath, item);
46
- const receivedFile = await (0, promises_1.stat)(itemPath);
47
- if (receivedFile.isDirectory()) {
44
+ const directs = await (0, promises_1.readdir)(currentPath, { withFileTypes: true });
45
+ for (const dirent of directs) {
46
+ const itemPath = path.join(currentPath, dirent.name);
47
+ if (dirent.isDirectory()) {
48
48
  await readDirectory(itemPath);
49
49
  }
50
- else {
50
+ else if (dirent.isFile()) {
51
51
  files.push(itemPath);
52
52
  }
53
+ else if (dirent.isSymbolicLink()) {
54
+ const stats = await (0, promises_1.stat)(itemPath);
55
+ if (stats.isDirectory()) {
56
+ await readDirectory(itemPath);
57
+ }
58
+ else {
59
+ files.push(itemPath);
60
+ }
61
+ }
53
62
  }
54
63
  }
55
64
  catch (e) {
56
65
  if (e instanceof Error) {
57
- throw new _errors_1.ReadingDirError(`Failed to read directory ${path}: ${e.message}.`);
66
+ throw new _errors_1.ReadingDirError(`Failed to read directory ${currentPath}: ${e.message}.`);
58
67
  }
59
- throw new _errors_1.ReadingDirError(`Failed to read directory. Path: ${path}`);
68
+ throw new _errors_1.ReadingDirError(`Failed to read directory. Path: ${currentPath}`);
60
69
  }
61
70
  }
62
71
  await readDirectory(dirPath);
@@ -230,9 +230,8 @@ const processLayout = async (packageDir, options = {}) => {
230
230
  layout.content.push(content);
231
231
  }
232
232
  catch (error) {
233
- if (debug) {
234
- log(`Error processing file ${file}: ${error.message}`, 'info');
235
- }
233
+ const msg = `Error processing file ${file}: ${error.message}`;
234
+ log(msg, debug ? 'info' : 'warn');
236
235
  excludedCount++;
237
236
  }
238
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "msfs-layout-generator",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Generate layout.json for MSFS community packages",
5
5
  "repository": {
6
6
  "type": "git",