Skip to content

chore(all): Replace exceljs with write-excel-file - #2628

Draft
tombrunet wants to merge 2 commits into
main-4.xfrom
exceljs-replace
Draft

chore(all): Replace exceljs with write-excel-file#2628
tombrunet wants to merge 2 commits into
main-4.xfrom
exceljs-replace

Conversation

@tombrunet

Copy link
Copy Markdown
Member

Summary

Replace the peer dependency (unmaintained) with across all packages. The XLSX report output is functionally equivalent — same five sheets, same column widths, same colour coding and cell styling.

Motivation

exceljs has not received meaningful maintenance. Switching to write-excel-file removes the dependency on an unmaintained library and eliminates the 'use strict' patching workaround that was required in the browser extension's preprocess.js.

Changes

Core logic — common/module/src/report/ACReporterXLSX.ts

  • Full rewrite from ExcelJS's imperative workbook/worksheet/cell API to write-excel-file's data-array model.
  • Each sheet builder now returns a { data, sheet, columns } object; all sheets are passed to writeExcelFile(sheets).toFile(filename) in one call.
  • Cell colours converted from ExcelJS ARGB format ("FF403151") to standard 6-digit hex ("#403151").
  • Lazy-load guard updated: dynamic import now targets write-excel-file/node; warning message updated accordingly.
  • worksheet.commit() / workbook.commit() calls removed (not needed by the new library).

Extension — accessibility-checker-extension/

  • package.json: replaced exceljs direct dependency with write-excel-file.
  • preprocess.js: removed the sed commands that stripped 'use strict' from the exceljs bundle (no longer needed).
  • jest.config.js: removed stale comment referencing exceljs.

E2E test helper — accessibility-checker-extension/test/

  • support/steps/steps_excel.ts: replaced exceljs Workbook reader with read-excel-file/node; updated cell-address parsing to use the library's row/column array model.
  • package.json: replaced exceljs with read-excel-file.

package.json peer / direct dependency updates

All packages that declared exceljs as a peer or direct dependency have been updated to declare write-excel-file@^4.1.1 instead:

  • accessibility-checker/package.json
  • accessibility-checker/src/package.json
  • cypress-accessibility-checker/package.json + package/package.json
  • vitest-accessibility-checker/package.json + src/package.json + package/package.json
  • karma-accessibility-checker/package.json
  • common/module/package.json

Pre-built JS artefacts regenerated

All committed copies of ACReporterXLSX.js (CJS + MJS outputs across accessibility-checker, cypress-accessibility-checker, vitest-accessibility-checker, karma-accessibility-checker) were rebuilt from the new TypeScript source and committed.


Testing checklist

Confirm these scenarios before merging.

XLSX report output (accessibility-checker Node.js)

  • Run accessibility-checker against a page with violations and confirm a .xlsx file is written to disk.
  • Open the generated file — verify 5 sheets are present: Overview, Scan summary, Issue summary, Issues, Definition of fields.
  • Overview sheet: confirm title row background is dark purple (#403151), summary counts (Violations / Needs review / Recommendations / Archived) are correct, and column widths are reasonable.
  • Scan summary sheet: confirm one data row per scan, all 9 columns populated, numeric columns (Violations, Needs review, …) are right-aligned with borders.
  • Issue summary sheet: confirm Level 1–4 sections are present with correct counts; rows within each level are sorted descending by count.
  • Issues sheet: confirm one row per issue, all 14 columns populated, header row has dark purple background.
  • Definition of fields sheet: confirm both the Scan summary and Issues definition tables are present.
  • Run a scan with outputFilenameTimestamp: false and confirm the output file is named results.xlsx (not timestamped).
  • Confirm that if write-excel-file is not installed the warning "Warning: write-excel-file is not installed…" is printed and the process does not crash.

Browser extension (accessibility-checker-extension)

  • Build the extension (npm run build:dev) — confirm it compiles without errors (no exceljs webpack error or 'use strict' conflict).
  • Load the extension in Chrome/Firefox and generate an XLSX report from the UI — confirm the file downloads and opens correctly in Excel / LibreOffice.
  • Confirm preprocess.js no longer modifies any node_modules files on build.

E2E tests (accessibility-checker-extension/test)

  • Run npm test in accessibility-checker-extension/test — the Cucumber step Excel Sheet "…" Cell "…" is "…" should pass using read-excel-file.

Downstream packages

  • cypress-accessibility-checker: run npm run test and confirm XLSX output is produced correctly.
  • vitest-accessibility-checker: run npm run test and confirm XLSX output is produced correctly.
  • karma-accessibility-checker: run npm run build with no errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant