bits-to-dead-trees 1.0.0 → 1.1.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.
@@ -16,14 +16,14 @@ jobs:
16
16
  ref: ${{ github.ref_name }}
17
17
 
18
18
  - name: Login to GitHub Container Registry
19
- uses: docker/login-action@v1
19
+ uses: docker/login-action@v2
20
20
  with:
21
21
  registry: ghcr.io
22
22
  username: ${{ github.repository_owner }}
23
23
  password: ${{ secrets.GITHUB_TOKEN }}
24
24
 
25
25
  - name: Build and push builder image
26
- uses: docker/build-push-action@v2
26
+ uses: docker/build-push-action@v3
27
27
  with:
28
28
  file: Dockerfile
29
29
  push: true
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Set up Node
17
17
  uses: actions/setup-node@v3
18
18
  with:
19
- node-version: lts/*
19
+ node-version-file: .tool-versions
20
20
  cache: npm
21
21
 
22
22
  - name: Install npm dependencies
@@ -18,11 +18,11 @@ jobs:
18
18
  # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
19
19
  fetch-depth: 0
20
20
 
21
- - name: Setup Node.js
21
+ - name: Set up Node
22
22
  uses: actions/setup-node@v3
23
23
  with:
24
+ node-version-file: .tool-versions
24
25
  cache: npm
25
- node-version: lts/*
26
26
 
27
27
  - name: Install Dependencies
28
28
  run: npm install
package/.tool-versions CHANGED
@@ -1 +1 @@
1
- nodejs 16.14.2
1
+ nodejs 16.16.0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # bits-to-dead-trees
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - aa60fb0: Upgrade to Ubuntu Jammy instead of Focal
8
+
9
+ ### Patch Changes
10
+
11
+ - a8bd6fa: Update to Playwright 1.25.0 (new browser versions again!)
12
+
13
+ ## 1.0.2
14
+
15
+ ### Patch Changes
16
+
17
+ - 86a275d: Fix server crash due to missing schema
18
+ - 029ce39: Fix server crash due to pretty print on development
19
+
20
+ ## 1.0.1
21
+
22
+ ### Patch Changes
23
+
24
+ - cd71c2f: Update playwright to 1.23.2 (new browser versions)
25
+
3
26
  ## 1.0.0
4
27
 
5
28
  ### Major Changes
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM mcr.microsoft.com/playwright:v1.21.1-focal
1
+ FROM mcr.microsoft.com/playwright:v1.25.0-jammy
2
2
 
3
3
  ENV NODE_ENV=production
4
4
  ENV SERVER_PORT=8000
@@ -13,9 +13,9 @@ RUN apt-get update -yqq && \
13
13
 
14
14
  COPY ["package.json", "package-lock.json*", "./"]
15
15
 
16
- RUN npm install --production --ignore-scripts
16
+ RUN npm install --omit=dev --ignore-scripts
17
17
 
18
- COPY ["index.js", "schemas", "./"]
18
+ COPY ["index.js", "pdf_request_body.json", "./"]
19
19
 
20
20
  ENTRYPOINT ["tini", "-v", "--"]
21
21
  CMD ["node", "index.js"]
package/README.md CHANGED
@@ -41,3 +41,17 @@ The server exposes the `/pdf` endpoint that listens to a POST request and expect
41
41
  `options` are the options Playwright knows about PDF: https://playwright.dev/docs/api/class-page#page-pdf. We pass them to Playwright directly, so please refer to their docs.
42
42
 
43
43
  The response is the PDF file.
44
+
45
+ ## Docker
46
+
47
+ Versions are automatically build as Docker images and are available on [GitHub's package registry](https://github.com/rmehner/bits-to-dead-trees/pkgs/container/bits-to-dead-trees)
48
+
49
+ If you want to use it internally with docker-compose, this should give you a good idea to start:
50
+
51
+ ```yml
52
+ services:
53
+ pdf:
54
+ image: ghcr.io/rmehner/bits-to-dead-trees:v1.0.0
55
+ ports:
56
+ - 8000:8000
57
+ ```
package/index.js CHANGED
@@ -12,20 +12,23 @@
12
12
 
13
13
  const { fastify } = require("fastify");
14
14
  const playwright = require("playwright-core");
15
- const PdfRequestBodySchema = require("./schemas/pdf_request_body.json");
15
+ const PdfRequestBodySchema = require("./pdf_request_body.json");
16
16
 
17
17
  const SERVER_PORT = process.env["SERVER_PORT"] ?? 8000;
18
18
  const SERVER_ADDRESS = process.env["SERVER_ADDRESS"] ?? "localhost";
19
19
 
20
20
  const server = fastify({
21
21
  logger: {
22
- prettyPrint:
22
+ transport:
23
23
  process.env["NODE_ENV"] !== "production"
24
24
  ? {
25
- translateTime: "HH:MM:ss Z",
26
- ignore: "pid,hostname",
25
+ target: "pino-pretty",
26
+ options: {
27
+ translateTime: "HH:MM:ss Z",
28
+ ignore: "pid,hostname",
29
+ },
27
30
  }
28
- : false,
31
+ : undefined,
29
32
  },
30
33
  });
31
34
 
@@ -82,7 +85,7 @@ server.get("/health", async (_, response) => response.code(200).send());
82
85
 
83
86
  const startServer = async () => {
84
87
  try {
85
- await server.listen(+SERVER_PORT, SERVER_ADDRESS);
88
+ await server.listen({ port: +SERVER_PORT, host: SERVER_ADDRESS });
86
89
  } catch (error) {
87
90
  console.error(error);
88
91
  process.exit(1);
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": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "description": "Turn HTML into PDF files",
6
6
  "repository": "github:rmehner/bits-to-dead-trees",
7
7
  "license": "Apache-2.0",
@@ -20,7 +20,7 @@
20
20
  "format": "prettier --write **/*.{js,ts,json,md}",
21
21
  "start": "node index.js",
22
22
  "start:dev": "nodemon --inspect index.js",
23
- "dump-schemas": "typescript-json-schema types/schemas.ts PdfRequestBody --out schemas/pdf_request_body.json",
23
+ "dump-schemas": "typescript-json-schema types/schemas.ts PdfRequestBody --out pdf_request_body.json",
24
24
  "update-schemas": "npm run dump-schemas && npm run format",
25
25
  "postinstall": "npx playwright install chromium",
26
26
  "add-changeset": "changeset",
@@ -28,16 +28,17 @@
28
28
  "ts-check": "npx tsc --noEmit"
29
29
  },
30
30
  "dependencies": {
31
- "fastify": "^3.28.0",
32
- "playwright-core": "^1.21.1"
31
+ "fastify": "^4.4.0",
32
+ "playwright-core": "^1.25.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@changesets/cli": "^2.22.0",
36
- "eslint": "^8.13.0",
35
+ "@changesets/cli": "^2.24.2",
36
+ "eslint": "^8.22.0",
37
37
  "eslint-config-prettier": "^8.5.0",
38
- "nodemon": "^2.0.15",
39
- "pino-pretty": "^7.6.1",
40
- "prettier": "^2.6.2",
41
- "typescript-json-schema": "^0.53.0"
38
+ "nodemon": "^2.0.19",
39
+ "pino-pretty": "^8.1.0",
40
+ "prettier": "^2.7.1",
41
+ "tslib": "^2.4.0",
42
+ "typescript-json-schema": "^0.54.0"
42
43
  }
43
44
  }