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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets).

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md).
16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"gl-react-cookbook",
"gl-react-cookbook-expo",
"gl-react-cookbook-expo-camera",
"gl-react-tests"
]
}
2 changes: 2 additions & 0 deletions .changeset/six-birds-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
17 changes: 7 additions & 10 deletions .github/workflows/ci-cookbook-expo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,30 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 24

- run: corepack enable
cache: pnpm

- name: Install dependencies
run: |
yarn install
cd packages/cookbook-expo && yarn install
run: pnpm install --frozen-lockfile

- name: Build gl-react packages
run: |
for d in packages/gl-react packages/gl-react-expo; do
npx babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
pnpm exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
done

- name: Expo prebuild
working-directory: packages/cookbook-expo
run: npx expo prebuild --platform ios --no-install
run: pnpm exec expo prebuild --platform ios --no-install

- name: Bundle JS for iOS
working-directory: packages/cookbook-expo
env:
NODE_PATH: ${{ github.workspace }}/packages/cookbook-expo/node_modules
run: |
node node_modules/expo/bin/cli export:embed \
pnpm exec expo export:embed \
--platform ios \
--entry-file "${{ github.workspace }}/packages/cookbook-expo/index.ts" \
--bundle-output /tmp/main.jsbundle \
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/ci-cookbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: corepack enable
- run: yarn install
cache: pnpm
- run: pnpm install --frozen-lockfile

# Build gl-react packages (needed by cookbook)
- name: Build gl-react packages
run: |
for d in packages/gl-react packages/gl-react-dom; do
yarn workspace gl-react-dev exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
pnpm exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
done

# Install Playwright browsers
- name: Install Playwright
run: yarn workspace gl-react-cookbook e2e:install
run: pnpm --filter gl-react-cookbook e2e:install

# Run Playwright tests
- name: Run Playwright tests
run: yarn workspace gl-react-cookbook e2e
run: pnpm --filter gl-react-cookbook e2e

# Upload test results on failure
- uses: actions/upload-artifact@v4
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- run: corepack enable
- run: yarn install
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Build gl-react packages
run: |
for d in packages/gl-react packages/gl-react-dom packages/gl-react-headless; do
yarn workspace gl-react-dev exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
pnpm exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
done
- run: xvfb-run -s "-ac -screen 0 1280x1024x24" yarn test
- run: xvfb-run -s "-ac -screen 0 1280x1024x24" pnpm test
11 changes: 6 additions & 5 deletions .github/workflows/deploy-cookbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm

- run: corepack enable

- run: yarn install
- run: pnpm install --frozen-lockfile

# Build gl-react packages (cookbook imports from src via Vite alias,
# but mirrors the existing CI pipeline for consistency).
- name: Build gl-react packages
run: |
for d in packages/gl-react packages/gl-react-dom; do
yarn workspace gl-react-dev exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
pnpm exec babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d "$d/lib" "$d/src"
done

# Run Vite build directly (bypassing the package's "tsc && vite build"
Expand All @@ -47,7 +48,7 @@ jobs:
env:
GH_PAGES: "true"
working-directory: packages/cookbook
run: yarn exec vite build
run: pnpm exec vite build

# SPA fallback: GitHub Pages serves 404.html on unknown paths. Copying
# index.html → 404.html lets BrowserRouter handle deep links / refreshes.
Expand Down
54 changes: 38 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,53 @@
name: Publish to npm
# Changesets release flow: on every push to master, this either opens/updates
# a "Version Packages" PR (aggregating pending .changeset entries into version
# bumps + CHANGELOGs), or — when that PR is merged — publishes to npm.
#
# Publishing uses npm trusted publishing (OIDC, no token). The npm-side
# configuration is bound to this workflow filename (publish.yml) — do not
# rename this file without updating the trusted publisher settings of each
# package on npmjs.com.
name: Release

on:
push:
tags:
- 'v*'
branches: [master]

concurrency: release-${{ github.ref }}

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
publish:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"
cache: pnpm

- name: Upgrade npm for trusted publishing (needs >= 11.5.1)
run: npm install -g npm@11 && npm --version

- name: Install headless-gl system dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev

- run: corepack enable
- run: yarn install --no-immutable
- run: yarn build
- run: pnpm install --frozen-lockfile

- name: Publish packages
run: |
for pkg in gl-react gl-react-dom gl-react-expo gl-react-headless gl-react-native; do
cd packages/$pkg && npm publish --provenance && cd ../..
done
- run: pnpm build

- run: xvfb-run -s "-ac -screen 0 1280x1024x24" pnpm test

- name: Create release PR or publish to npm
uses: changesets/action@v1
with:
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

25 changes: 15 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

gl-react is a universal React library for writing and composing WebGL shaders. It uses TypeScript for type checking and is structured as a Yarn workspaces monorepo.
gl-react is a universal React library for writing and composing WebGL shaders. It uses TypeScript for type checking and is structured as a pnpm workspaces monorepo.

## Commands

**Must use Yarn** (npm is blocked by a preinstall check).
**Must use pnpm** (other package managers are blocked by a preinstall check).

```bash
yarn # Install dependencies
yarn build # Babel-compile all packages to lib/ + generate .d.ts
yarn typecheck # Run TypeScript type checking (tsc --noEmit)
yarn watch # Watch mode for development
yarn test # Run Jest tests (packages/tests)
yarn test-rewrite-snapshots # Regenerate test snapshots
yarn prettier # Format source files
yarn cookbook # Start modern cookbook dev server (Vite)
pnpm install # Install dependencies
pnpm build # Babel-compile all packages to lib/ + generate .d.ts
pnpm typecheck # Run TypeScript type checking (tsc --noEmit)
pnpm watch # Watch mode for development
Comment on lines +14 to +17
pnpm test # Run Jest tests (packages/tests)
pnpm test-rewrite-snapshots # Regenerate test snapshots
pnpm prettier # Format source files
pnpm cookbook # Start modern cookbook dev server (Vite)
pnpm changeset # Record a changeset for release notes
```

Tests run via `packages/tests/test.sh`, which executes Jest on each `__tests__/*.js` file individually. On CI (Linux), tests require `xvfb-run` for headless OpenGL.

## Releases

Releases are managed by [changesets](https://github.com/changesets/changesets). Every user-facing change to a publishable package should include a changeset (`pnpm changeset`). On push to master, the Release workflow (`.github/workflows/publish.yml`) opens/updates a "Version Packages" PR; merging that PR publishes to npm via trusted publishing (OIDC — the npm-side config is bound to the `publish.yml` filename, do not rename it). Internal workspace deps use the `workspace:^` protocol, replaced with real versions at publish time.

## Monorepo Package Structure

- **`packages/gl-react/`** — Core library. Defines `Node`, `Bus`, `Shaders`, `GLSL`, `createSurface`, `Visitor`, uniforms, and the rendering pipeline. All other packages depend on this.
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Contributions are always welcome, no matter how large or small.
## Requirement

* **Node 6**+
* [yarn](https://yarnpkg.com)
* [pnpm](https://pnpm.io)
Comment on lines 7 to +8

## Setup / Building

```sh
yarn
pnpm install
```

You must run this each time you modify one of the packages/ of the library.
Expand All @@ -19,21 +19,21 @@ It rebuild the lib/ folders and will copy the packages into the projects.
### Developing

```sh
yarn run watch
pnpm watch
```

> For a faster reload experience, this do like `build` but only for a specific file you modify.

## Testing

```sh
yarn test
pnpm test
```

if you need to regenerate the snapshots:

```sh
yarn run test-rewrite-snapshots
pnpm test-rewrite-snapshots
```

Finally, please check that all examples of the cookbook are working correctly.
Expand All @@ -43,7 +43,7 @@ Finally, please check that all examples of the cookbook are working correctly.
**Run it**

```sh
yarn cookbook
pnpm cookbook
```

## License
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This universal library must be coupled with one of the concrete implementations:

## Links

- **[Cookbook examples](packages/cookbook/)** (`yarn cookbook` to run locally)
- **[Cookbook examples](packages/cookbook/)** (`pnpm cookbook` to run locally)
- [Expo Cookbook](packages/cookbook-expo/)
- [JSFiddle hello gl example](https://jsfiddle.net/greweb/cup5feke/)
- [![Join the chat at https://gitter.im/gl-react/Lobby](https://badges.gitter.im/gl-react/Lobby.svg)](https://gitter.im/gl-react/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Expand Down
37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
{
"name": "gl-react-dev",
"version": "0.0.0",
"workspaces": [
"packages/*"
],
"private": true,
"packageManager": "yarn@4.10.3",
"packageManager": "pnpm@10.34.3",
"license": "MIT",
"scripts": {
"preinstall": "node -e \"if (process.env.npm_execpath.indexOf('yarn') === -1) { console.log('\u001b[31mPlease use yarn\u001b[0m'); process.exit(1); }\"",
"preinstall": "node -e \"if (process.env.npm_execpath.indexOf('pnpm') === -1) { console.log('\u001b[31mPlease use pnpm\u001b[0m'); process.exit(1); }\"",
"build": "./scripts/build.sh",
"watch": "./scripts/watch.sh",
"prettier": "prettier --write 'packages/{gl-react,gl-react-dom,gl-react-expo,gl-react-headless,gl-react-native}/src/**/*.{ts,tsx}' 'packages/cookbook/src/**/*.{ts,tsx}'",
"cookbook": "cd packages/cookbook && yarn dev",
"test": "cd packages/tests && yarn test",
"test-rewrite-snapshots": "cd packages/tests && yarn test -- -u",
"cookbook": "pnpm --filter gl-react-cookbook dev",
"test": "pnpm --filter gl-react-tests test",
"test-rewrite-snapshots": "pnpm --filter gl-react-tests test -u",
"clean": "rm -rf node_modules packages/*/node_modules/ packages/*/lib",
"typecheck": "echo 'TODO: tsc -b (needs peerDep resolution for PnP)'",
"publish": "yarn && yarn build && echo 'Use yarn workspace <pkg> npm publish for each package'"
"changeset": "changeset",
"release": "pnpm build && changeset publish"
},
"resolutions": {
"@babel/plugin-transform-modules-systemjs": "^7.29.4",
"fast-uri": "^3.1.2",
"follow-redirects": "^1.16.0",
"ip-address": "^10.2.0",
"@xmldom/xmldom": "^0.8.13",
"gl": "9.0.0-rc.9",
"qs": "^6.15.2",
"postcss": "^8.5.10"
"pnpm": {
"overrides": {
"@babel/plugin-transform-modules-systemjs": "^7.29.4",
"fast-uri": "^3.1.2",
"follow-redirects": "^1.16.0",
"ip-address": "^10.2.0",
"@xmldom/xmldom": "^0.8.13",
"gl": "9.0.0-rc.9",
"qs": "^6.15.2",
"postcss": "^8.5.10"
}
},
"devDependencies": {
"@babel/cli": "^7.26.0",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.26.0",
"@babel/preset-typescript": "^7.26.0",
"@changesets/cli": "^2.29.0",
"@types/node": "^22.0.0",
"@types/react": "^19.0.0",
"browserify": "^17.0.0",
Expand Down
Loading
Loading