Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at [INSERT CONTACT
METHOD]. All complaints will be reviewed and investigated promptly and fairly.
reported to the community leaders responsible for enforcement by tagging
[James Robb](https://github.com/jamesrweb) or
[Eugene Dyko](https://github.com/yevdyko) directly, or via GitHub's built-in
report feature for sensitive cases. All complaints will be reviewed and
investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Please fill out this template to help us address your issue as quickly as possib
- [ ] πŸ“ Documentation Issue
- [ ] πŸ€” Question
- [ ] 🧹 Chore
- [ ] ❓Other
- [ ] ❓ Other

## Description

Expand Down
2 changes: 1 addition & 1 deletion .github/SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ check:
## Code of Conduct

Please note that this project adheres to a
[Code of Conduct](https://github.com/p5-wrapper/react/blob/master/CODE_OF_CONDUCT.md).
[Code of Conduct](https://github.com/p5-wrapper/react/blob/main/.github/CODE_OF_CONDUCT.md).
By participating in this project, you agree to abide by its terms.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Find previous successful run
id: previous-run
run: |
RUN_ID=$(gh api "repos/${{ github.repository }}/actions/workflows/CI.yml/runs?status=success&per_page=1" \
RUN_ID=$(gh api "repos/${{ github.repository }}/actions/workflows/continuous-integration.yml/runs?status=success&per_page=1" \
--jq '.workflow_runs[0].id // empty')
echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT
env:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ coverage
*.local
yarn.lock
package-lock.json
pnpm-lock.yaml

# Editor directories and files
.vscode/*
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
462 changes: 462 additions & 0 deletions AGENTS.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CLAUDE.md
64 changes: 53 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ your project.

<details><summary>TypeScript setup</summary>

Install the p5 type definitions as a dev dependency:

```shell
[npm|yarn|pnpm] [install|add] -D @types/p5
```
`p5` ships its own type definitions, so no extra `@types` package is needed β€”
TypeScript picks the types up from the `p5` package automatically.

</details>

Expand Down Expand Up @@ -75,10 +72,10 @@ To run the examples locally:
git clone git@github.com:<your username>/react.git
cd react
pnpm install
pnpm preview
pnpm dev
```

Then open `http://localhost:3001` in a browser.
Then open `http://localhost:5173` in a browser.

## Usage

Expand Down Expand Up @@ -497,10 +494,10 @@ function ErrorChild() {

function ErrorUI(error: unknown) {
if (error instanceof Error) {
return <p>An error occured: {error.message}</p>;
return <p>An error occurred: {error.message}</p>;
}

return <p>An unknown error occured: {String(error)}</p>;
return <p>An unknown error occurred: {String(error)}</p>;
}

function sketch(p5: P5CanvasInstance) {
Expand Down Expand Up @@ -663,11 +660,56 @@ instead of `p5.Vector.random2D()`.

## Development

The source code for the component is in the `src` directory.
The source code for the component is in the `src` directory and the demo
application is in the `demo` directory. You will need
[Node.js](https://nodejs.org) and [pnpm](https://pnpm.io) β€” the exact versions
are pinned in [`package.json`](package.json).

To build, watch and serve the examples (which also watches the component
source):

```sh
pnpm preview
pnpm dev
```

### Contributing

Before opening a pull request, make sure your changes pass every quality gate:

```sh
pnpm integrate
```

This runs the same checks as CI β€” formatting, linting, tests, and builds. Pull
requests are reviewed against the
[pull request template](.github/PULL_REQUEST_TEMPLATE.md) and must keep the
public API in `src/main.tsx` backwards compatible. Commits follow the
[conventional commit](https://www.conventionalcommits.org) style (`feat:`,
`fix:`, `chore:`, etc.) β€” emoji prefixes are only used by automated pull
requests.

The `typescript` dependency is pinned to `6.0.3` on purpose:
[typescript-eslint](https://typescript-eslint.io) does not support TypeScript 7
yet β€” the Go-based v7 is not feature compatible with the v6 API it builds on,
and upstream support cannot land before TypeScript 7.1.x. It is tracked in
[typescript-eslint#10940](https://github.com/typescript-eslint/typescript-eslint/issues/10940).
Please do not widen the pin in pull requests β€” we wait for full feature parity
before migrating to v7, no half measures.

#### AI-assisted contributions

Contributions developed with the assistance of an AI agent are welcome, but you
β€” the developer β€” are always the ultimately responsible individual for your
contributions. AI agents cannot author or certify them. When AI assistance is
used:

- Commit with `--signoff` (`git commit -s`) so that you certify the
[Developer Certificate of Origin](https://developercertificate.org/) for the
work yourself
- Optionally credit the agent with an `Assisted-by: LLM` trailer in the commit
message, as
[recommended by the Linux kernel team](https://docs.kernel.org/process/coding-assistants.html)
- Ensure all work adheres to the [MIT licence](LICENSE)

See [`AGENTS.md`](AGENTS.md) for the full set of rules agents follow in this
repository.
2 changes: 1 addition & 1 deletion config/vite/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function demo(root: string): UserConfig {
plugins: [react()],
preview: { open: true },
build: {
chunkSizeWarningLimit: 1200,
chunkSizeWarningLimit: 1250,
emptyOutDir: false,
rollupOptions: {
output: {
Expand Down
3 changes: 1 addition & 2 deletions config/vite/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ export function library(root: string): UserConfig {
lib: {
entry: resolve(root, "src", "main.tsx"),
name: "P5Canvas",
fileName: "P5Canvas",
fileName: format => (format === "es" ? "main.mjs" : "main.cjs"),
formats: ["es", "cjs"]
},
rollupOptions: {
external: ["react", "react/jsx-runtime", "react-dom", "p5"],
output: {
assetFileNames: "assets/[name][extname]",
entryFileNames: "[name].[format].js",
dir: dist,
globals: {
p5: "p5",
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"packageManager": "pnpm@11.25.0",
"engines": {
"node": ">=24.14.0"
"node": ">=24.20.0"
},
"homepage": "https://github.com/P5-wrapper/react",
"license": "MIT",
Expand All @@ -14,13 +14,13 @@
"dist/component/*"
],
"types": "./dist/component/main.d.ts",
"main": "./dist/component/main.cjs.js",
"module": "./dist/component/main.esm.js",
"main": "./dist/component/main.cjs",
"module": "./dist/component/main.mjs",
"exports": {
".": {
"types": "./dist/component/main.d.ts",
"import": "./dist/component/main.esm.js",
"require": "./dist/component/main.cjs.js"
"import": "./dist/component/main.mjs",
"require": "./dist/component/main.cjs"
}
},
"scripts": {
Expand All @@ -33,7 +33,7 @@
"integrate": "pnpm format:check && pnpm lint && pnpm test && pnpm build",
"lint": "eslint --config config/eslint/eslint.config.ts",
"lint:fix": "pnpm lint --fix",
"prettier": "prettier --config config/prettier/prettier.json --ignore-path .gitignore",
"prettier": "prettier --config config/prettier/prettier.json --ignore-path .gitignore --ignore-path .prettierignore",
"test": "vitest run --silent --config config/vite/vite.config.ts",
"test:coverage": "vitest run --silent --coverage --config config/vite/vite.config.ts",
"test:watch": "vitest watch --config config/vite/vite.config.ts"
Expand Down Expand Up @@ -121,7 +121,7 @@
"react": "19.2.8",
"react-dom": "19.2.8",
"rimraf": "^6.1.3",
"typescript": "^6.0.3",
"typescript": "6.0.3",
"typescript-eslint": "^8.69.0",
"vite": "^8.2.2",
"vite-plugin-dts": "^5.1.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading