tree-fs 0.1.2 → 0.1.3
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/README.md +8 -0
- package/package.json +1 -1
- package/src/normaliser.js +16 -3
package/README.md
CHANGED
|
@@ -131,6 +131,14 @@ project
|
|
|
131
131
|
Known files without extensions are correctly identified as files.
|
|
132
132
|
* `Dockerfile`, `Makefile`, `LICENSE`, `Procfile`, `.gitignore`, `Jenkinsfile`
|
|
133
133
|
|
|
134
|
+
### 6. Indicators & Comments
|
|
135
|
+
We strip out common markers used to highlight specific files in documentation.
|
|
136
|
+
```text
|
|
137
|
+
project
|
|
138
|
+
├── src/ <-- Working directory
|
|
139
|
+
├── utils.js // Deprecated
|
|
140
|
+
└── .env # Do not commit
|
|
141
|
+
|
|
134
142
|
## 📦 CI/CD Integration
|
|
135
143
|
|
|
136
144
|
You can use `tree-fs` to scaffold environments in GitHub Actions or pipelines.
|
package/package.json
CHANGED
package/src/normaliser.js
CHANGED
|
@@ -16,9 +16,22 @@ function normaliseLines(input) {
|
|
|
16
16
|
const match = normalizedRaw.match(STRIP_REGEX)
|
|
17
17
|
const prefixLength = match ? match[0].length : 0
|
|
18
18
|
|
|
19
|
-
// 3. Strip comments
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// 3. Strip comments
|
|
20
|
+
// Look for multiple comment styles. We use "space + marker" to avoid false positives.
|
|
21
|
+
const commentMarkers = [" #", " <--", " //"]
|
|
22
|
+
let splitIndex = -1
|
|
23
|
+
|
|
24
|
+
for (const marker of commentMarkers) {
|
|
25
|
+
const idx = normalizedRaw.indexOf(marker)
|
|
26
|
+
if (idx !== -1) {
|
|
27
|
+
// Keep the earliest marker found
|
|
28
|
+
if (splitIndex === -1 || idx < splitIndex) {
|
|
29
|
+
splitIndex = idx
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let cleaned = splitIndex !== -1 ? normalizedRaw.substring(0, splitIndex) : normalizedRaw
|
|
22
35
|
|
|
23
36
|
// 4. Check for explicit trailing slash
|
|
24
37
|
const endsWithSlash = cleaned.trim().endsWith("/")
|