folder-generator 3.0.0 → 3.0.1

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/generator.js +7 -11
  2. package/package.json +1 -1
package/lib/generator.js CHANGED
@@ -66,9 +66,12 @@ function parseIndentedPathFormat(text) {
66
66
 
67
67
  for (const line of lines) {
68
68
  const indent = line.match(/^\s*/)[0].length;
69
- const raw = line.trim();
70
- const isExplicitDir = raw.endsWith('/');
71
69
 
70
+ // ⬇️ strip inline comments BEFORE processing
71
+ const raw = line.trim().replace(/(#|\/\/|--).*/, '').trim();
72
+ if (!raw) continue;
73
+
74
+ const isExplicitDir = raw.endsWith('/');
72
75
  const trimmed = raw.replace(/\/$/, '');
73
76
 
74
77
  while (stack.length && indent <= stack[stack.length - 1].indent) {
@@ -80,24 +83,16 @@ function parseIndentedPathFormat(text) {
80
83
 
81
84
  parts.forEach((part, index) => {
82
85
  const isLast = index === parts.length - 1;
83
-
84
- // ✅ FIX: directory only if NOT last OR explicitly marked
85
86
  const isDirectory = !isLast || isExplicitDir;
86
87
 
87
88
  let existing = parent.children.find(c => c.name === part);
88
89
  if (!existing) {
89
- existing = {
90
- name: part,
91
- children: [],
92
- isDirectory
93
- };
90
+ existing = { name: part, children: [], isDirectory };
94
91
  parent.children.push(existing);
95
92
  }
96
-
97
93
  parent = existing;
98
94
  });
99
95
 
100
- // Push only real directories
101
96
  if (isExplicitDir) {
102
97
  stack.push({ node: parent, indent });
103
98
  }
@@ -107,6 +102,7 @@ function parseIndentedPathFormat(text) {
107
102
  }
108
103
 
109
104
 
105
+
110
106
  /**
111
107
  * ======================
112
108
  * FILE CREATION (OLD)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "folder-generator",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "CLI tool to generate folder structures from text input",
5
5
  "bin": {
6
6
  "foldgen": "./bin/cli.js"