Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feat/form-annotation
Browse files Browse the repository at this point in the history
# By Diego Muracciole (31) and others
# Via GitHub
* upstream/master: (60 commits)
  feat: allow units for page size (diegomura#2773)
  chore: bump jay-peg
  chore: release packages (diegomura#2981)
  fix(textkit): make indentation only affect first line. (diegomura#2975)
  fix: conditional rendering (diegomura#2983)
  fix(reconciler): missing dependencies (diegomura#2980)
  chore: release packages (diegomura#2959)
  feat: rem border widths (diegomura#2960)
  fix: add scheduler dependency (diegomura#2958)
  chore: update README
  chore: release packages (diegomura#2953)
  feat: support rem units (diegomura#2955)
  feat: add image stress test example (diegomura#2954)
  feat: support multiple line-height units (diegomura#2952)
  chore: release packages (diegomura#2946)
  fix: note rendering (diegomura#2951)
  feat: accept commas between transformations (diegomura#2950)
  fix: document metadata setters (diegomura#2949)
  fix: stroke dash array computation (diegomura#2948)
  feat: remove cross-fetch (diegomura#2947)
  ...

# Conflicts:
#	packages/renderer/index.d.ts
  • Loading branch information
natterstefan committed Dec 5, 2024
2 parents 0868599 + 18834ef commit 2f0c551
Show file tree
Hide file tree
Showing 241 changed files with 3,940 additions and 1,477 deletions.
6 changes: 0 additions & 6 deletions .changeset/nine-ways-walk.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/old-otters-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@react-pdf/stylesheet": minor
"@react-pdf/layout": minor
---

Changed unit behavior according to PDF spec. Please note that all unitless values are considered as user unit which is a 72dpi equality of the value. This is according to PDF spec and ensures a consistent layout independent of the dpi setting.
9 changes: 0 additions & 9 deletions .changeset/pretty-jars-begin.md

This file was deleted.

11 changes: 5 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Here I present a quick guide about how to setup your development environment exa

### 1. Clone react-pdf project

This goes without saying but first you need to download the code
This goes without saying but first you need to download the code:

```sh
git clone https://github.com/diegomura/react-pdf.git
Expand All @@ -33,22 +33,21 @@ cd react-pdf

### 2. Install Node 18

If you have `nvm` installed all you have to do is
If you have `nvm` installed all you have to do is:

```sh
nvm install 18
nvm use
```

Other versions should work although I can't guarantee it
Other versions should work although I can't guarantee it.

### 3. Install dependencies and boostrap monorepo

We need to download this project dependencies in order to make it work. Because this is a monorepo, we also have to bind all the internal packages together so they are aware of each other. Both things can be done by running:

```sh
yarn install
yarn bootstrap
```

### 4. Build & watch codebase
Expand All @@ -61,13 +60,13 @@ yarn watch

### 5. Setup testing project

Now that we have react-pdf built and running, we need to setup a testing project to use as a development target. This might not be the more straighforward way to set up your dev environment but enables to use the lib as an "external" agent, just as final users will do. It's also extensible for testing in different environmens, whether it is a web or node project, or electron or native app. I usually have a web project (just a plain [create react app](https://reactjs.org/docs/create-a-new-react-app.html) project, and a Node one.
Now that we have react-pdf built and running, we need to setup a testing project to use as a development target. This might not be the most straightforward way to set up your dev environment but enables use of the lib as an "external" agent, just as end users will do. It's also extensible for testing in different environments, whether it is a web or node project, or electron or native app. I usually have a web project (just a plain [create react app](https://reactjs.org/docs/create-a-new-react-app.html) project), and a Node one.

### 6. Link your react-pdf build to your testing project

Now all we have to do is make our testing project point to our react-pdf watch instance so we can apply changes to it and see them working. For that I use `yarn link`.

On another terminal
On another terminal:

```sh
cd react-pdf/packages/renderer # navigate to react-pdf renderer package
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: CI
on:
pull_request:
branches:
- master
- '**'
push:
branches:
- '**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix:
# We aim to test all maintained LTS versions of Node.js as well as the latest stable version
node_version: [18, 20, 21]
react_version: [16, 17, 18]
react_version: [16, 17, 18, 19]

steps:
- name: Checkout
Expand Down
Binary file added .yarn/install-state.gz
Binary file not shown.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
<p align="center">React renderer for creating PDF files on the browser and server<p>
<p align="center">
<a href="https://www.npmjs.com/package/@react-pdf/renderer">
<img src="https://img.shields.io/npm/v/@react-pdf/renderer.svg" />
<img src="https://img.shields.io/npm/v/@react-pdf/renderer?style=flat&colorA=000000&colorB=000000" />
</a>
<a href="https://travis-ci.org/diegomura/react-pdf">
<img src="https://img.shields.io/travis/diegomura/react-pdf.svg" />
<a href="https://opencollective.com/react-pdf">
<img src="https://img.shields.io/opencollective/all/react-pdf?style=flat&colorA=000000&colorB=000000" />
</a>
<a href="https://github.com/diegomura/react-pdf/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/diegomura/react-pdf.svg" />
<img src="https://img.shields.io/github/license/diegomura/react-pdf?style=flat&colorA=000000&colorB=000000" />
</a>
<a href="https://github.com/prettier/prettier">
<img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" />
<a href="https://blockchain.com/btc/address/bc1qj223udztpmt5dck46dw0yap08yum63ht56h90v">
<img src="https://img.shields.io/badge/BTC-f5f5f5?style=flat&colorA=000000&colorB=000000" />
</a>
<a href="https://blockchain.com/eth/address/0x4e1DB76bA0858BbCAa4DD804418D0D9EcF77B1cC">
<img src="https://img.shields.io/badge/ETH-f5f5f5?style=flat&colorA=000000&colorB=000000" />
</a>
</p>
</p>
Expand Down
70 changes: 70 additions & 0 deletions e2e/node-cjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
# @react-pdf/e2e-node-cjs

## 2.0.15

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.5

## 2.0.14

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.4

## 2.0.13

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.3

## 2.0.12

### Patch Changes

- Updated dependencies [[`aab7d958`](https://github.com/diegomura/react-pdf/commit/aab7d95870d9073e4acb004aa0cce9cfa19b7f0e)]:
- @react-pdf/renderer@4.1.2

## 2.0.11

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.1

## 2.0.10

### Patch Changes

- Updated dependencies [[`52b2f253`](https://github.com/diegomura/react-pdf/commit/52b2f25349bee0c09399bc2e7e5e89db5e1433fd)]:
- @react-pdf/renderer@4.1.0

## 2.0.9

### Patch Changes

- Updated dependencies [[`7add014c`](https://github.com/diegomura/react-pdf/commit/7add014c6bc9cff649dd1a56fc47214888613b6b)]:
- @react-pdf/renderer@4.0.2

## 2.0.8

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.0.1

## 2.0.7

### Patch Changes

- Updated dependencies [[`afe4bcfe`](https://github.com/diegomura/react-pdf/commit/afe4bcfe6f4b991cf22341242fc27d169b758d47), [`70f29a04`](https://github.com/diegomura/react-pdf/commit/70f29a0407b1d56e9a7932b25c0d69132e9b4119)]:
- @react-pdf/renderer@4.0.0

## 2.0.6

### Patch Changes

- Updated dependencies [[`ed94775`](https://github.com/diegomura/react-pdf/commit/ed94775f4d44db0886ff08c71d09f446bace6392)]:
- @react-pdf/renderer@3.4.5

## 2.0.5

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions e2e/node-cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-pdf/e2e-node-cjs",
"version": "2.0.5",
"version": "2.0.15",
"license": "MIT",
"private": true,
"type": "commonjs",
Expand All @@ -12,7 +12,7 @@
"start": "node ./index.js"
},
"dependencies": {
"@react-pdf/renderer": "^3.4.4",
"@react-pdf/renderer": "^4.1.5",
"react": "^18.2.0"
}
}
70 changes: 70 additions & 0 deletions e2e/node-esm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
# @react-pdf/e2e-node-esm

## 2.0.15

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.5

## 2.0.14

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.4

## 2.0.13

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.3

## 2.0.12

### Patch Changes

- Updated dependencies [[`aab7d958`](https://github.com/diegomura/react-pdf/commit/aab7d95870d9073e4acb004aa0cce9cfa19b7f0e)]:
- @react-pdf/renderer@4.1.2

## 2.0.11

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.1.1

## 2.0.10

### Patch Changes

- Updated dependencies [[`52b2f253`](https://github.com/diegomura/react-pdf/commit/52b2f25349bee0c09399bc2e7e5e89db5e1433fd)]:
- @react-pdf/renderer@4.1.0

## 2.0.9

### Patch Changes

- Updated dependencies [[`7add014c`](https://github.com/diegomura/react-pdf/commit/7add014c6bc9cff649dd1a56fc47214888613b6b)]:
- @react-pdf/renderer@4.0.2

## 2.0.8

### Patch Changes

- Updated dependencies []:
- @react-pdf/renderer@4.0.1

## 2.0.7

### Patch Changes

- Updated dependencies [[`afe4bcfe`](https://github.com/diegomura/react-pdf/commit/afe4bcfe6f4b991cf22341242fc27d169b758d47), [`70f29a04`](https://github.com/diegomura/react-pdf/commit/70f29a0407b1d56e9a7932b25c0d69132e9b4119)]:
- @react-pdf/renderer@4.0.0

## 2.0.6

### Patch Changes

- Updated dependencies [[`ed94775`](https://github.com/diegomura/react-pdf/commit/ed94775f4d44db0886ff08c71d09f446bace6392)]:
- @react-pdf/renderer@3.4.5

## 2.0.5

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions e2e/node-esm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-pdf/e2e-node-esm",
"version": "2.0.5",
"version": "2.0.15",
"license": "MIT",
"private": true,
"type": "module",
Expand All @@ -12,7 +12,7 @@
"start": "node ./index.js"
},
"dependencies": {
"@react-pdf/renderer": "^3.4.4",
"@react-pdf/renderer": "^4.1.5",
"react": "^18.2.0"
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "independent",
"packages": ["packages/*", "e2e/*"],
"packages": ["packages/*", "packages/examples/*", "e2e/*"],
"npmClient": "yarn"
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"repository": "[email protected]:diegomura/react-pdf.git",
"workspaces": [
"packages/*",
"packages/examples/*",
"e2e/*"
],
"scripts": {
"prepare": "husky",
"build": "lerna run build",
"watch": "lerna run watch --parallel",
"bootstrap": "lerna bootstrap",
"prepublish": "lerna run build",
"lint": "eslint packages",
"test": "vitest",
"dev": "lerna run dev --scope @react-pdf/examples",
"dev": "lerna run dev --scope @react-pdf/examples --",
"changeset": "changeset",
"version-packages": "changeset version",
"release": "changeset publish"
Expand Down Expand Up @@ -65,9 +65,11 @@
"react": "^18.2.0",
"react-16": "npm:react@^16.8.0",
"react-17": "npm:react@^17.0.0",
"react-19": "npm:[email protected]",
"react-dom": "^18.2.0",
"react-dom-16": "npm:react-dom@^16.8.0",
"react-dom-17": "npm:react-dom@^17.0.0",
"react-dom-19": "npm:[email protected]",
"rimraf": "^2.6.3",
"rollup": "^4.9.0",
"rollup-plugin-copy": "^3.5.0",
Expand Down
44 changes: 44 additions & 0 deletions packages/examples/dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Get the directory of the script
scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Get the list of directories adjacent to the script
dirs=()
for dir in "$scriptDir"/*/ ; do
[ -d "$dir" ] && dirs+=("$(basename "$dir")")
done

# Check if any directories were found
if [ ${#dirs[@]} -eq 0 ]; then
echo "No example directories found."
exit 1
fi

if [ -n "$1" ]; then
# First argument provided
selectedDir="$1"
if [[ " ${dirs[@]} " =~ " $selectedDir " ]]; then
echo "Selected example: $selectedDir"
else
echo "Example '$selectedDir' does not exist adjacent to the script."
exit 1
fi
else
# No argument provided, prompt the user to select one
echo "Please select an example:"
select selectedDir in "${dirs[@]}"; do
if [ -n "$selectedDir" ]; then
echo "You selected: $selectedDir"
break
else
echo "Invalid selection."
fi
done
fi

# Run 'yarn dev' inside the selected directory
cd "$scriptDir/$selectedDir" || { echo "Failed to change directory to $scriptDir/$selectedDir"; exit 1; }

echo "Running 'yarn dev' in $scriptDir/$selectedDir"
yarn dev
Loading

0 comments on commit 2f0c551

Please sign in to comment.