Skip to content

chore: pnpm task graph, per-package build scripts and CI cleanup - #2119

Merged
BlankParticle merged 14 commits into
mainfrom
blank/sync-alchemy-package-exports
Oct 7, 2026
Merged

BlankParticle merged 14 commits into
mainfrom
blank/sync-alchemy-package-exports

Conversation

@BlankParticle

@BlankParticle BlankParticle commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Replace turbo with pnpm 12's task graph, give every package its own build script, rebuild the dist-consumed packages only when stale, and tidy the CI workflows.

Packages

  • Source exports: better-auth, floci, node-utils, pkg and vite-plugin-copy-editor follow alchemy's layout. exports points at src; publishConfig.exports is generated at build time.

    "exports": { ".": "./src/index.ts" },
    "publishConfig": {
      "exports": {
        ".": { "types": "./lib/index.d.ts", "bun": "./src/index.ts", "default": "./lib/index.js" }
      }
    }
  • Per-package build scripts: build:package is node scripts/build.ts, which declares the package's steps and hands them to the shared scripts/package-build.ts. It syncs publishConfig.exports, copies LICENSE / NOTICE / THIRD_PARTY_LICENSES / README, runs the steps, writes a .build-stamp, and logs per-step timings (also appended to .cache/build-timings.jsonl). Replaces copy-package-files.ts and alchemy's old build script.

    // packages/cloudflare-runtime/scripts/build.ts
    build(import.meta.dirname, {
      thirdPartyLicenses: true,
      stamp: "dist",
      steps: [
        named("build distilled (cloudflare)", exec("tsc", "-b", "../../submodules/distilled/packages/cloudflare/tsconfig.json")),
        exec("tsdown"),
      ],
    });
    [build @alchemy.run/cloudflare-runtime] build distilled (cloudflare): 0.07s
    [build @alchemy.run/cloudflare-runtime] tsdown: 2.96s
    [build @alchemy.run/cloudflare-runtime] done in 3.03s
    
  • Builds include dependencies: build runs build:package over the package and its workspace dependencies, so pnpm build in packages/alchemy builds node-utils, cloudflare-runtime, frontend-frameworks, … first. turbo and turbo.json are removed.

    # pnpm-workspace.yaml
    tasks:
      build:package:
        dependsOn: [^build:package]
  • Staleness-aware builds: pnpm ensure:built rebuilds cloudflare-runtime / frontend-frameworks only when dist/ is missing or older than their (or their workspace dependencies') sources. It runs on install (prepare) and before pnpm test / pnpm typecheck.

  • Incremental alchemy build: rm -rf lib && tsc -b --force → tsc -b. The unused publish:packages script is removed.

  • One tsc everywhere: a pnpm patch drops the tsc bin from the typescript-api dev build, which shadowed the catalog compiler in the root and packages/alchemy. Mixed compiler versions made each tsc -b rebuild the other's output, and parallel alchemy rebuilds OOM-killed preview builds.

CI

  • Check: one job, cheapest steps first: format → typecheck → providers lint → oxlint → tests → docs.
  • Cloudflare Tools: type checking moved to pnpm typecheck in Check (now also covering frontend-frameworks' tests) instead of once per OS. Test concurrency uses pnpm's workspace-concurrency; package builds spawn through a shell on Windows.
  • Package Preview: the Go heap limit is dropped now that builds aren't forced; labels other than force-ci no longer start or cancel runs. release.yml builds with pnpm build:pkg.
  • Website: deploy and destroy are one job that picks the action from the PR state.
  • claude.yml is removed.

…n demand

- Point workspace `exports` at `src` for better-auth, floci, node-utils, pkg
  and vite-plugin-copy-editor; generate `publishConfig.exports` with the new
  `scripts/sync-package-files.ts` (Effect CLI), which also copies license files
- Split each package build into `build:package` (compile) and `build`
  (compile with workspace dependencies via `pnpm -r --filter "{.}..."`)
- Remove turbo; order builds with `tasks` in pnpm-workspace.yaml
- Stop building packages on install; `scripts/ensure-built.ts` rebuilds
  cloudflare-runtime / frontend-frameworks only when stale, before tests,
  type checking and website builds
- Make alchemy's build incremental (drop `rm -rf lib` + `--force`) and
  remove the unused `publish:packages` script
- CI: build explicitly where needed, drop turbo caches, release uses
  `build:pkg`, drop the Go heap limit from preview builds
@BlankParticle
BlankParticle force-pushed the blank/sync-alchemy-package-exports branch from ae61d8d to 0051f25 Compare October 7, 2026 11:52
Each package's build:package is now node scripts/build.ts, which declares its
steps and hands them to scripts/package-build.ts. The shared module syncs
publishConfig.exports and license files, runs the steps, writes the
.build-stamp for ensure-built, and prints/records per-step timings to
.cache/build-timings.jsonl. Replaces sync-package-files.ts and the
prebuild/postbuild hooks.
typescript-api aliases a TypeScript dev build whose tsc bin shadowed the
typescript catalog compiler in the root and packages/alchemy. Package builds
then mixed 7.0.2 and 7.1-dev, each treating the other's tsbuildinfo as out of
date; parallel rebuilds of alchemy OOM-killed the preview build. Patch out the
bin so tsc is always the catalog compiler.
@alchemy-version-bot

alchemy-version-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

alchemy

pnpm install https://pkg.alchemy.run/alchemy/pr:2119:62aed07
@alchemy.run (6)
pnpm install https://pkg.alchemy.run/@alchemy.run/better-auth/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare-runtime/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@alchemy.run/node-utils/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@alchemy.run/floci/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@alchemy.run/pkg/pr:2119:62aed07
Transitive Dependencies (18)
pnpm install https://pkg.alchemy.run/@distilled.cloud/acme/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/aws/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/axiom/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/cloudflare/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/core/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/doppler/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/fly-io/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/gcp/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/hetzner/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/iceberg/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/infisical/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/neon/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/planetscale/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/prisma/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/railway/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/stripe/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/zerossl/pr:2119:62aed07
pnpm install https://pkg.alchemy.run/@distilled.cloud/github/pr:2119:62aed07

Published Oct 7, 2026, 2:22 PM UTC. Expires Oct 14, 2026, 2:22 PM UTC, extended while this pull request is open.

getExePath refuses to resolve the native executable unless package.json
declares a tsc bin, which broke lint:providers. Drop that check in the patch.
@BlankParticle
BlankParticle force-pushed the blank/sync-alchemy-package-exports branch from e805746 to e67b01e Compare October 7, 2026 12:31
…y via pnpm

- package-build: spawn through a shell on Windows, where node_modules/.bin
  entries are .cmd shims
- cloudflare-tools: --concurrency was a turbo flag and now reached vitest; set
  pnpm's workspace-concurrency through the environment instead
- cloudflare-runtime: realpath the preview test's temp root so Windows 8.3
  short paths compare equal
- check: one Typecheck step (pnpm typecheck) instead of separate builds
- test:cloudflare-packages: ensure:built instead of a second full build
- check.yml: Preflight (format check) gates Typecheck (+ providers lint and
  type-aware oxlint), Tests and Docs, which then run in parallel.
- website.yml: one job decides deploy or destroy from the PR state.
- typecheck:cloudflare-packages builds via ensure:built, so the Cloudflare
  Test step reuses it; ensure-built spawns through a shell on Windows.
Split jobs each repeated checkout + install (~50s) and the preflight gate
delayed everything by about a minute. One job ordered format check ->
typecheck -> providers lint -> oxlint -> tests -> docs fails fast without
the repeated setup.
The root tsc -b already covers cloudflare-runtime and frontend-frameworks'
sources; pnpm typecheck now also checks frontend-frameworks' tests, so the
Cloudflare matrix drops its Typecheck step.
- package-build: print one '[build <pkg>] <step>: <time>' line per step as it
  finishes, plus start/done lines, so parallel builds stay readable; name the
  distilled and declaration steps
- prepare runs ensure:built again now that it only rebuilds stale packages;
  drop the website pre* hooks and the website workflow's build step it covers
- check.yml: drop the Typecheck comment
@BlankParticle BlankParticle added the deploy-website Deploy the website preview for this PR label Oct 7, 2026
Any label started a preview run and, sharing the push run's concurrency
group, cancelled it. Skip the job unless the label is force-ci and give label
events their own group.
@alchemy-version-bot

alchemy-version-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Website Preview Deployed

URL: https://pr-2119-alchemy-website-preview.testing-2b2.workers.dev

Built from commit ecb0c16.


This comment updates automatically with each push.

@BlankParticle BlankParticle changed the title chore(build): replace turbo with pnpm task graph and build packages on demand chore(build): pnpm task graph, per-package build scripts and CI cleanup Oct 7, 2026
@BlankParticle BlankParticle removed the deploy-website Deploy the website preview for this PR label Oct 7, 2026
@BlankParticle
BlankParticle marked this pull request as ready for review October 7, 2026 14:22
@BlankParticle
BlankParticle added this pull request to stack #2122 October 7, 2026 14:26
@BlankParticle BlankParticle changed the title chore(build): pnpm task graph, per-package build scripts and CI cleanup chore: pnpm task graph, per-package build scripts and CI cleanup Oct 7, 2026
@BlankParticle
BlankParticle merged commit dc4b857 into main Oct 7, 2026
7 checks passed
@BlankParticle
BlankParticle deleted the blank/sync-alchemy-package-exports branch October 7, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant