chore: update for build, config, CLI and tests:#423
Merged
Conversation
Build System - tsconfig.json: Removed dead decorator options; updated moduleResolution/module to node16; disabled unused importHelpers - package.json: Fixed exports map with proper types entries for both ESM and CJS TypeScript consumers; removed unused tslib dependency; added test:coverage script - rollup.config.js: Enabled tree-shaking for CLI bundle; removed dead code; documented build order dependency - .prettierrc.cjs: Inlined config to remove missing prettier-config-standard dependency CLI (src/cli/) - 7 bug fixes: Promise constructor anti-pattern, callback fs.writeFile/fs.readdir replaced with fs.promises, addResultCount type mismatch, dead warningCount removed, TOCTOU race condition in validateParams removed, broken --singleton flag fixed (now shares parser instance from PDFCLI level), -si short flag parsing bug fixed - New --json flag: Structured JSON summary to stdout (version, output paths, stats, errors, elapsed time) for programmatic consumption and Claude Code Skill integration - New --quiet flag: Suppresses all non-error output including timer and status messages - Granular exit codes: 0=success, 1=parse failure, 2=argument error, 3=I/O error (previously only 0 or 1) - Improved directory filter: Only skips dotfiles now (previously silently skipped files starting with -, _, spaces, etc.) - Enhanced help output: Accurate flag descriptions, usage examples, and exit code documentation Tests - 3 new test suites (22 new tests): CLI integration (_test_cli.cjs), Stream API (_test_stream.cjs), Error paths (_test_errors.cjs) -- all previously had zero coverage - Fixed existing tests: Listener leak in multi-parse test (once() + removeAllListeners()); standardized on Jest expect() over Node assert(); restored VLines/HLines/Fills/Texts count assertions that were commented out - Renamed misleading _test_getRawTextContent.cjs to _test_sortBidiTexts.cjs - Regenerated 37 baseline files to reflect current parser output (baselines were stale since v0.6.8) - Test count: 52 tests / 4 suites -> 74 tests / 7 suites CI & Polish - CI workflow: Upgraded to actions v4; added tsc --noEmit type-check step; added coverage step - ESLint: Removed deprecated no-extra-semi and no-var-requires rules - CLAUDE.md: Added CLI flags table, exit codes, and test suite listing
npm ci was crashing with "Exit handler never called!" because the package-lock.json was generated with npm 11.x (Node 22) but CI ran npm 10.8.2 (Node 20.18.0). This left node_modules empty, causing all subsequent build steps to fail. Node 22 LTS also satisfies the ^20.19.0 engine requirements of eslint devDependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…atch npm ci crashes with "Exit handler never called!" because the package-lock.json was generated with npm 11.x but CI runs npm 10.9.7 (bundled with Node 22). npm ci is strict about lockfile compatibility. npm install resolves dependencies fresh, matching the previous CI behavior (rm -rf node_modules && npm i). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix mkdir error handling in validateParams: replace try/finally with try/catch so mkdir failures set the error string and return exit code 3 (EXIT_IO_ERROR) instead of propagating as an unhandled rejection - Reorder validation guards in initialize(): check Array.isArray before typeof string so users passing -f multiple times get the specific "can only be specified once" error instead of a generic message - Use structured .code property instead of string-matching on error.message for I/O error classification, preventing misclassification if a PDF engine error message happens to contain errno strings - Restore diagnostic console.error in _test_.cjs catch path so CI logs show which PDF caused a failure - Fix stream test to use os.tmpdir() instead of test/target/ to prevent ENOENT on clean checkout - Re-enable baseline diff validation in p2j.one.sh now that all 37 baselines have been regenerated Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build System
CLI (src/cli/)
Tests
CI & Polish