Skip to content

Instantly share code, notes, and snippets.

@winkerVSbecks
Created April 4, 2026 15:47
Show Gist options
  • Select an option

  • Save winkerVSbecks/a91e35b374a0b8acd9202ce800cac4f3 to your computer and use it in GitHub Desktop.

Select an option

Save winkerVSbecks/a91e35b374a0b8acd9202ce800cac4f3 to your computer and use it in GitHub Desktop.
update-heerich
name update-heerich
description Updates heerich library to the latest version and migrates all sketch files to match the new API. Use when the user wants to upgrade heerich, mentions "update heerich", or needs to fix heerich API breaking changes.
license MIT
allowed-tools Bash, Read, Edit, Glob, Grep

Update Heerich

Overview

Upgrade the heerich npm package to its latest version and migrate all sketch files in the project that use it.

Workflow

1. Check current and latest versions

node -e "const p = require('./node_modules/heerich/package.json'); console.log('installed:', p.version)"
npm info heerich version

2. Identify all files using heerich

grep -rl "from 'heerich'" src/

3. Upgrade the package

npm install heerich@latest

4. Inspect the new API

Read the new bundle to understand what changed:

head -200 node_modules/heerich/dist/heerich.js

Also read src/global.d.ts to see the existing hand-written type declarations for heerich. Diff the old vs new API surface to identify every breaking change before touching any file.

5. Update src/global.d.ts

The file contains hand-written heerich type declarations inside declare module 'heerich' { ... }. Rewrite those declarations to match the new API. Key interfaces to check:

  • HeerichOptions (constructor options: tile, camera)
  • ApplyGeometryOptions (fields: type, position, size, style, mode, etc.)
  • Face (fields: type, points, style, depth, voxel)
  • CameraOptions, BoxStyle, StyleObject, ToSVGOptions, ViewBoxBounds

Update only the declare module 'heerich' block — leave all other declarations in the file untouched.

6. Migrate sketch files

For each file identified in step 2, read it and apply the necessary API changes. Common migration patterns between versions:

  • Constructor options renamed: e.g. tiletileSize, camera.distancecamera.zoom
  • Method renames: e.g. getFaces()render(), applyGeometry()addBox()
  • Face shape changes: e.g. face.points.dataface.vertices, face.type === 'content' guard may change
  • Style API changes: top-level style structure or per-face keys may change

Confirm which patterns apply by checking the actual new bundle before editing any file.

7. Verify

npx tsc --noEmit

Fix any remaining type errors. Do not change logic — only update API call sites to match the new interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment