feat: modernize toolchain, runx CLI, and worker templates - #22
Conversation
- wrangler 4.111.0, @cloudflare/vitest-pool-workers 0.16.18, @cloudflare/workers-types 5.20260703.1 - vitest 4.1.5 (+ @vitest/ui), turbo/@turbo/gen 2.10.1, prettier 3.8.3, syncpack 15.1.2, oxlint 1.60.0, oxlint-tsgolint 0.21.1 - declare explicit vite 7.3.5 where vitest-pool-workers is used - set remoteBindings: false in cloudflareTest() configs - syncpack 15: drop lintFormatting, add url specifier guard - pnpm 11.2.2: move .npmrc settings into pnpm-workspace.yaml, allowBuilds map, verifyDepsBeforeRun, mise pnpm 11.2.2 / bun 1.3.12
…ild/dev orchestration, and DX hardening - fix broken @repo/tools exports (src/lib/ never existed) with explicit subpath exports: ./path, ./environment, ./workspace, ./package - port workspace introspection: getWorkspacePackages(), getWorkersProjects(), globProjectFiles() with git check-ignore filtering; getRepoRoot() is now anchored to the tools package location instead of cwd - add 'runx build wrangler' (wrangler deploy --dry-run --outdir ./dist with --config/--no-minify/--no-output, FORCE_COLOR outside CI, timed) and point build:wrangler scripts at it, removing bin/run-wrangler-build - dev: 'runx dev wrangler' builds workspace deps first and copies .dev.vars.example to .dev.vars when missing; run-wrangler-dev delegates to it - check: run workers-types check regardless of --format (new -w flag) - prettier: stable cache location node_modules/.cache/.prettier/.prettier-cache - bins: explicit 'vitest run' + maxConcurrency, run-vitest-watch (watchexec), DISABLE_TSGO and FIX_OXLINT escape hatches, syncpack fix - root DX: Justfile dotenv-load + agent-friendly 'just lint' recipe, .mise.toml fd/watchexec, .prettierignore generic build-output entries
turbo.json is now generated from turbo.config.ts using the turbo-config package. Workspace packages with build scripts are computed dynamically as dependsOn for the root lint/test tasks, replacing the hand-maintained comment-driven list. Adds check:turbo-config to the check:ci flow, a postinstall that regenerates turbo.json (skipped in CI), prettier cache outputs for format tasks, and a just generate-turbo-config recipe.
Adds a shared testing package ported from the internal workers monorepo: - http-mock: useHttpMock()/resetHttpMocks() msw wrapper with a lazily created server and onUnhandledRequest: 'error' - matchers: toBeUUID(), toBeAfterDate() and a corrected toBeGreaterThan() - serializer: opt-in snapshot serializers for Date - suite: testSuite() test.extend harness - env: isWorkers()/isNode() runtime detection Wires it into apps/example-worker-echoback via a vitest setup file and adds a small useHttpMock() demonstration to the integration tests.
…er config in TypeScript - new packages/wrangler-config with defineConfig(), a zod schema generated from wrangler's config-schema.json, and a wrangler-config CLI with generate + check (CI drift guard) - example-worker-echoback now authors wrangler.jsonc via wrangler.config.ts - turbo build:wrangler-config task wired into build (runs check in CI) - worker generators emit wrangler.config.ts and generate wrangler.jsonc
…Workflows Workers
Replace mutable action tags with full commit SHAs, annotated with `# gagen:pin <action>@<tag> = <sha>` comments so future updates stay traceable. Also pin bun-version to 1.3.12 (1.3.14 segfaults on linux x64) and node-version to 22.x instead of lts/*.
- rewrite AGENTS.md as one lean file with the repo's working rules - replace CLAUDE.md with a symlink to AGENTS.md - fix stale README references (turbo.config.ts, prerequisites, generator list, just lint)
… to silence vitest-pool-workers warning
…es with repo versions
SHA pinning in the workers repo comes from the TypeScript workflow generator (gagen); this template defines workflows by hand, so stick to mutable tags. Keeps the bun/node toolchain version pins.
TypeScript-authored Wrangler config is a poor fit for most template users - plain wrangler.jsonc is simpler and matches Cloudflare docs. Generator templates now ship a wrangler.jsonc.hbs with the same modernized defaults the generated config carried (compat date, nodejs_compat, observability, smart placement, NAME/RELEASE vars, version_metadata).
Matches ~/src/workers: apps call 'runx dev wrangler' and 'runx deploy wrangler' directly. NAME comes from wrangler.jsonc vars instead of a --var flag; deploy now also sets ENVIRONMENT:production and retries up to 3 times.
- delete unreferenced get-version/get-branch bins - delete run-vite-* and run-vitest-ci wrappers; scripts call vite/vitest directly - ship .dev.vars.example in the example app and worker generator templates so the runx dev bootstrap actually fires (dotfile templates listed explicitly - '**.hbs' globs skip them) - delete .cursor/.windsurf rule packs superseded by AGENTS.md
Completes the rename - apps and templates already used RELEASE, so check:types was failing.
|
Important Review skippedToo many files! This PR contains 107 files, which is 7 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (134)
You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
…ators run below the workspace root The `gen` and `new-package` justfile recipes no longer cd to the workspace root, and generators now derive the destination from the directory they were run from, falling back to `apps/`/`packages/` at the root. Also fixes `new-package` post-generation steps aborting with `ERR_PNPM_VERIFY_DEPS_BEFORE_RUN`: `fixDepsAndFormat` now runs `bun runx fix --deps`, then `pnpm install`, then `bun runx fix --format` (matching the Worker generators), and `pnpmInstall` no longer filters the install to the new package.
The old set described intermediate states - a wrangler-config package that was added and reverted within the branch, and a turbo-generators bump for a zod change that only touched the example app. Also adds coverage for the wrangler.jsonc modernization, which no changeset described.
Broad modernization pass over the template: newer toolchain, a real
runxCLI instead of wrapper bin scripts, TypeScript-authored Turbo config, a new@repo/test-helperspackage, aworkflows-workergenerator, and a big docs/config cleanup.Toolchain
fdandwatchexecto.mise.toml..npmrcdeleted, its settings moved intopnpm-workspace.yaml(autoInstallPeers,publicHoistPattern).onlyBuiltDependenciesreplaced with the pnpm 11allowBuildsmap. AddedverifyDepsBeforeRun: errorso Turbo running many package scripts can't kick off concurrent implicit installs.bun-version: 1.3.12(1.3.14 segfaults on linux x64). Action tags andnode-version: lts/*are unchanged.runxCLI replaces wrapper binsWrangler orchestration moved out of shell scripts and into
@repo/tools:runx build wrangler—wrangler deploy --dry-runwith--minify --outdir ./dist, forces color outside CI, prints build duration.runx deploy wrangler— derivesRELEASEas<version>-<short-sha>, cleans./dist, deploys with--var RELEASE:… --var ENVIRONMENT:production, uploads sourcemaps, retries 3×.runx dev wrangler— builds workspace deps first, copies.dev.vars.example→.dev.varsif missing, thenwrangler dev.runx check—--workers-typesis now a first-class check run from cwd rather than buried in the--formatbranch, and is part of the default set. Prettier runs now share a cache location so Turbo can cache them.Deleted 9 dead or one-line pass-through bins (
get-branch,get-version,run-vite-*,run-vitest-ci,run-wrangler-{build,dev,deploy}). Addedrun-vitest-watch.run-tscgained aDISABLE_TSGOescape hatch,run-oxlintaFIX_OXLINTflag, andrun-vitestnow runs explicitly inrunmode.New library modules with tests:
workspace/workspace.ts(getWorkspacePackages,getWorkersProjects,globProjectFiles), zod-validatedgetPackageJson(),timeFn(),isCI().getRepoRoot()is now anchored toimport.meta.dirnameso it's deterministic regardless of cwd.Turbo config in TypeScript
turbo.jsonc→ generatedturbo.json, authored inturbo.config.tsviaturbo-config. The win: the config introspects the workspace at generation time —buildPackagesis derived by scanning every package for abuildscript and injected intodependsOnfor the root-only tasks, replacing a hand-maintained list. A//#check:turbo-configtask verifiesturbo.jsonis in sync, andpostinstallregenerates it outside CI. Prettier cache is now declared as a task output.New
@repo/test-helpersSource-only package (no build step) with five entrypoints:
/test— msw-based HTTP mocking. The server is created lazily so importing from a setup file doesn't start intercepting, and it runs withonUnhandledRequest: 'error'so un-mocked outbound requests fail the test instead of hitting the network./matchers—toBeUUID(),toBeAfterDate(), and atoBeGreaterThan()that fails rather than throws on non-numbers. Failures carryactual/expectedso vitest renders a diff./serializer— snapshot serializers scoped per test (keyed on test path + name), so enabling one doesn't leak into later tests./suite—testSuite(), vitesttestpre-extended with a harness fixture.isWorkers()/isNode()runtime detection.Wired up in
example-worker-echobackas a working example.New
workflows-workergeneratorScaffolds a Hono worker backed by Cloudflare Workflows: a
WorkflowEntrypointsubclass with tagged logging and zod-parsed params, an admin route for querying instance status (validated with@hono/standard-validator+ts-patternexhaustive matching over known workflow slugs), a create-instance route, and integration tests that validate responses with zod.Worker template updates
All worker templates (and the example app) converge on one shape:
compatibility_date→ 2026-06-04, plusworkers_dev: false,preview_urls: false,placement: { mode: "smart" }, andversion_metadatabound toCF_VERSION_METADATA.SENTRY_RELEASE→RELEASEeverywhere (SharedHonoEnv, wrangler vars, deploy command, app source). Sentry was never actually wired up; the TODO comments marking where you'd add it remain..dev.vars.examplein every worker template, listed explicitly intemplateFilesbecause plop's**.hbsglob skips dotfiles.remoteBindings: falsein vitest configs; scripts userunxinstead of wrapper bins; stale dep pins refreshed.fix-allnow generatesworker-configuration.d.tsbefore running lint/type passes, so a freshly generated worker passes checks.@repo/wrangler-config(TypeScript-authored wrangler config) was tried mid-branch and reverted —wrangler.jsoncis authored directly.Generators run in the current directory
just genandjust new-packageno longer cd to the workspace root — generators derive the destination from where they were invoked (apps/my-team/→apps/my-team/<name>), falling back toapps//packages/at the root. This also fixesnew-packageaborting withERR_PNPM_VERIFY_DEPS_BEFORE_RUN: the post-generation step now runsfix --deps→pnpm install→fix --format, and the install is no longer filtered to the new package.Docs and editor config
AGENTS.mdrewritten from a 78-line XML-tagged blob into 27 lines of plain markdown, andCLAUDE.mdis now a symlink to it — one source of truth..cursor/rules/,.windsurf/rules/, and a stale.claude/agents/file, all superseded byAGENTS.md..vscode/settings.jsonscrubbed of personal leftovers (file-nesting patterns and cSpell words from unrelated repos).just lintrunscheck:lint+check:typesrepo-wide with grouped logs and--continue.dagger-specific lint override from@repo/oxlint-config.Testing
bun turbo check:cipasses: 30 tests across 6 files, plus lint, types, deps, format, and workers-types checks.