@octaviaflow/accessibility-checker 1.1.2 → 2.0.0

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 CHANGED
@@ -17,6 +17,7 @@ A comprehensive TypeScript-based accessibility testing tool that combines heuris
17
17
  ## 📦 Installation
18
18
 
19
19
  ### NPM/Yarn
20
+
20
21
  ```bash
21
22
  npm install @octaviaflow/accessibility-checker
22
23
  # or
@@ -24,11 +25,13 @@ yarn add @octaviaflow/accessibility-checker
24
25
  ```
25
26
 
26
27
  ### Bun
28
+
27
29
  ```bash
28
30
  bun add @octaviaflow/accessibility-checker
29
31
  ```
30
32
 
31
33
  ### Global Installation
34
+
32
35
  ```bash
33
36
  npm install -g @octaviaflow/accessibility-checker
34
37
  ```
@@ -71,18 +74,19 @@ console.log(`Found ${result.summary.totalIssues} accessibility issues`);
71
74
 
72
75
  ## 📋 CLI Options
73
76
 
74
- | Option | Alias | Description | Default |
75
- |--------|-------|-------------|---------|
76
- | `--input <file>` | `-i` | HTML file to analyze | - |
77
- | `--output <file>` | `-o` | Output file path | `./data/results.json` |
78
- | `--format <type>` | - | Output format: `json`, `html`, `csv`, `excel` | `json` |
79
- | `--sample` | - | Run with sample HTML for testing | `false` |
80
- | `--verbose` | `-v` | Verbose output with detailed logging | `false` |
81
- | `--help` | `-h` | Show help message | - |
77
+ | Option | Alias | Description | Default |
78
+ | ----------------- | ----- | --------------------------------------------- | --------------------- |
79
+ | `--input <file>` | `-i` | HTML file to analyze | - |
80
+ | `--output <file>` | `-o` | Output file path | `./data/results.json` |
81
+ | `--format <type>` | - | Output format: `json`, `html`, `csv`, `excel` | `json` |
82
+ | `--sample` | - | Run with sample HTML for testing | `false` |
83
+ | `--verbose` | `-v` | Verbose output with detailed logging | `false` |
84
+ | `--help` | `-h` | Show help message | - |
82
85
 
83
86
  ## 📊 Output Formats
84
87
 
85
88
  ### JSON Format
89
+
86
90
  ```json
87
91
  {
88
92
  "summary": {
@@ -102,7 +106,9 @@ console.log(`Found ${result.summary.totalIssues} accessibility issues`);
102
106
  "source": "heuristic"
103
107
  }
104
108
  ],
105
- "axe": { /* Full axe-core results */ },
109
+ "axe": {
110
+ /* Full axe-core results */
111
+ },
106
112
  "meta": {
107
113
  "timestamp": "2025-11-13T10:52:00.000Z",
108
114
  "source": "index.html",
@@ -112,6 +118,7 @@ console.log(`Found ${result.summary.totalIssues} accessibility issues`);
112
118
  ```
113
119
 
114
120
  ### HTML Report
121
+
115
122
  - **Responsive design** with modern styling
116
123
  - **Color-coded issues** by severity and type
117
124
  - **Interactive elements** with expandable details
@@ -119,6 +126,7 @@ console.log(`Found ${result.summary.totalIssues} accessibility issues`);
119
126
  - **WCAG compliance mapping**
120
127
 
121
128
  ### Excel Report
129
+
122
130
  - **Summary sheet** with overview metrics
123
131
  - **Issues sheet** with detailed findings
124
132
  - **Formatted tables** with proper styling
@@ -127,11 +135,13 @@ console.log(`Found ${result.summary.totalIssues} accessibility issues`);
127
135
  ## 🔧 Development
128
136
 
129
137
  ### Prerequisites
138
+
130
139
  - **Node.js** ≥ 22.0.0
131
140
  - **Bun** ≥ 1.3.2 (recommended)
132
141
  - **TypeScript** ≥ 5.8.3
133
142
 
134
143
  ### Setup
144
+
135
145
  ```bash
136
146
  # Clone the repository
137
147
  git clone https://github.com/OctaviaFlow/OctaviaFlow-Design-System.git
@@ -155,16 +165,16 @@ bun run dev
155
165
 
156
166
  ### Scripts
157
167
 
158
- | Script | Description |
159
- |--------|-------------|
160
- | `bun run build` | Build CommonJS, ESM, and TypeScript declarations |
161
- | `bun run test` | Run tests once and exit |
162
- | `bun run test:watch` | Run tests in watch mode |
163
- | `bun run lint` | Run ESLint |
164
- | `bun run lint:fix` | Fix ESLint issues |
165
- | `bun run format` | Format code with Prettier |
166
- | `bun run ci-check` | Full CI pipeline (build + test + lint) |
167
- | `bun run dev` | Build and run sample |
168
+ | Script | Description |
169
+ | -------------------- | ------------------------------------------------ |
170
+ | `bun run build` | Build CommonJS, ESM, and TypeScript declarations |
171
+ | `bun run test` | Run tests once and exit |
172
+ | `bun run test:watch` | Run tests in watch mode |
173
+ | `bun run lint` | Run ESLint |
174
+ | `bun run lint:fix` | Fix ESLint issues |
175
+ | `bun run format` | Format code with Prettier |
176
+ | `bun run ci-check` | Full CI pipeline (build + test + lint) |
177
+ | `bun run dev` | Build and run sample |
168
178
 
169
179
  ## 🏗️ Architecture
170
180
 
@@ -243,7 +253,7 @@ const html = `
243
253
 
244
254
  const result = await analyze(html);
245
255
  console.log(`Found ${result.summary.totalIssues} issues:`);
246
- result.issues.forEach(issue => {
256
+ result.issues.forEach((issue) => {
247
257
  console.log(`- ${issue.type}: ${issue.message}`);
248
258
  });
249
259
  ```
@@ -255,7 +265,7 @@ result.issues.forEach(issue => {
255
265
  - name: Accessibility Check
256
266
  run: |
257
267
  octaviaflow-achecker --input dist/index.html --format json --output accessibility-report.json
258
-
268
+
259
269
  - name: Upload Report
260
270
  uses: actions/upload-artifact@v3
261
271
  with:
@@ -270,14 +280,14 @@ import { analyze, saveReport } from '@octaviaflow/accessibility-checker';
270
280
 
271
281
  async function generateAccessibilityReport(htmlFiles: string[]) {
272
282
  const results = [];
273
-
283
+
274
284
  for (const file of htmlFiles) {
275
285
  const html = await fs.readFile(file, 'utf8');
276
286
  const result = await analyze(html);
277
287
  result.meta = { ...result.meta, source: file };
278
288
  results.push(result);
279
289
  }
280
-
290
+
281
291
  // Generate combined report
282
292
  const combinedResult = {
283
293
  summary: {
@@ -287,16 +297,16 @@ async function generateAccessibilityReport(htmlFiles: string[]) {
287
297
  acc[type] = (acc[type] || 0) + count;
288
298
  });
289
299
  return acc;
290
- }, {})
300
+ }, {}),
291
301
  },
292
- issues: results.flatMap(r => r.issues),
302
+ issues: results.flatMap((r) => r.issues),
293
303
  meta: {
294
304
  timestamp: new Date().toISOString(),
295
305
  source: 'batch-analysis',
296
- fileCount: htmlFiles.length
297
- }
306
+ fileCount: htmlFiles.length,
307
+ },
298
308
  };
299
-
309
+
300
310
  await saveReport(combinedResult, './batch-report.html', 'html');
301
311
  }
302
312
  ```
@@ -311,17 +321,17 @@ describe('Accessibility Tests', () => {
311
321
  test('homepage should be accessible', async () => {
312
322
  const html = await getRenderedHTML('/');
313
323
  const result = await analyze(html);
314
-
324
+
315
325
  expect(result.summary.totalIssues).toBe(0);
316
326
  });
317
-
327
+
318
328
  test('should have no critical axe violations', async () => {
319
329
  const html = await getRenderedHTML('/dashboard');
320
330
  const result = await analyze(html);
321
-
331
+
322
332
  if (result.axe && 'violations' in result.axe) {
323
333
  const criticalViolations = result.axe.violations.filter(
324
- v => v.impact === 'critical'
334
+ (v) => v.impact === 'critical'
325
335
  );
326
336
  expect(criticalViolations).toHaveLength(0);
327
337
  }
@@ -349,17 +359,17 @@ export default [
349
359
  parser: tsParser,
350
360
  parserOptions: {
351
361
  ecmaVersion: 2022,
352
- sourceType: 'module'
353
- }
362
+ sourceType: 'module',
363
+ },
354
364
  },
355
365
  plugins: {
356
- '@typescript-eslint': typescriptEslint
366
+ '@typescript-eslint': typescriptEslint,
357
367
  },
358
368
  rules: {
359
369
  '@typescript-eslint/no-explicit-any': 'warn',
360
- 'no-console': 'off'
361
- }
362
- }
370
+ 'no-console': 'off',
371
+ },
372
+ },
363
373
  ];
364
374
  ```
365
375
 
package/cjs/index.js CHANGED
@@ -79,7 +79,7 @@ async function main(args) {
79
79
  timestamp: new Date().toISOString(),
80
80
  source: inputPath || 'sample',
81
81
  format,
82
- version: '1.0.0'
82
+ version: '1.0.0',
83
83
  };
84
84
  spinner.succeed('Analysis complete');
85
85
  if (verbose) {
@@ -110,7 +110,7 @@ async function main(args) {
110
110
  }
111
111
  }
112
112
  if (require.main === module) {
113
- main().catch(err => {
113
+ main().catch((err) => {
114
114
  console.error(chalk_1.default.red('Fatal error:'), err);
115
115
  process.exit(2);
116
116
  });
@@ -82,28 +82,34 @@ function generateHtmlReport(result) {
82
82
  </div>
83
83
 
84
84
  <div class="issues">
85
- ${issues.length === 0 ? `
85
+ ${issues.length === 0
86
+ ? `
86
87
  <div class="no-issues">
87
88
  <h2>✅ No Issues Found!</h2>
88
89
  <p>This page appears to be accessible according to our analysis.</p>
89
90
  </div>
90
- ` : `
91
+ `
92
+ : `
91
93
  <h2>Issues Found (${issues.length})</h2>
92
- ${issues.map(issue => `
94
+ ${issues
95
+ .map((issue) => `
93
96
  <div class="issue">
94
97
  <div class="issue-header">
95
98
  <span class="issue-type ${issue.type.replace(':', '-')}">${issue.type}</span>
96
99
  <span class="issue-message">${issue.message}</span>
97
100
  </div>
98
- ${issue.snippet ? `
101
+ ${issue.snippet
102
+ ? `
99
103
  <div class="issue-body">
100
104
  <strong>Code snippet:</strong>
101
105
  <div class="code-snippet">${issue.snippet.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</div>
102
106
  ${issue.helpUrl ? `<p><a href="${issue.helpUrl}" target="_blank">Learn more →</a></p>` : ''}
103
107
  </div>
104
- ` : ''}
108
+ `
109
+ : ''}
105
110
  </div>
106
- `).join('')}
111
+ `)
112
+ .join('')}
107
113
  `}
108
114
  </div>
109
115
 
@@ -117,15 +123,15 @@ function generateHtmlReport(result) {
117
123
  function generateCsvReport(result) {
118
124
  const { issues } = result;
119
125
  const headers = ['Type', 'Message', 'Source', 'Snippet', 'Help URL'];
120
- const rows = issues.map(issue => [
126
+ const rows = issues.map((issue) => [
121
127
  issue.type,
122
128
  issue.message,
123
129
  issue.source || 'heuristic',
124
130
  (issue.snippet || '').replace(/"/g, '""'),
125
- issue.helpUrl || ''
131
+ issue.helpUrl || '',
126
132
  ]);
127
133
  const csvContent = [headers, ...rows]
128
- .map(row => row.map(cell => `"${cell}"`).join(','))
134
+ .map((row) => row.map((cell) => `"${cell}"`).join(','))
129
135
  .join('\n');
130
136
  return csvContent;
131
137
  }
@@ -133,7 +139,10 @@ async function generateExcelReport(result, filePath) {
133
139
  const workbook = new XLSX.Workbook();
134
140
  const summarySheet = workbook.addWorksheet('Summary');
135
141
  summarySheet.addRow(['OctaviaFlow Accessibility Report']);
136
- summarySheet.addRow(['Generated:', new Date(result.meta?.timestamp || Date.now()).toLocaleString()]);
142
+ summarySheet.addRow([
143
+ 'Generated:',
144
+ new Date(result.meta?.timestamp || Date.now()).toLocaleString(),
145
+ ]);
137
146
  summarySheet.addRow(['Source:', result.meta?.source || 'Unknown']);
138
147
  summarySheet.addRow([]);
139
148
  summarySheet.addRow(['Total Issues:', result.summary.totalIssues]);
@@ -145,13 +154,13 @@ async function generateExcelReport(result, filePath) {
145
154
  });
146
155
  const issuesSheet = workbook.addWorksheet('Issues');
147
156
  issuesSheet.addRow(['Type', 'Message', 'Source', 'Snippet', 'Help URL']);
148
- result.issues.forEach(issue => {
157
+ result.issues.forEach((issue) => {
149
158
  issuesSheet.addRow([
150
159
  issue.type,
151
160
  issue.message,
152
161
  issue.source || 'heuristic',
153
162
  issue.snippet || '',
154
- issue.helpUrl || ''
163
+ issue.helpUrl || '',
155
164
  ]);
156
165
  });
157
166
  summarySheet.getRow(1).font = { bold: true, size: 16 };
package/mjs/index.js CHANGED
@@ -72,7 +72,7 @@ export async function main(args) {
72
72
  timestamp: new Date().toISOString(),
73
73
  source: inputPath || 'sample',
74
74
  format,
75
- version: '1.0.0'
75
+ version: '1.0.0',
76
76
  };
77
77
  spinner.succeed('Analysis complete');
78
78
  if (verbose) {
@@ -103,7 +103,7 @@ export async function main(args) {
103
103
  }
104
104
  }
105
105
  if (require.main === module) {
106
- main().catch(err => {
106
+ main().catch((err) => {
107
107
  console.error(chalk.red('Fatal error:'), err);
108
108
  process.exit(2);
109
109
  });
@@ -78,28 +78,34 @@ function generateHtmlReport(result) {
78
78
  </div>
79
79
 
80
80
  <div class="issues">
81
- ${issues.length === 0 ? `
81
+ ${issues.length === 0
82
+ ? `
82
83
  <div class="no-issues">
83
84
  <h2>✅ No Issues Found!</h2>
84
85
  <p>This page appears to be accessible according to our analysis.</p>
85
86
  </div>
86
- ` : `
87
+ `
88
+ : `
87
89
  <h2>Issues Found (${issues.length})</h2>
88
- ${issues.map(issue => `
90
+ ${issues
91
+ .map((issue) => `
89
92
  <div class="issue">
90
93
  <div class="issue-header">
91
94
  <span class="issue-type ${issue.type.replace(':', '-')}">${issue.type}</span>
92
95
  <span class="issue-message">${issue.message}</span>
93
96
  </div>
94
- ${issue.snippet ? `
97
+ ${issue.snippet
98
+ ? `
95
99
  <div class="issue-body">
96
100
  <strong>Code snippet:</strong>
97
101
  <div class="code-snippet">${issue.snippet.replace(/</g, '&lt;').replace(/>/g, '&gt;')}</div>
98
102
  ${issue.helpUrl ? `<p><a href="${issue.helpUrl}" target="_blank">Learn more →</a></p>` : ''}
99
103
  </div>
100
- ` : ''}
104
+ `
105
+ : ''}
101
106
  </div>
102
- `).join('')}
107
+ `)
108
+ .join('')}
103
109
  `}
104
110
  </div>
105
111
 
@@ -113,15 +119,15 @@ function generateHtmlReport(result) {
113
119
  function generateCsvReport(result) {
114
120
  const { issues } = result;
115
121
  const headers = ['Type', 'Message', 'Source', 'Snippet', 'Help URL'];
116
- const rows = issues.map(issue => [
122
+ const rows = issues.map((issue) => [
117
123
  issue.type,
118
124
  issue.message,
119
125
  issue.source || 'heuristic',
120
126
  (issue.snippet || '').replace(/"/g, '""'),
121
- issue.helpUrl || ''
127
+ issue.helpUrl || '',
122
128
  ]);
123
129
  const csvContent = [headers, ...rows]
124
- .map(row => row.map(cell => `"${cell}"`).join(','))
130
+ .map((row) => row.map((cell) => `"${cell}"`).join(','))
125
131
  .join('\n');
126
132
  return csvContent;
127
133
  }
@@ -129,7 +135,10 @@ async function generateExcelReport(result, filePath) {
129
135
  const workbook = new XLSX.Workbook();
130
136
  const summarySheet = workbook.addWorksheet('Summary');
131
137
  summarySheet.addRow(['OctaviaFlow Accessibility Report']);
132
- summarySheet.addRow(['Generated:', new Date(result.meta?.timestamp || Date.now()).toLocaleString()]);
138
+ summarySheet.addRow([
139
+ 'Generated:',
140
+ new Date(result.meta?.timestamp || Date.now()).toLocaleString(),
141
+ ]);
133
142
  summarySheet.addRow(['Source:', result.meta?.source || 'Unknown']);
134
143
  summarySheet.addRow([]);
135
144
  summarySheet.addRow(['Total Issues:', result.summary.totalIssues]);
@@ -141,13 +150,13 @@ async function generateExcelReport(result, filePath) {
141
150
  });
142
151
  const issuesSheet = workbook.addWorksheet('Issues');
143
152
  issuesSheet.addRow(['Type', 'Message', 'Source', 'Snippet', 'Help URL']);
144
- result.issues.forEach(issue => {
153
+ result.issues.forEach((issue) => {
145
154
  issuesSheet.addRow([
146
155
  issue.type,
147
156
  issue.message,
148
157
  issue.source || 'heuristic',
149
158
  issue.snippet || '',
150
- issue.helpUrl || ''
159
+ issue.helpUrl || '',
151
160
  ]);
152
161
  });
153
162
  summarySheet.getRow(1).font = { bold: true, size: 16 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octaviaflow/accessibility-checker",
3
- "version": "1.1.2",
3
+ "version": "2.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Accessibility checker for OctaviaFlow Design System - A custom implementation",
@@ -34,8 +34,8 @@
34
34
  "build": "bun run clean && bun run build:cjs && bun run build:mjs && bun run build:types",
35
35
  "test": "vitest run",
36
36
  "test:watch": "vitest",
37
- "lint": "eslint src/**/*.ts",
38
- "lint:fix": "eslint src/**/*.ts --fix",
37
+ "lint": "eslint src",
38
+ "lint:fix": "eslint src --fix",
39
39
  "format": "prettier --write src/**/*.{ts,js,json}",
40
40
  "format:check": "prettier --check src/**/*.{ts,js,json}",
41
41
  "ci-check": "bun run build && bun run test && bun run lint && echo \"✓ Done\"",
@@ -62,8 +62,8 @@
62
62
  "minimist": "^1.2.8",
63
63
  "puppeteer": "^24.29.1",
64
64
  "string-hash": "^1.1.3",
65
- "chalk": "^5.3.0",
66
- "ora": "^8.1.1"
65
+ "chalk": "4.1.2",
66
+ "ora": "5.4.1"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/jsdom": "^27.0.0",
@@ -75,13 +75,13 @@
75
75
  "eslint": "^9.39.1",
76
76
  "eslint-config-octaviaflow": "^2.0.0",
77
77
  "jest": "^29.7.0",
78
- "jest-config-octaviaflow": "^1.1.1",
78
+ "jest-config-octaviaflow": "^2.0.0",
79
79
  "prettier": "^3.6.2",
80
- "prettier-config-octaviaflow": "^1.1.2",
80
+ "prettier-config-octaviaflow": "^2.0.0",
81
81
  "rimraf": "^6.0.1",
82
82
  "tslib": "^2.8.1",
83
83
  "typescript": "^5.8.3",
84
- "typescript-config-octaviaflow": "^1.1.1",
84
+ "typescript-config-octaviaflow": "^2.0.0",
85
85
  "vitest": "^2.1.8"
86
86
  },
87
87
  "bin": {