gbu-accessibility-package 3.8.2 → 3.8.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-vi.md CHANGED
@@ -175,6 +175,7 @@ Tùy chọn Enhanced Alt:
175
175
 
176
176
  Trợ giúp:
177
177
  -h, --help Hiển thị thông điệp trợ giúp
178
+ -v, --version Hiển thị số phiên bản
178
179
  ```
179
180
 
180
181
  ### Ví dụ
package/README.md CHANGED
@@ -170,6 +170,7 @@ Enhanced Alt Options:
170
170
 
171
171
  Help:
172
172
  -h, --help Show help message
173
+ -v, --version Show version number
173
174
  ```
174
175
 
175
176
  ### Examples
package/cli.js CHANGED
@@ -17,6 +17,7 @@ const options = {
17
17
  backupFiles: false, // Default to false for faster processing
18
18
  dryRun: false,
19
19
  help: false,
20
+ version: false,
20
21
  cleanupOnly: false,
21
22
  comprehensive: false, // Keep for backward compatibility
22
23
  altOnly: false,
@@ -52,6 +53,10 @@ for (let i = 0; i < args.length; i++) {
52
53
  case '-h':
53
54
  options.help = true;
54
55
  break;
56
+ case '--version':
57
+ case '-v':
58
+ options.version = true;
59
+ break;
55
60
  case '--directory':
56
61
  case '-d':
57
62
  options.directory = args[++i];
@@ -155,6 +160,12 @@ for (let i = 0; i < args.length; i++) {
155
160
  }
156
161
 
157
162
  // Show help
163
+ if (options.version) {
164
+ const packageJson = require('./package.json');
165
+ console.log(chalk.blue(`🔧 GBU Accessibility Package v${packageJson.version}`));
166
+ process.exit(0);
167
+ }
168
+
158
169
  if (options.help) {
159
170
  console.log(chalk.blue(`
160
171
  🔧 Accessibility Fixer CLI
@@ -189,6 +200,7 @@ Options:
189
200
  --include-emotions Include emotional descriptors in alt text
190
201
  --strict-alt Enable strict alt attribute quality checking
191
202
  -h, --help Show this help message
203
+ -v, --version Show version number
192
204
 
193
205
  Enhanced Alt Features:
194
206
  --enhanced-alt Comprehensive alt attribute analysis with:
package/lib/fixer.js CHANGED
@@ -5659,16 +5659,16 @@ class AccessibilityFixer {
5659
5659
 
5660
5660
  const startTime = Date.now();
5661
5661
 
5662
- // Find project root for comprehensive scanning
5663
- const projectRoot = this.findProjectRoot(directory);
5664
- console.log(chalk.gray(`📁 Project root: ${path.relative(process.cwd(), projectRoot) || '.'}`));
5662
+ // Determine scan directory - use specified directory or project root for comprehensive scanning
5663
+ const scanDirectory = path.resolve(directory);
5664
+ console.log(chalk.gray(`📁 Scanning directory: ${path.relative(process.cwd(), scanDirectory) || '.'}`));
5665
5665
 
5666
- // Get all project files from root (comprehensive scan)
5667
- const allFiles = await this.findAllProjectFiles(projectRoot);
5668
- console.log(chalk.gray(`📊 Found ${allFiles.length} total files in project`));
5666
+ // Get all project files from scan directory
5667
+ const allFiles = await this.findAllProjectFiles(scanDirectory);
5668
+ console.log(chalk.gray(`📊 Found ${allFiles.length} total files in scan area`));
5669
5669
 
5670
- // Get referenced files from entire project (not just target directory)
5671
- const referencedFiles = await this.findReferencedFiles(projectRoot);
5670
+ // Get referenced files from scan directory
5671
+ const referencedFiles = await this.findReferencedFiles(scanDirectory);
5672
5672
  console.log(chalk.gray(`🔍 Found ${referencedFiles.size} referenced files`));
5673
5673
 
5674
5674
  // Find unused files
@@ -5680,9 +5680,9 @@ class AccessibilityFixer {
5680
5680
  continue;
5681
5681
  }
5682
5682
 
5683
- // Check if file is referenced anywhere in the project
5684
- const relativePath = path.relative(projectRoot, file);
5685
- const isReferenced = this.isFileReferenced(file, relativePath, referencedFiles, projectRoot);
5683
+ // Check if file is referenced anywhere in the scan area
5684
+ const relativePath = path.relative(scanDirectory, file);
5685
+ const isReferenced = this.isFileReferenced(file, relativePath, referencedFiles, scanDirectory);
5686
5686
 
5687
5687
  if (!isReferenced) {
5688
5688
  const stats = await require('fs').promises.stat(file);
@@ -5770,7 +5770,7 @@ class AccessibilityFixer {
5770
5770
  const files = [];
5771
5771
  const extensions = ['.html', '.css', '.js', '.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp', '.ico', '.pdf', '.mp4', '.webm', '.mp3', '.wav'];
5772
5772
 
5773
- async function scan(dir) {
5773
+ const scan = async (dir) => {
5774
5774
  try {
5775
5775
  const entries = await fs.readdir(dir, { withFileTypes: true });
5776
5776
 
@@ -5791,10 +5791,11 @@ class AccessibilityFixer {
5791
5791
  }
5792
5792
  } catch (error) {
5793
5793
  // Skip directories we can't read
5794
+ console.log(chalk.gray(`⚠️ Skipping directory ${dir}: ${error.message}`));
5794
5795
  }
5795
- }
5796
+ };
5796
5797
 
5797
- await scan.call(this, directory);
5798
+ await scan(directory);
5798
5799
  return files;
5799
5800
  }
5800
5801
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbu-accessibility-package",
3
- "version": "3.8.2",
3
+ "version": "3.8.3",
4
4
  "description": "Comprehensive accessibility fixes and project optimization for HTML files. Smart context-aware alt text generation, form labels, button names, link names, landmarks, heading analysis, WCAG-compliant role attributes, unused files detection, dead code analysis, broken external links detection, and missing local resources detection. Covers major axe DevTools issues with individual fix modes.",
5
5
  "main": "index.js",
6
6
  "bin": {