Skip to content

Commit 910b65c

Browse files
gregrewebclaude
authored
Modernize toolchain: esbuild + vitest + GitHub Actions (#59)
* Modernize toolchain: esbuild + vitest + GitHub Actions Replace legacy dev stack (browserify, uglify-js, mocha, budo, assert) with esbuild and vitest. Adds GitHub Actions CI (Node 18/20/22), removes Travis CI. - 395 → 131 packages, 32 → 0 vulnerabilities - Build time: ~2s → 3ms - All 9 tests passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address Copilot review feedback - Drop Node 18 from CI matrix (vitest/vite requires >=20.19.0) - Use npm ci instead of npm install in CI - Update CLAUDE.md commands to reflect new toolchain - Fix CLAUDE.md ESLint wording (not enforced in CI) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address remaining review feedback - Bump esbuild ^0.27.0, vitest ^4.1.0 (all deps latest) - Remove engines field (unnecessary for a lib) - Add Node 24 to CI matrix - Remove visual-demo.js and its README reference - Fix README: correct lib path (src/index.js), typo Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix example/index.html to use dist bundle Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: greweb <greweb@protonmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7785b0b commit 910b65c

10 files changed

Lines changed: 1838 additions & 3368 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [20, 22, 24]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
- run: npm ci
19+
- run: npm test
20+
- run: npm run build-dev
21+
- run: npm run build-prod

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

CLAUDE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
bezier-easing is a micro-library that provides cubic Bezier curve easing functions, equivalent to CSS `transition-timing-function: cubic-bezier(...)`. It uses Newton-Raphson iteration, binary subdivision, and precomputed sample tables for fast, precise x→y projection on Bezier curves.
8+
9+
## Commands
10+
11+
- **Test:** `npm test` (runs vitest)
12+
- **Benchmark:** `npm run benchmark`
13+
- **Build:** `npm run prepublish` (esbuild → dist/)
14+
15+
## Architecture
16+
17+
Single-file library (`src/index.js`) exporting a factory function `bezier(mX1, mY1, mX2, mY2)` that returns an easing function `(x) => y`. X values must be in [0, 1]; Y values are unconstrained. Linear curves (where x1===y1 && x2===y2) short-circuit to identity.
18+
19+
The algorithm precomputes 11 sample points on the curve, then for a given x: looks up the nearest sample interval, estimates t via linear interpolation, and refines using Newton-Raphson (if slope is steep enough) or binary subdivision (fallback).
20+
21+
## Code Style
22+
23+
2-space indent, single quotes, semicolons, unix line endings (`.eslintrc` present but eslint not in devDependencies).

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ Install the deps:
8181
npm install
8282
```
8383

84-
The library is in `index.js`.
84+
The library is in `src/index.js`.
8585

86-
Ensure any modication will:
86+
Ensure any modification will:
8787
- keep validating the tests (run `npm test`)
8888
- not bring performance regression (compare with `npm run benchmark` – don't rely 100% on its precision but it still helps to notice big gaps)
89-
- Run the visual example: `npm run visual`

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</head>
88
<body>
99
<canvas id="viewport" width=1000 height=400></canvas>
10-
<script src="../index.js"></script>
10+
<script src="../dist/bezier-easing.js"></script>
1111
<script>
1212
var canvas = document.getElementById("viewport"), ctx = canvas.getContext("2d");
1313

0 commit comments

Comments
 (0)