Skip to content

Commit e4db3f6

Browse files
authored
Merge pull request #22 from mehmet-kozan/reports-site
Reports site, readme and CI updated
2 parents 1efa781 + 0339a31 commit e4db3f6

File tree

14 files changed

+3839
-35
lines changed

14 files changed

+3839
-35
lines changed

.github/workflows/deploy_github_page.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ jobs:
5454
directory: ./reports_site/coverage
5555
fail_ci_if_error: false
5656

57+
- name: Copy test pdf files into site
58+
run: |
59+
if [ -d test/pdf_file ]; then
60+
mkdir -p reports_site/pdf
61+
cp -r test/pdf_file/* reports_site/pdf/ || true
62+
echo "Copied test/pdf_file -> reports_site/pdf/"
63+
else
64+
echo "No test/pdf_file directory found; skipping copy"
65+
fi
66+
5767
- name: Setup Pages
5868
uses: actions/configure-pages@v5
5969

.github/workflows/test_integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,8 @@ jobs:
3535
- name: Unit tests
3636
run: npm test
3737

38+
- name: Unsupported tests
39+
run: npm run test:u
40+
3841
- name: Integration tests
3942
run: npm run test:i

.github/workflows/test_unsupported.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node-version: [18, 21]
14+
node-version: [18, 19, 21]
1515

1616
steps:
1717
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,5 @@ test/**/imgs/
156156
test/**/*_images/
157157
dist/
158158
temp/
159+
reports_site/pdf/
159160

File renamed without changes.

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,9 @@ export default nextConfig;
268268
Custom builds, Electron/NW.js, or specific deployment environments—you may need to manually configure the worker source.
269269
270270
```js
271+
import {getWorkerPath, getWorkerSource} from "pdf-parse/worker"; // Import this before importing "pdf-parse"
271272
import {PDFParse} from "pdf-parse";
272-
import {getWorkerPath, getWorkerSource} from "pdf-parse/worker";
273+
273274
// CommonJS
274275
// const {getWorkerSource, getWorkerPath} = require('pdf-parse/worker');
275276
@@ -351,13 +352,40 @@ See [`example/basic.esm.worker.html`](example/basic.esm.worker.html) for a worki
351352
352353
> **Benchmark Note:** The benchmark currently runs only against `pdf2json`. I don't know the current state of `pdf2json` — the original reason for creating `pdf-parse` was to work around stability issues with `pdf2json`. I deliberately did not include `pdf-parse` or other `pdf.js`-based packages in the benchmark because dependencies conflict. If you have recommendations for additional packages to include, please open an issue, see [`benchmark results`](https://mehmet-kozan.github.io/pdf-parse/bench.html).
353354
354-
## Supported Node.js Versions
355+
## Supported Node.js Versions(20.x, 22.x, 23.x, 24.x)
355356
356357
- Supported: Node.js 20 (>= 20.16.0), Node.js 22 (>= 22.3.0), Node.js 23 (>= 23.0.0), and Node.js 24 (>= 24.0.0).
357358
- Not supported: Node.js 21.x, and Node.js 19.x and earlier.
358359
359360
Integration tests run on Node.js 20–24, see [`test_integration.yml`](./.github/workflows/test_integration.yml).
360361
362+
### Unsupported Node.js Versions (18.x, 19.x, 21.x)
363+
364+
Requires additional setup — import and configure a compatible CanvasFactory or worker implementation before initializing pdf-parse; see the examples below.
365+
366+
ESM
367+
```js
368+
import { CustomCanvasFactory } from 'pdf-parse/canvas'; // Import this before importing "pdf-parse"
369+
import { PDFParse } from 'pdf-parse';
370+
371+
const parser = new PDFParse({ data: buffer, CanvasFactory: CustomCanvasFactory });
372+
// then use parser
373+
```
374+
375+
CommonJS
376+
```js
377+
const { CustomCanvasFactory } = require('pdf-parse/canvas'); // Import this before importing "pdf-parse"
378+
const { PDFParse } = require('pdf-parse');
379+
380+
const parser = new PDFParse({ data: buffer, CanvasFactory: CustomCanvasFactory });
381+
// then use parser
382+
```
383+
384+
Unsupported tests run on Node.js 18, 19, 21, see [`test_unsupported.yml`](./.github/workflows/test_unsupported.yml).
385+
Check: [`test_unsupported`](./test_unsupported)
386+
387+
388+
361389
## Contributing
362390
363391
When opening an issue, please attach the relevant PDF file if possible. Providing the file will help us reproduce and resolve your issue more efficiently. For detailed guidelines on how to contribute, report bugs, or submit pull requests, see: [`contributing to pdf-parse`](https://github.com/mehmet-kozan/pdf-parse?tab=contributing-ov-file#contributing-to-pdf-parse)

api-extractor.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
* SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
159159
* DEFAULT VALUE: "<unscopedPackageName>"
160160
*/
161-
// "reportFileName": "<unscopedPackageName>",
161+
"reportFileName": "README.api.md",
162162

163163
/**
164164
* To support different approval requirements for different API levels, multiple "variants" of the API report can
@@ -184,7 +184,7 @@
184184
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
185185
* DEFAULT VALUE: "<projectFolder>/etc/"
186186
*/
187-
"reportFolder": "reports_site/api-report/"
187+
"reportFolder": "./"
188188

189189
/**
190190
* Specifies the folder where the temporary report file is written. The file name portion is determined by
@@ -218,7 +218,7 @@
218218
/**
219219
* (REQUIRED) Whether to generate a doc model file.
220220
*/
221-
"enabled": true
221+
"enabled": true,
222222

223223
/**
224224
* The output path for the doc model file. The file extension should be ".api.json".
@@ -229,7 +229,7 @@
229229
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
230230
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
231231
*/
232-
// "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json",
232+
"apiJsonFilePath": "reports_site/api-report/pdf-parse.api.json",
233233

234234
/**
235235
* Whether "forgotten exports" should be included in the doc model file. Forgotten exports are declarations
@@ -254,7 +254,7 @@
254254
* SUPPORTED TOKENS: none
255255
* DEFAULT VALUE: ""
256256
*/
257-
// "projectFolderUrl": "http://github.com/path/to/your/projectFolder"
257+
"projectFolderUrl": "https://github.com/mehmet-kozan/pdf-parse/tree/main"
258258
},
259259

260260
/**
@@ -341,7 +341,7 @@
341341
*
342342
* DEFAULT VALUE: true
343343
*/
344-
// "enabled": true,
344+
"enabled": true,
345345
/**
346346
* Specifies where the TSDoc metadata file should be written.
347347
*
@@ -355,7 +355,7 @@
355355
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
356356
* DEFAULT VALUE: "<lookup>"
357357
*/
358-
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
358+
"tsdocMetadataFilePath": "reports_site/api-report/tsdoc-metadata.json"
359359
},
360360

361361
/**
@@ -389,7 +389,7 @@
389389
*
390390
* DEFAULT VALUE: "warning"
391391
*/
392-
"logLevel": "warning"
392+
"logLevel": "error"
393393

394394
/**
395395
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"build:node": "vite build --config vite.config.node.ts && npm run bundle:dts",
108108
"build:browser": "vite build --config vite.config.browser.ts && vite build --config vite.config.browser.min.ts",
109109
"build:worker": "vite build --config vite.config.worker.ts",
110-
"bundle:dts": "api-extractor run --local --verbose",
110+
"bundle:dts": "api-extractor run --local",
111111
"clean": "npm run clean:build && npm run clean:site && npm run clean:test && npm run clean:test:i",
112112
"clean:build": "rimraf dist bin/worker/worker_source.js bin/worker/worker_source.cjs",
113113
"clean:site": "rimraf reports_site/test-report reports_site/coverage reports_site/live_demo/dist-browser",

0 commit comments

Comments
 (0)