Skip to content

Commit 94b2acb

Browse files
justjakeclaude
andauthored
Migrate from Yarn to pnpm (#246)
* Migrate from Yarn to pnpm - Replace Yarn 4.0.2 with pnpm 10.29.3 as the package manager - Add pnpm-workspace.yaml and .npmrc configuration - Update all scripts to use pnpm commands - Rename getYarnWorkspaces() to getWorkspaces() in scripts/helpers.ts - Update CI workflow to use pnpm/action-setup@v4 with Node 22 - Add @jitl/tsconfig as root devDependency for proper resolution - Add variant packages as devDependencies for test resolution - Fix TypeScript 5.9 compatibility in memory.ts (Int32Array<ArrayBuffer>) - Upgrade typedoc to 0.28.17 for TypeScript 5.9 support - Upgrade typedoc-plugin-markdown to 4.10.0 - Regenerate documentation with new typedoc version Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Clarify git commit --amend rule in CLAUDE.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * CI: Add --ignore-scripts to pnpm install Equivalent to yarn's YARN_ENABLE_SCRIPTS=0 - prevents prepare scripts from running during install, which would fail on a fresh checkout. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix pnpm tarball naming in smoketest scripts pnpm pack generates tarball names like jitl-quickjs-ffi-types-0.32.0.tgz (without @ prefix, with version) instead of @jitl-quickjs-ffi-types.tgz Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update examples to TypeScript 5.9 for compatibility The library now requires TypeScript 5.9+ due to stricter typed array generics (Int32Array<ArrayBuffer>). Update all TypeScript-using examples. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Use --legacy-peer-deps for create-react-app smoketest react-scripts@5 only supports TypeScript 3.x/4.x, but our library now requires TypeScript 5.9+ for typed array generics. Use --legacy-peer-deps to work around the peer dependency conflict. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix formatting issues Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix remaining formatting issues Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add reminder to run prettier and lint before pushing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Document CI workflow in CLAUDE.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add typedoc.json and remark plugins for in-page table of contents - Add typedoc-plugin-remark, remark-toc, and remark-insert-headings - Configure remark plugins to generate "Contents" section for Class, Interface, Enum, TypeAlias, and Function pages - This restores the in-page TOC that lists methods/properties that was removed in typedoc-plugin-markdown 4.3.0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Use custom remark plugin for headless TOC in docs Replace remark-insert-headings + remark-toc with a custom plugin that inserts the table of contents directly after the class description, without a separate "Contents" heading. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Revert to standard remark plugins for TOC with Contents heading Use remark-insert-headings + remark-toc instead of custom plugin. Remove mdast-util-toc dependency and custom remark-toc-headless.mjs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix lockfile - remove mdast-util-toc * Ignore pnpm-lock.yaml in prettier, update .yarn to .pnpm --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ef60371 commit 94b2acb

389 files changed

Lines changed: 29114 additions & 26519 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,23 @@ jobs:
2929
uses: docker-practice/actions-setup-docker@1.0.8
3030
if: matrix.platform == 'macos-latest'
3131

32-
- name: Setup Node.js environment
33-
uses: actions/setup-node@v3
34-
with:
35-
node-version: 18
36-
3732
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3833
- uses: actions/checkout@v4
3934
with:
4035
# We need `git log` to find git-subtree versions
4136
fetch-depth: 0
4237

43-
- name: Yarn cache
44-
uses: actions/cache@v3
38+
- name: Install pnpm
39+
uses: pnpm/action-setup@v4
40+
41+
- name: Setup Node.js environment
42+
uses: actions/setup-node@v4
4543
with:
46-
path: "**/.yarn/cache"
47-
key: ${{ hashFiles('**/yarn.lock') }}
44+
node-version: 22
45+
cache: 'pnpm'
4846

4947
- name: Install dependencies
50-
run: yarn install --immutable
51-
env:
52-
YARN_ENABLE_SCRIPTS: 0
48+
run: pnpm install --frozen-lockfile --ignore-scripts
5349

5450
- name: EMSDK cache
5551
uses: actions/cache@v3
@@ -60,26 +56,26 @@ jobs:
6056
- name: Environment info
6157
run: |
6258
echo $(which node) v$(node --version)
63-
echo $(which yarn) v$(yarn --version)
59+
echo $(which pnpm) v$(pnpm --version)
6460
echo $(which npx) v$(npx --version)
6561
echo $(npx which tsc) $(npx tsc --version)
6662
echo $(npx which tsup) $(npx tsup --version)
6763
echo $(npx which esbuild) v$(npx esbuild --version)
6864
6965
- name: Build
70-
run: yarn build
66+
run: pnpm run build
7167

7268
- name: Check types
73-
run: yarn check:types
69+
run: pnpm run check:types
7470

7571
- name: Check package.jsons
76-
run: yarn check:packages
72+
run: pnpm run check:packages
7773

7874
- name: Test
79-
run: yarn test:slow
75+
run: pnpm run test:slow
8076

8177
- name: Build tarballs
82-
run: yarn tarball && du -h build/tar/*
78+
run: pnpm run tarball && du -h build/tar/*
8379

8480
- name: Test release with NodeJS minimal ESModule example
8581
run: ./scripts/smoketest-node-minimal.ts
@@ -94,7 +90,7 @@ jobs:
9490
run: ./scripts/smoketest-vite.ts
9591

9692
- name: Check lint
97-
run: yarn lint
93+
run: pnpm run lint
9894

9995
- name: Check format
100-
run: yarn check:format
96+
run: pnpm run check:format

.npmrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Use hoisted node-modules linker (like yarn's nodeLinker: node-modules)
2+
node-linker=hoisted
3+
4+
# Hoist all packages to root node_modules for compatibility with yarn-style resolution
5+
shamefully-hoist=true
6+
7+
# Equivalent to yarn's enableGlobalCache: false
8+
# pnpm uses content-addressable store by default, no need to disable

.prettierignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ts/generated
22
quickjs
3-
.yarn
3+
.pnpm
44
.*
55
doc
66
json-generator-dot-com-1024-rows.json
@@ -13,4 +13,5 @@ emsdk-cache
1313
packages/internal-tsconfig/*.d.*ts
1414
packages/internal-tsconfig/*.*js
1515
vendor
16-
CLAUDE.md
16+
CLAUDE.md
17+
pnpm-lock.yaml

.vscode/settings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@
1111
"emscripten.h": "c",
1212
"quickjs-atom.h": "c"
1313
},
14-
"files.exclude": {
15-
".yarn/releases/*": true
16-
}
14+
"files.exclude": {}
1715
}

.yarn/releases/yarn-4.0.2.cjs

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

.yarnrc.yml

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

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
## v0.32.0
44

55
- [#227](https://github.com/justjake/quickjs-emscripten/pull/227)
6-
76
- Re-works function binding in `newFunction` to use a different proxying strategy based on a new abstraction, `HostRef`. HostRef allows tracking references of host values from guest handles. Once all references to the HostRef object are disposed (either in the host, or GC'd in the guest), the host value will be dereferenced and become garbage collectable.
87
- Functions passed to `newFunction` are interned in the runtime's `HostRefMap` until dereferenced.
98
- `HostRef` is also exposed directly for use from `QuickJSContext`, see `newHostRef`, `toHostRef`, `unwrapHostRef` in the docs.
@@ -140,7 +139,6 @@ In edge cases, you might want to use the IIFE build which provides QuickJS as th
140139
- We now differentiate between runtime environments at build time using Node.JS package.json [export conditions in subpath exports][conditions], instead of including support for all environments in a single build. While this resolves open issues with relatively modern bundlers like webpack@5 and vite, it may cause regressions if you use an older bundler that doesn't understand the "browser" condition.
141140
- The release variants - RELEASE_SYNC (the default), and RELEASE_ASYNC - no longer embed the WebAssembly code inside a JS file. Instead, they attempt to load the WebAssembly code from a separate file. Very old bundlers may not understand this syntax, or your web server may not serve the .wasm files correctly. Please test in a staging environment to verify your production build works as expected.
142141
- quickjs-emscripten now uses [subpath exports in package.json][conditions]. Imports of specific files must be removed. The only valid import paths for quickjs-emscripten are:
143-
144142
- `import * from 'quickjs-emscripten'` (the library)
145143
- `import packageJson from 'quickjs-emscripten/package.json'`
146144
- `import { DEBUG_SYNC, DEBUG_ASYNC, RELEASE_SYNC, RELEASE_ASYNC } from 'quickjs-emscripten/variants'` (these are exported from the main import, but are also available as their own files)
@@ -154,14 +152,12 @@ In edge cases, you might want to use the IIFE build which provides QuickJS as th
154152
## v0.24.0
155153

156154
- [#127](https://github.com/justjake/quickjs-emscripten/pull/127) Upgrade to quickjs 2023-12-09:
157-
158155
- added Object.hasOwn, {String|Array|TypedArray}.prototype.at, {Array|TypedArray}.prototype.findLast{Index}
159156
- BigInt support is enabled even if CONFIG_BIGNUM disabled
160157
- updated to Unicode 15.0.0
161158
- misc bug fixes
162159

163160
- [#125](https://github.com/justjake/quickjs-emscripten/pull/125) (thanks to @tbrockman):
164-
165161
- Synchronizes quickjs to include the recent commit to address CVE-2023-31922.
166162

167163
- [#111](https://github.com/justjake/quickjs-emscripten/pull/111) (thanks to @yourWaifu) ArrayBuffer and binary json encoding:
@@ -182,7 +178,6 @@ In edge cases, you might want to use the IIFE build which provides QuickJS as th
182178
- [#104](https://github.com/justjake/quickjs-emscripten/pull/104) BigInt support.
183179
- [#100](https://github.com/justjake/quickjs-emscripten/pull/100) **Breaking change** upgrade Emscripten version and switch to `async import(...)` for loading variants.
184180
We also drop support for older browsers and Node versions:
185-
186181
- Node >= 16 is required
187182
- Safari >= 14.1 is required
188183
- Typescript >= 4.7 is recommended, but not required.

CLAUDE.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Package Manager
44

5-
Use `corepack yarn` to run yarn commands, e.g.:
5+
Use `corepack pnpm` to run pnpm commands, e.g.:
66

7-
- `corepack yarn install`
8-
- `corepack yarn build`
9-
- `corepack yarn build:ts`
7+
- `corepack pnpm install`
8+
- `corepack pnpm build`
9+
- `corepack pnpm build:ts`
1010

1111
## Building Variants
1212

@@ -17,7 +17,7 @@ To build a variant:
1717
```bash
1818
cd packages/variant-quickjs-<name>
1919
make # builds the C code with emscripten
20-
corepack yarn build:ts # builds the TypeScript wrapper
20+
corepack pnpm build:ts # builds the TypeScript wrapper
2121
```
2222

2323
## Emscripten
@@ -31,7 +31,7 @@ corepack yarn build:ts # builds the TypeScript wrapper
3131
Run all tests:
3232

3333
```bash
34-
corepack yarn test
34+
corepack pnpm test
3535
```
3636

3737
Run tests for a specific variant (e.g., quickjs-ng only):
@@ -49,7 +49,31 @@ Other test filters:
4949

5050
## Git
5151

52-
- Never use `git commit --amend` - always create new commits
52+
- Never use `git commit --amend` - always create new commits. It's better to have a history of what was actually done since branches get rebased/squashed anyway when merged.
53+
- Before pushing, run `pnpm run prettier` and `pnpm run lint` to fix formatting and lint issues. No need to check after every commit - just before pushing.
54+
55+
## CI Workflow
56+
57+
After pushing a PR, monitor CI using the `gh` CLI:
58+
59+
```bash
60+
# Check CI status for a PR
61+
gh pr checks <PR_NUMBER>
62+
63+
# View a specific job's progress
64+
gh run view --job=<JOB_ID>
65+
66+
# Get logs for failed steps
67+
gh run view <RUN_ID> --log-failed
68+
```
69+
70+
When CI fails:
71+
1. Get the failed logs with `gh run view <RUN_ID> --log-failed | tail -100`
72+
2. Fix the issue locally
73+
3. Commit the fix (new commit, don't amend)
74+
4. Push and repeat until CI passes
75+
76+
The full CI build takes ~20 minutes due to emscripten compilation.
5377

5478
## Key Files
5579

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,19 +844,16 @@ audited. Please use with care in production settings.
844844
thinking comes next. Last updated 2022-03-18.
845845

846846
1. Further work on module loading APIs:
847-
848847
- Create modules via Javascript, instead of source text.
849848
- Scan source text for imports, for ahead of time or concurrent loading.
850849
(This is possible with third-party tools, so lower priority.)
851850

852851
2. Higher-level tools for reading QuickJS values:
853-
854852
- Type guard functions: `context.isArray(handle)`, `context.isPromise(handle)`, etc.
855853
- Iteration utilities: `context.getIterable(handle)`, `context.iterateObjectEntries(handle)`.
856854
This better supports user-level code to deserialize complex handle objects.
857855

858856
3. Higher-level tools for creating QuickJS values:
859-
860857
- Devise a way to avoid needing to mess around with handles when setting up
861858
the environment.
862859
- Consider integrating

doc/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)