bits-to-dead-trees 2.25.0 → 2.25.2
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/.github/workflows/keep-node-version-in-sync.yml +1 -0
- package/.node-version +1 -1
- package/CHANGELOG.md +12 -2
- package/Dockerfile +1 -1
- package/README.md +1 -1
- package/package.json +13 -13
- package/test/smoke.test.js +40 -3
package/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
22.
|
|
1
|
+
22.17.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# bits-to-dead-trees
|
|
2
2
|
|
|
3
|
+
## 2.25.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fb6003d`](https://github.com/rmehner/bits-to-dead-trees/commit/fb6003dab4774bb9d771f90d762b312081c94ca0) Thanks [@rmehner](https://github.com/rmehner)! - Upgrade to Playwright 1.53.2
|
|
8
|
+
|
|
9
|
+
## 2.25.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`ed6401e`](https://github.com/rmehner/bits-to-dead-trees/commit/ed6401e829b269eac8832720533a99e826efe346) Thanks [@rmehner](https://github.com/rmehner)! - Upgrade to playwright 1.53.1
|
|
14
|
+
|
|
3
15
|
## 2.25.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -334,7 +346,6 @@
|
|
|
334
346
|
- b4ebed6: Allow more options for pdf, context and goto to be passed. Also working validations.
|
|
335
347
|
|
|
336
348
|
We allow way more options now to be given in the payload:
|
|
337
|
-
|
|
338
349
|
- `pdfOptions` are the options for the `pdf` call in Playwright: https://playwright.dev/docs/api/class-page#page-pdf.
|
|
339
350
|
- `gotoOptions` are the options for the `goto` method in Playwright: https://playwright.dev/docs/api/class-page#page-goto
|
|
340
351
|
- if you don't pass anything, we default to a timeout of 60000 and wait for `networkidle`
|
|
@@ -344,7 +355,6 @@
|
|
|
344
355
|
We finally added tests too! ✌️
|
|
345
356
|
|
|
346
357
|
## Breaking Changes
|
|
347
|
-
|
|
348
358
|
- We don't allow `options` in the payload anymore. Those are `pdfOptions` now. To adapt your code, rename `options` to `pdfOptions` and you should be good to go.
|
|
349
359
|
This change was needed to allow more options for other methods we're using (like `timeout` for `goto`).
|
|
350
360
|
- We have stricter validation now and don't allow unknown keys in the option objects now. Previously we've ignored them, but we've now opted to bail out with
|
package/Dockerfile
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bits-to-dead-trees",
|
|
3
3
|
"author": "Robin Mehner <robin@coding-robin.de>",
|
|
4
|
-
"version": "2.25.
|
|
4
|
+
"version": "2.25.2",
|
|
5
5
|
"description": "Turn HTML into PDF files",
|
|
6
6
|
"repository": "github:rmehner/bits-to-dead-trees",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -30,25 +30,25 @@
|
|
|
30
30
|
"ts-check": "npx tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"fastify": "^5.
|
|
34
|
-
"playwright-core": "^1.53.
|
|
33
|
+
"fastify": "^5.4.0",
|
|
34
|
+
"playwright-core": "^1.53.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@changesets/changelog-github": "^0.5.1",
|
|
38
|
-
"@changesets/cli": "^2.29.
|
|
39
|
-
"@eslint/js": "^9.
|
|
40
|
-
"@tsconfig/node20": "^20.1.
|
|
41
|
-
"@types/lodash": "^4.17.
|
|
42
|
-
"@types/node": "22.
|
|
43
|
-
"eslint": "^9.
|
|
38
|
+
"@changesets/cli": "^2.29.5",
|
|
39
|
+
"@eslint/js": "^9.30.1",
|
|
40
|
+
"@tsconfig/node20": "^20.1.6",
|
|
41
|
+
"@types/lodash": "^4.17.20",
|
|
42
|
+
"@types/node": "22.16.0",
|
|
43
|
+
"eslint": "^9.30.1",
|
|
44
44
|
"eslint-config-prettier": "^10.1.5",
|
|
45
|
-
"eslint-plugin-n": "^17.
|
|
45
|
+
"eslint-plugin-n": "^17.21.0",
|
|
46
46
|
"eslint-plugin-promise": "^7.2.1",
|
|
47
|
-
"globals": "^
|
|
47
|
+
"globals": "^16.3.0",
|
|
48
48
|
"nodemon": "^3.1.10",
|
|
49
49
|
"pino-pretty": "^13.0.0",
|
|
50
|
-
"prettier": "^3.
|
|
50
|
+
"prettier": "^3.6.2",
|
|
51
51
|
"typescript-json-schema": "^0.65.1",
|
|
52
|
-
"vitest": "^3.2.
|
|
52
|
+
"vitest": "^3.2.4"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/test/smoke.test.js
CHANGED
|
@@ -1,14 +1,51 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
1
|
+
import { describe, expect, it, beforeAll, afterAll } from "vitest";
|
|
2
|
+
import { createServer } from "node:http";
|
|
2
3
|
|
|
3
4
|
import build from "../app";
|
|
4
5
|
const app = build();
|
|
5
6
|
|
|
7
|
+
const startServer = async () => {
|
|
8
|
+
const server = createServer((req, res) => {
|
|
9
|
+
if (req.url.endsWith("success")) {
|
|
10
|
+
res.writeHead(200, { "Content-Type": "text/html" });
|
|
11
|
+
res.end(`
|
|
12
|
+
<!DOCTYPE html>
|
|
13
|
+
<html>
|
|
14
|
+
<body>
|
|
15
|
+
<h1>All local servers are beautiful</h1>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
18
|
+
`);
|
|
19
|
+
} else {
|
|
20
|
+
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
21
|
+
res.end("Not Found");
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
await new Promise((resolve) => {
|
|
26
|
+
server.listen(0, "127.0.0.1", resolve);
|
|
27
|
+
});
|
|
28
|
+
return server;
|
|
29
|
+
};
|
|
30
|
+
|
|
6
31
|
describe("Smoke tests", { timeout: 10_000, retry: 3 }, () => {
|
|
32
|
+
let server;
|
|
33
|
+
let baseUrl = "";
|
|
34
|
+
|
|
35
|
+
beforeAll(async () => {
|
|
36
|
+
server = await startServer();
|
|
37
|
+
baseUrl = `http://127.0.0.1:${server.address().port}`;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
afterAll(() => {
|
|
41
|
+
server?.close();
|
|
42
|
+
});
|
|
43
|
+
|
|
7
44
|
it("sends the PDF on the success case", async () => {
|
|
8
45
|
const response = await app.inject({
|
|
9
46
|
method: "POST",
|
|
10
47
|
url: "/pdf",
|
|
11
|
-
payload: { url:
|
|
48
|
+
payload: { url: `${baseUrl}/success` },
|
|
12
49
|
});
|
|
13
50
|
|
|
14
51
|
expect(response.payload.startsWith("%PDF")).toBeTruthy();
|
|
@@ -19,7 +56,7 @@ describe("Smoke tests", { timeout: 10_000, retry: 3 }, () => {
|
|
|
19
56
|
method: "POST",
|
|
20
57
|
url: "/pdf",
|
|
21
58
|
payload: {
|
|
22
|
-
url:
|
|
59
|
+
url: `${baseUrl}/404`,
|
|
23
60
|
},
|
|
24
61
|
});
|
|
25
62
|
|