spec-up-t 1.2.3 → 1.2.5

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 (61) hide show
  1. package/.sonarlint/connectedMode.json +5 -0
  2. package/assets/compiled/body.js +35 -32
  3. package/assets/compiled/head.css +7 -5
  4. package/assets/compiled/head.js +3 -3
  5. package/assets/css/add-bootstrap-classes-to-images.css +34 -0
  6. package/assets/css/adjust-font-size.css +6 -11
  7. package/assets/css/backToTop.css +0 -1
  8. package/assets/css/image-full-size.css +44 -0
  9. package/assets/css/index.css +1 -2
  10. package/assets/css/pdf-styles.css +23 -27
  11. package/assets/css/repo-issues.css +0 -6
  12. package/assets/css/search.css +0 -1
  13. package/assets/css/sidebar-toc.css +13 -12
  14. package/assets/css/terms-and-definitions.css +43 -37
  15. package/assets/js/add-bootstrap-classes-to-images.js +98 -0
  16. package/assets/js/add-href-to-snapshot-link.js +2 -1
  17. package/assets/js/addAnchorsToTerms.js +0 -1
  18. package/assets/js/adjust-font-size.js +0 -9
  19. package/assets/js/create-alphabet-index.js +12 -3
  20. package/assets/js/create-term-filter.js +12 -0
  21. package/assets/js/custom-elements.js +13 -18
  22. package/assets/js/declare-markdown-it.js +1 -1
  23. package/assets/js/hide-show-utility-container.js +17 -0
  24. package/assets/js/highlightMenuItems.js +3 -3
  25. package/assets/js/image-full-size.js +76 -0
  26. package/assets/js/index.js +1 -5
  27. package/assets/js/insert-trefs.js +2 -2
  28. package/assets/js/modal.js +3 -3
  29. package/assets/js/search.js +15 -3
  30. package/assets/js/utils.js +2 -3
  31. package/index.js +7 -17
  32. package/package.json +2 -2
  33. package/src/README.md +3 -3
  34. package/src/add-remove-xref-source.js +0 -2
  35. package/src/asset-map.json +5 -0
  36. package/src/collect-external-references.js +187 -179
  37. package/src/collectExternalReferences/fetchTermsFromIndex.js +2 -1
  38. package/src/config/paths.js +2 -2
  39. package/src/create-external-specs-list.js +1 -1
  40. package/src/create-term-index.js +126 -22
  41. package/src/fix-markdown-files.js +152 -90
  42. package/src/health-check/external-specs-checker.js +173 -94
  43. package/src/health-check/output-gitignore-checker.js +327 -191
  44. package/src/health-check/specs-configuration-checker.js +288 -210
  45. package/src/health-check/term-references-checker.js +200 -123
  46. package/src/health-check/tref-term-checker.js +264 -179
  47. package/src/health-check.js +52 -36
  48. package/src/init.js +1 -4
  49. package/src/insert-term-index.js +5 -5
  50. package/src/install-from-boilerplate/add-scripts-keys.js +3 -1
  51. package/src/install-from-boilerplate/boilerplate/gitignore +2 -1
  52. package/src/install-from-boilerplate/config-system-files.js +9 -1
  53. package/src/install-from-boilerplate/copy-system-files.js +1 -1
  54. package/src/markdown-it-extensions.js +199 -106
  55. package/src/references.js +1 -2
  56. package/src/utils/doesUrlExist.js +7 -5
  57. package/src/utils/fetch.js +14 -14
  58. package/templates/template.html +1 -2
  59. package/assets/js/insert-xrefs.js +0 -370
  60. package/src/create-term-relations.js +0 -131
  61. package/src/prepare-tref.js +0 -174
@@ -16,234 +16,370 @@ function isPathGitIgnored(projectRoot, targetPath) {
16
16
  execSync(`git -C "${projectRoot}" check-ignore -q "${targetPath}"`, { stdio: 'ignore' });
17
17
  return true; // Path is ignored (command exited with status 0)
18
18
  } catch (error) {
19
+ console.log(`Error checking if path is gitignored: ${error.message}`);
19
20
  return false; // Path is not ignored (command exited with non-zero status)
20
21
  }
21
22
  }
22
23
 
23
24
  /**
24
- * Check if the output directory is being ignored by Git
25
+ * Check if specs.json exists and return relevant result
25
26
  * @param {string} projectRoot - Root directory of the project
26
- * @returns {Promise<Array>} - Array of check results
27
+ * @returns {Object} - Result object with specs file check result
27
28
  */
28
- async function checkOutputDirGitIgnore(projectRoot) {
29
- const results = [];
29
+ function checkSpecsFileExists(projectRoot) {
30
+ const specsPath = path.join(projectRoot, 'specs.json');
30
31
 
31
- try {
32
- // Path to the project's specs.json
33
- const specsPath = path.join(projectRoot, 'specs.json');
34
-
35
- // Check if specs.json exists
36
- if (!fs.existsSync(specsPath)) {
37
- return [{
32
+ if (!fs.existsSync(specsPath)) {
33
+ return {
34
+ result: [{
38
35
  name: 'Find specs.json file',
39
36
  success: false,
40
37
  details: 'specs.json file not found in project root'
41
- }];
42
- }
43
-
44
- results.push({
38
+ }],
39
+ specsPath: null
40
+ };
41
+ }
42
+
43
+ return {
44
+ result: [{
45
45
  name: 'Find specs.json file',
46
46
  success: true,
47
47
  details: 'specs.json file found'
48
+ }],
49
+ specsPath
50
+ };
51
+ }
52
+
53
+ /**
54
+ * Extract output path from specs.json
55
+ * @param {string} specsPath - Path to specs.json file
56
+ * @returns {Object} - Result object with output path check result
57
+ */
58
+ function extractOutputPath(specsPath) {
59
+ const results = [];
60
+
61
+ // Read specs.json to get the output path
62
+ const specsContent = fs.readFileSync(specsPath, 'utf8');
63
+ const specs = JSON.parse(specsContent);
64
+
65
+ // Get the output_path value
66
+ const outputPath = specs.specs?.[0]?.output_path;
67
+
68
+ if (!outputPath) {
69
+ results.push({
70
+ name: 'Find output_path field',
71
+ success: false,
72
+ details: 'output_path field not found in specs.json'
73
+ });
74
+ return { results, outputPath: null };
75
+ }
76
+
77
+ results.push({
78
+ name: 'Find output_path field',
79
+ success: true,
80
+ details: `output_path field found: "${outputPath}"`
81
+ });
82
+
83
+ // Normalize the path to handle different formats (./, /, etc.)
84
+ const normalizedPath = outputPath.replace(/^\.\/|^\//, '');
85
+
86
+ return { results, outputPath, normalizedPath };
87
+ }
88
+
89
+ /**
90
+ * Check if the output directory exists
91
+ * @param {string} projectRoot - Root directory of the project
92
+ * @param {string} outputPath - Output path from specs.json
93
+ * @param {string} normalizedPath - Normalized output path
94
+ * @returns {Object} - Result with output directory check
95
+ */
96
+ function checkOutputDirExists(projectRoot, outputPath, normalizedPath) {
97
+ // Check if the path exists
98
+ const fullPath = path.join(projectRoot, normalizedPath);
99
+ const outputPathExists = fs.existsSync(fullPath);
100
+
101
+ if (!outputPathExists) {
102
+ return {
103
+ name: 'Output directory existence',
104
+ status: 'warning',
105
+ success: true, // Still considered a "success" for backward compatibility
106
+ details: `Output directory "${outputPath}" does not exist yet. This is OK if you haven't rendered the specs yet.`
107
+ };
108
+ }
109
+
110
+ return {
111
+ name: 'Output directory existence',
112
+ success: true,
113
+ details: `Output directory "${outputPath}" exists`
114
+ };
115
+ }
116
+
117
+ /**
118
+ * Check if .gitignore file exists
119
+ * @param {string} projectRoot - Root directory of the project
120
+ * @param {string} normalizedPath - Normalized output path
121
+ * @returns {Object} - Result with gitignore check details
122
+ */
123
+ function checkGitignoreExists(projectRoot, normalizedPath) {
124
+ const results = [];
125
+
126
+ const gitignorePath = path.join(projectRoot, '.gitignore');
127
+ if (!fs.existsSync(gitignorePath)) {
128
+ results.push({
129
+ name: 'Find .gitignore file',
130
+ status: 'warning',
131
+ success: true, // Still considered a "success" for backward compatibility
132
+ details: '.gitignore file not found in project root. Consider adding one for better version control.'
48
133
  });
49
134
 
50
- // Read specs.json to get the output path
51
- const specsContent = fs.readFileSync(specsPath, 'utf8');
52
- const specs = JSON.parse(specsContent);
53
-
54
- // Get the output_path value
55
- const outputPath = specs.specs?.[0]?.output_path;
56
-
57
- if (!outputPath) {
58
- results.push({
59
- name: 'Find output_path field',
60
- success: false,
61
- details: 'output_path field not found in specs.json'
62
- });
63
- return results;
64
- }
65
-
135
+ // If no .gitignore, we can assume the output path is not ignored
66
136
  results.push({
67
- name: 'Find output_path field',
137
+ name: 'Check if output directory is gitignored',
68
138
  success: true,
69
- details: `output_path field found: "${outputPath}"`
139
+ details: 'No .gitignore file found, so output directory is not being ignored'
70
140
  });
71
141
 
72
- // Normalize the path to handle different formats (./, /, etc.)
73
- const normalizedPath = outputPath.replace(/^\.\/|^\//, '');
74
-
75
- // Check if the path exists
76
- const fullPath = path.join(projectRoot, normalizedPath);
77
- const outputPathExists = fs.existsSync(fullPath);
78
-
79
- if (!outputPathExists) {
80
- results.push({
81
- name: 'Output directory existence',
82
- status: 'warning',
83
- success: true, // Still considered a "success" for backward compatibility
84
- details: `Output directory "${outputPath}" does not exist yet. This is OK if you haven't rendered the specs yet.`
85
- });
86
- } else {
87
- results.push({
88
- name: 'Output directory existence',
89
- success: true,
90
- details: `Output directory "${outputPath}" exists`
91
- });
142
+ return { results, gitignoreExists: false };
143
+ }
144
+
145
+ results.push({
146
+ name: 'Find .gitignore file',
147
+ success: true,
148
+ details: '.gitignore file found'
149
+ });
150
+
151
+ return { results, gitignoreExists: true, gitignorePath };
152
+ }
153
+
154
+ /**
155
+ * Filter non-comment lines from gitignore content
156
+ * @param {string} content - Content of .gitignore file
157
+ * @returns {Array} - Array of non-comment, non-empty lines
158
+ */
159
+ function getRelevantGitignoreLines(content) {
160
+ const allLines = content.split('\n');
161
+
162
+ return allLines.filter(line => {
163
+ const trimmedLine = line.trim();
164
+ return trimmedLine !== '' && !trimmedLine.startsWith('#');
165
+ }).map(line => line.trim());
166
+ }
167
+
168
+ /**
169
+ * Check for patterns that might ignore output directory
170
+ * @param {Array} lines - Array of gitignore lines
171
+ * @param {string} normalizedPath - Normalized output path
172
+ * @param {string} dirName - Directory name from path
173
+ * @returns {Array} - Array of ignoring patterns found
174
+ */
175
+ function findOutputDirIgnorePatterns(lines, normalizedPath, dirName) {
176
+ const dirIgnorePatterns = [];
177
+
178
+ for (const trimmedLine of lines) {
179
+ // Directly check for common patterns that would ignore the output directory
180
+ if (
181
+ trimmedLine === normalizedPath ||
182
+ trimmedLine === `/${normalizedPath}` ||
183
+ trimmedLine === `./${normalizedPath}` ||
184
+ trimmedLine === `${normalizedPath}/` ||
185
+ trimmedLine === `/${normalizedPath}/` ||
186
+ trimmedLine === `./${normalizedPath}/` ||
187
+ // Check for just the directory name (e.g., "docs")
188
+ trimmedLine === dirName ||
189
+ trimmedLine === `/${dirName}` ||
190
+ trimmedLine === `./${dirName}` ||
191
+ trimmedLine === `${dirName}/` ||
192
+ trimmedLine === `/${dirName}/` ||
193
+ trimmedLine === `./${dirName}/` ||
194
+ // Check for wildcards covering all directories
195
+ trimmedLine === '*/' ||
196
+ // Check for wildcards that might match our path using regex
197
+ (trimmedLine.includes('*') && new RegExp('^' + trimmedLine.replace(/\*/g, '.*').replace(/\//g, '\\/') + '$').test(normalizedPath))
198
+ ) {
199
+ dirIgnorePatterns.push(trimmedLine);
200
+ }
201
+ }
202
+
203
+ return dirIgnorePatterns;
204
+ }
205
+
206
+ /**
207
+ * Check for patterns that might ignore HTML files
208
+ * @param {Array} lines - Array of gitignore lines
209
+ * @returns {Array} - Array of HTML ignoring patterns found
210
+ */
211
+ function findHtmlIgnorePatterns(lines) {
212
+ const htmlIgnorePatterns = [];
213
+
214
+ for (const trimmedLine of lines) {
215
+ if (
216
+ trimmedLine === 'index.html' ||
217
+ trimmedLine === '*.html' ||
218
+ trimmedLine === '/index.html' ||
219
+ trimmedLine === '**/index.html' ||
220
+ trimmedLine === '**/*.html'
221
+ ) {
222
+ htmlIgnorePatterns.push(trimmedLine);
223
+ }
224
+ }
225
+
226
+ return htmlIgnorePatterns;
227
+ }
228
+
229
+ /**
230
+ * Find complex patterns that might be affecting HTML files
231
+ * @param {Array} lines - Array of gitignore lines
232
+ * @returns {Array} - Array of complex patterns found
233
+ */
234
+ function findComplexHtmlPatterns(lines) {
235
+ const patterns = [];
236
+
237
+ for (const trimmedLine of lines) {
238
+ // Check for wildcards and patterns that might match index.html
239
+ if (trimmedLine.includes('*') || trimmedLine.includes('.html')) {
240
+ patterns.push(trimmedLine);
92
241
  }
242
+ }
243
+
244
+ return patterns;
245
+ }
246
+
247
+ /**
248
+ * Check if HTML files in the output directory are being ignored by Git
249
+ * @param {string} projectRoot - Root directory of the project
250
+ * @param {string} normalizedPath - Normalized output path
251
+ * @param {string} outputPath - Original output path
252
+ * @param {Array} relevantLines - Relevant lines from .gitignore
253
+ * @returns {Array} - Results for HTML files gitignore check
254
+ */
255
+ function checkHtmlFilesGitignore(projectRoot, normalizedPath, outputPath, relevantLines) {
256
+ const results = [];
257
+ const htmlIgnorePatterns = findHtmlIgnorePatterns(relevantLines);
258
+
259
+ if (htmlIgnorePatterns.length > 0) {
260
+ results.push({
261
+ name: 'Check if index.html files are gitignored',
262
+ success: false,
263
+ details: `Found patterns in .gitignore that would ignore HTML files: ${htmlIgnorePatterns.join(', ')}. This is problematic as they're crucial output files.`
264
+ });
265
+ return results;
266
+ }
267
+
268
+ // Check if index.html would be ignored
269
+ const indexHtmlPath = path.join(normalizedPath, 'index.html');
270
+ const isIndexHtmlIgnored = isPathGitIgnored(projectRoot, indexHtmlPath);
271
+
272
+ results.push({
273
+ name: 'Check if index.html files are gitignored',
274
+ success: !isIndexHtmlIgnored,
275
+ details: isIndexHtmlIgnored
276
+ ? `index.html files in the output directory would be ignored by Git. This is problematic as they're crucial output files.`
277
+ : `index.html files in the output directory are properly tracked by Git.`
278
+ });
279
+
280
+ // If index.html is ignored but we couldn't find an explicit pattern, look for more complex patterns
281
+ if (isIndexHtmlIgnored && htmlIgnorePatterns.length === 0) {
282
+ const complexPatterns = findComplexHtmlPatterns(relevantLines);
93
283
 
94
- // Check if .gitignore exists
95
- const gitignorePath = path.join(projectRoot, '.gitignore');
96
- if (!fs.existsSync(gitignorePath)) {
284
+ if (complexPatterns.length > 0) {
97
285
  results.push({
98
- name: 'Find .gitignore file',
286
+ name: 'Found complex .gitignore entries potentially affecting HTML files',
99
287
  status: 'warning',
100
288
  success: true, // Still considered a "success" for backward compatibility
101
- details: '.gitignore file not found in project root. Consider adding one for better version control.'
102
- });
103
-
104
- // If no .gitignore, we can assume the output path is not ignored
105
- results.push({
106
- name: 'Check if output directory is gitignored',
107
- success: true,
108
- details: 'No .gitignore file found, so output directory is not being ignored'
289
+ details: `The following entries in .gitignore might cause HTML files to be ignored: ${complexPatterns.join(', ')}. Consider reviewing these patterns.`
109
290
  });
110
-
111
- return results;
291
+ }
292
+ }
293
+
294
+ return results;
295
+ }
296
+
297
+ /**
298
+ * Check if output directory is being ignored by Git
299
+ * @param {string} projectRoot - Root directory of the project
300
+ * @param {string} normalizedPath - Normalized output path
301
+ * @param {string} outputPath - Original output path
302
+ * @param {string} dirName - Directory name from path
303
+ * @param {Array} relevantLines - Relevant lines from .gitignore
304
+ * @returns {Array} - Results for output directory gitignore check
305
+ */
306
+ function checkOutputDirIgnorePatterns(projectRoot, normalizedPath, outputPath, dirName, relevantLines) {
307
+ const dirIgnorePatterns = findOutputDirIgnorePatterns(relevantLines, normalizedPath, dirName);
308
+
309
+ if (dirIgnorePatterns.length > 0) {
310
+ return [{
311
+ name: 'Check if output directory is gitignored',
312
+ success: false,
313
+ details: `Found patterns in .gitignore that would ignore the output directory: ${dirIgnorePatterns.join(', ')}. Remove these entries to ensure generated content is tracked.`
314
+ }];
315
+ }
316
+
317
+ // Fall back to using git check-ignore for verification
318
+ const isIgnored = isPathGitIgnored(projectRoot, normalizedPath);
319
+
320
+ return [{
321
+ name: 'Check if output directory is gitignored',
322
+ success: !isIgnored,
323
+ details: isIgnored
324
+ ? `Output directory "${outputPath}" is being ignored by Git. This could be due to a complex pattern in .gitignore. Remove any entries that might affect this directory.`
325
+ : `Output directory "${outputPath}" is not being ignored by Git, which is good.`
326
+ }];
327
+ }
328
+
329
+ /**
330
+ * Check if the output directory is being ignored by Git
331
+ * @param {string} projectRoot - Root directory of the project
332
+ * @returns {Promise<Array>} - Array of check results
333
+ */
334
+ async function checkOutputDirGitIgnore(projectRoot) {
335
+ const results = [];
336
+
337
+ try {
338
+ // Check if specs.json exists
339
+ const specsCheck = checkSpecsFileExists(projectRoot);
340
+ if (!specsCheck.specsPath) {
341
+ return specsCheck.result;
112
342
  }
113
343
 
114
- results.push({
115
- name: 'Find .gitignore file',
116
- success: true,
117
- details: '.gitignore file found'
118
- });
344
+ results.push(...specsCheck.result);
119
345
 
120
- // Read .gitignore content
121
- const gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
122
- const lines = gitignoreContent.split('\n');
346
+ // Extract and validate output path
347
+ const outputPathCheck = extractOutputPath(specsCheck.specsPath);
348
+ if (!outputPathCheck.outputPath) {
349
+ return [...results, ...outputPathCheck.results];
350
+ }
123
351
 
124
- // Extract the directory name from the path
125
- const dirName = path.basename(normalizedPath);
352
+ results.push(...outputPathCheck.results);
353
+ const { outputPath, normalizedPath } = outputPathCheck;
126
354
 
127
- // IMPROVED: First directly check .gitignore for patterns that would ignore the output directory
128
- const dirIgnorePatterns = [];
355
+ // Check if output directory exists
356
+ const outputDirResult = checkOutputDirExists(projectRoot, outputPath, normalizedPath);
357
+ results.push(outputDirResult);
129
358
 
130
- for (const line of lines) {
131
- const trimmedLine = line.trim();
132
- // Skip empty lines and comments
133
- if (trimmedLine === '' || trimmedLine.startsWith('#')) {
134
- continue;
135
- }
136
-
137
- // Directly check for common patterns that would ignore the output directory
138
- if (
139
- trimmedLine === normalizedPath ||
140
- trimmedLine === `/${normalizedPath}` ||
141
- trimmedLine === `./${normalizedPath}` ||
142
- trimmedLine === `${normalizedPath}/` ||
143
- trimmedLine === `/${normalizedPath}/` ||
144
- trimmedLine === `./${normalizedPath}/` ||
145
- // Check for just the directory name (e.g., "docs")
146
- trimmedLine === dirName ||
147
- trimmedLine === `/${dirName}` ||
148
- trimmedLine === `./${dirName}` ||
149
- trimmedLine === `${dirName}/` ||
150
- trimmedLine === `/${dirName}/` ||
151
- trimmedLine === `./${dirName}/` ||
152
- // Check for wildcards covering all directories
153
- trimmedLine === '*/' ||
154
- // Check for wildcards that might match our path using regex
155
- (trimmedLine.includes('*') && new RegExp('^' + trimmedLine.replace(/\*/g, '.*').replace(/\//g, '\\/') + '$').test(normalizedPath))
156
- ) {
157
- dirIgnorePatterns.push(trimmedLine);
158
- }
159
- }
359
+ // Check if .gitignore exists
360
+ const gitignoreCheck = checkGitignoreExists(projectRoot, normalizedPath);
361
+ results.push(...gitignoreCheck.results);
160
362
 
161
- // If we found patterns that would ignore the output directory, report them regardless of git check-ignore
162
- if (dirIgnorePatterns.length > 0) {
163
- results.push({
164
- name: 'Check if output directory is gitignored',
165
- success: false,
166
- details: `Found patterns in .gitignore that would ignore the output directory: ${dirIgnorePatterns.join(', ')}. Remove these entries to ensure generated content is tracked.`
167
- });
168
- } else {
169
- // Fall back to using git check-ignore for verification
170
- const isIgnored = isPathGitIgnored(projectRoot, normalizedPath);
171
-
172
- results.push({
173
- name: 'Check if output directory is gitignored',
174
- success: !isIgnored,
175
- details: isIgnored
176
- ? `Output directory "${outputPath}" is being ignored by Git. This could be due to a complex pattern in .gitignore. Remove any entries that might affect this directory.`
177
- : `Output directory "${outputPath}" is not being ignored by Git, which is good.`
178
- });
363
+ if (!gitignoreCheck.gitignoreExists) {
364
+ return results;
179
365
  }
180
366
 
181
- // Check for HTML file ignoring patterns
182
- const htmlIgnorePatterns = [];
367
+ // Read .gitignore content and process it
368
+ const gitignoreContent = fs.readFileSync(gitignoreCheck.gitignorePath, 'utf8');
369
+ const relevantLines = getRelevantGitignoreLines(gitignoreContent);
370
+ const dirName = path.basename(normalizedPath);
183
371
 
184
- for (const line of lines) {
185
- const trimmedLine = line.trim();
186
- // Skip empty lines and comments
187
- if (trimmedLine === '' || trimmedLine.startsWith('#')) {
188
- continue;
189
- }
190
-
191
- if (
192
- trimmedLine === 'index.html' ||
193
- trimmedLine === '*.html' ||
194
- trimmedLine === '/index.html' ||
195
- trimmedLine === '**/index.html' ||
196
- trimmedLine === '**/*.html'
197
- ) {
198
- htmlIgnorePatterns.push(trimmedLine);
199
- }
200
- }
372
+ // Check output directory ignore patterns
373
+ const dirResults = checkOutputDirIgnorePatterns(
374
+ projectRoot, normalizedPath, outputPath, dirName, relevantLines
375
+ );
376
+ results.push(...dirResults);
201
377
 
202
- // If we found HTML patterns in .gitignore, flag them regardless of git check-ignore result
203
- if (htmlIgnorePatterns.length > 0) {
204
- results.push({
205
- name: 'Check if index.html files are gitignored',
206
- success: false,
207
- details: `Found patterns in .gitignore that would ignore HTML files: ${htmlIgnorePatterns.join(', ')}. This is problematic as they're crucial output files.`
208
- });
209
- } else {
210
- // Only use git check-ignore as a fallback if we didn't find explicit HTML patterns
211
- const indexHtmlPath = path.join(normalizedPath, 'index.html');
212
- const isIndexHtmlIgnored = isPathGitIgnored(projectRoot, indexHtmlPath);
213
-
214
- results.push({
215
- name: 'Check if index.html files are gitignored',
216
- success: !isIndexHtmlIgnored,
217
- details: isIndexHtmlIgnored
218
- ? `index.html files in the output directory would be ignored by Git. This is problematic as they're crucial output files.`
219
- : `index.html files in the output directory are properly tracked by Git.`
220
- });
221
-
222
- // If index.html is ignored but we couldn't find an explicit pattern, look for more complex patterns
223
- if (isIndexHtmlIgnored && htmlIgnorePatterns.length === 0) {
224
- // Look for more complex patterns that might be ignoring index.html files
225
- for (const line of lines) {
226
- const trimmedLine = line.trim();
227
- if (trimmedLine === '' || trimmedLine.startsWith('#')) {
228
- continue;
229
- }
230
-
231
- // Check for wildcards and patterns that might match index.html
232
- if (trimmedLine.includes('*') || trimmedLine.includes('.html')) {
233
- htmlIgnorePatterns.push(trimmedLine);
234
- }
235
- }
236
-
237
- if (htmlIgnorePatterns.length > 0) {
238
- results.push({
239
- name: 'Found complex .gitignore entries potentially affecting HTML files',
240
- status: 'warning',
241
- success: true, // Still considered a "success" for backward compatibility
242
- details: `The following entries in .gitignore might cause HTML files to be ignored: ${htmlIgnorePatterns.join(', ')}. Consider reviewing these patterns.`
243
- });
244
- }
245
- }
246
- }
378
+ // Check HTML files ignore patterns
379
+ const htmlResults = checkHtmlFilesGitignore(
380
+ projectRoot, normalizedPath, outputPath, relevantLines
381
+ );
382
+ results.push(...htmlResults);
247
383
 
248
384
  return results;
249
385
  } catch (error) {