diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..a45fd52 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24 diff --git a/.vite-hooks/pre-commit b/.vite-hooks/pre-commit new file mode 100755 index 0000000..85fb65b --- /dev/null +++ b/.vite-hooks/pre-commit @@ -0,0 +1 @@ +vp staged diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..365020e --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,39 @@ +# AGENTS.md + +`@samebase/alchemy-cloudflare-workers-builds` is a community Alchemy v2 provider for Cloudflare +Workers that Workers Builds deploys. It is pinned to `alchemy@2.0.0-beta.80` and Effect 4. + +## Ownership rule + +- Wrangler owns the version. This package owns the Worker shell, the Workers Builds link, the + build variables, and the Worker secrets. +- Never write the Worker's version, bindings, vars, assets, routes, or code. The Wrangler file in + the user's repository is the only source of truth for them. + +## Commands + +- Vite+ (`vp`) owns format, lint, test, and build. +- `pnpm run check`: format check, lint, typecheck, and unit tests. Run it before each commit. +- `pnpm run build`: write `lib/` with `vp pack`. publint and attw then check the package. +- The pre-commit hook runs `vp staged`. The `prepare` script installs the hook. + +## Tests + +- Unit tests read recorded real Cloudflare and GitHub payloads in `test/fixtures/`. +- Make a negative case from a changed recorded payload. Do not write a fixture from scratch. +- Replace a fixture from the API schema with a recording when a live run records it. +- Do not commit a token, a secret value, or other credentials. +- Live tests make real API calls. They run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1` (`test:live`). + +## Automation and docs + +- Write automation in TypeScript under `scripts/`. Node 24 from `.node-version` runs it. +- Automation must work on macOS, Linux, and Windows without Bash or PowerShell. +- Do not add authored `.js`, `.mjs`, or `.cjs` files. +- Write docs in ASD-STE100 Simplified Technical English. Do not use the em dash character. + +## Releases + +- To release, change `version` in `package.json` and add a `CHANGELOG.md` entry in a pull request. +- After the merge, `.github/workflows/release.yml` publishes that version from `main` to npm. +- Do not change `version` in other pull requests. diff --git a/README.md b/README.md index 526a78d..f91d7eb 100644 --- a/README.md +++ b/README.md @@ -292,15 +292,18 @@ Outputs: `workerName`, `name`, `accountId`. ```sh pnpm install pnpm run check # format, lint, typecheck, unit tests -pnpm run build # lib/ with declarations +pnpm run build # lib/ with declarations, then publint and attw pnpm run test:live # real API calls, see below ``` +Use Node 24 (`.node-version`) and pnpm 11. `pnpm install` also installs a pre-commit hook that +runs `vp staged`. + Unit tests run against recorded Cloudflare and GitHub payloads in `test/fixtures/`, and against secret and build token payloads that follow Cloudflare's API schema until a live run records them. They make no network calls. -Live tests run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1`: +Live tests run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1`, which `pnpm run test:live` sets: - `permission.live.test.ts` needs only the network. It runs a plan through the Alchemy engine with a placeholder token and expects `WorkersBuildsPermissionError`. @@ -312,7 +315,8 @@ Live tests run only with `ALCHEMY_WORKERS_BUILDS_LIVE=1`: repository. It creates a Worker shell named `tmp-alchemy-workers-builds-secret-*`, writes, updates, and deletes a secret on it, and deletes the Worker. -Releases: push a `v*` tag; `.github/workflows/release.yml` publishes with npm trusted publishing. +Releases: change `version` in `package.json` in a pull request. After the merge, +`.github/workflows/release.yml` publishes that version from `main` with npm trusted publishing. ## License diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..59fcc03 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,13 @@ +# Security + +Do not report security vulnerabilities in a public issue. + +Use +[GitHub private vulnerability reporting](../../security/advisories/new) +to report a vulnerability. Include the affected workflow, the expected result, the actual result, +and the minimum steps needed to reproduce it. + +The repository owner must enable private vulnerability reporting before the repository becomes +public. + +Use [GitHub Issues](../../issues) for non-sensitive bugs and support requests. diff --git a/package.json b/package.json index 6f8e184..f9bab87 100644 --- a/package.json +++ b/package.json @@ -40,21 +40,24 @@ "check": "vp fmt --check && vp lint && pnpm run typecheck && vp test --run", "typecheck": "tsc --noEmit", "test": "vp test --run", - "test:live": "ALCHEMY_WORKERS_BUILDS_LIVE=1 vp test --run test/live", + "test:live": "node ./scripts/test-live.ts", "format": "vp fmt", "lint": "vp lint", - "build": "rm -rf lib && tsc -p tsconfig.build.json", - "prepack": "pnpm run build" + "build": "vp pack", + "prepack": "pnpm run build", + "prepare": "vp config --no-agent" }, "dependencies": { "@distilled.cloud/cloudflare": "1.0.0-rc.13" }, "devDependencies": { + "@arethetypeswrong/core": "^0.18.5", "@effect/platform-node": "4.0.0", "@effect/vitest": "4.0.0", "@types/node": "^24.0.0", "alchemy": "2.0.0-beta.80", "effect": "4.0.0", + "publint": "^0.3.25", "typescript": "^5.9.0", "vite-plus": "0.3.0", "vitest": "^4.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2502080..7686dca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,9 @@ importers: specifier: 1.0.0-rc.13 version: 1.0.0-rc.13(effect@4.0.0) devDependencies: + '@arethetypeswrong/core': + specifier: ^0.18.5 + version: 0.18.5 '@effect/platform-node': specifier: 4.0.0 version: 4.0.0(effect@4.0.0)(redis@6.3.0) @@ -27,12 +30,15 @@ importers: effect: specifier: 4.0.0 version: 4.0.0 + publint: + specifier: ^0.3.25 + version: 0.3.25 typescript: specifier: ^5.9.0 version: 5.9.3 vite-plus: specifier: 0.3.0 - version: 0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1) + version: 0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1) vitest: specifier: ^4.0.0 version: 4.1.11(@types/node@24.19.1)(@vitest/browser-preview@4.1.11)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1)) @@ -78,6 +84,13 @@ packages: react-devtools-core: optional: true + '@andrewbranch/untar.js@1.0.4': + resolution: {integrity: sha512-pVXSwPsLuw8IGLo2Di0EaOfsk+ntVvpkk942J/sHYIkwvtKUakEcPh7HBgZ6tuimgzKSEHgCvO4XgQ05DEbwDw==} + + '@arethetypeswrong/core@0.18.5': + resolution: {integrity: sha512-9ytjzGwxjm9Uz7I9avfbt5vlQt6uk9uRRESzJjqrznl6WKvI6dwYTo+vJ3U02Wrq/mR3iql/PzhvHhKdJIAjDQ==} + engines: {node: '>=20'} + '@babel/code-frame@7.29.7': resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} engines: {node: '>=6.9.0'} @@ -93,6 +106,9 @@ packages: '@blazediff/core@1.9.1': resolution: {integrity: sha512-ehg3jIkYKulZh+8om/O25vkvSsXXwC+skXmyA87FFx6A/45eqOkZsBltMw/TVteb0mloiGT8oGRTcjRAz66zaA==} + '@braidai/lang@1.1.2': + resolution: {integrity: sha512-qBcknbBufNHlui137Hft8xauQMTZDKdophmLFv05r2eNmdIv/MlPuP4TdUknHG68UdWLgVZwgxVe735HzJNIwA==} + '@chevrotain/cst-dts-gen@10.5.0': resolution: {integrity: sha512-lhmC/FyqQ2o7pGK4Om+hzuDrm9rhFYIJ/AXoQBeongmn870Xeb0L6oGEiuR8nohFNL5sMaQEJWCxr1oIVIVXrw==} @@ -501,6 +517,9 @@ packages: cpu: [x64] os: [win32] + '@loaderkit/resolve@1.0.6': + resolution: {integrity: sha512-G8FdIoF5CypfwmD9rl8BXod5HDn8JqB0CCNBXDTaRZ+yRYhARrrSToX1zg1zy9jX3zLqigsELwhT4gNtkdQAUg==} + '@mrleebo/prisma-ast@0.13.1': resolution: {integrity: sha512-XyroGQXcHrZdvmrGJvsA9KNeOOgGMg1Vg9OlheUsBOSKznLMDl+YChxbkboRHvtFYJEMRYmlV3uoo/njCw05iw==} engines: {node: '>=16'} @@ -889,6 +908,10 @@ packages: '@prisma/query-plan-executor@7.2.0': resolution: {integrity: sha512-EOZmNzcV8uJ0mae3DhTsiHgoNCuu1J9mULQpGCh62zN3PxPTd+qI9tJvk5jOst8WHKQNwJWR3b39t0XvfBB0WQ==} + '@publint/pack@0.1.7': + resolution: {integrity: sha512-4EDEmvxWtgsCnnVeBvtFIFZtUhPPt1+bA9JrSwU4Sa//6oKtzCSlGGXYJr44OD9aGISymbieJ4mCKHUygUDU+g==} + engines: {node: '>=18'} + '@puppeteer/browsers@3.2.3': resolution: {integrity: sha512-2Bt3m6dDAJqmZehn0wiXSYyQmuhyiHHZ7FjvrVaS1W2RoFGV6eCK71UvKYkNJjkwC1Q9nobjhvTMhLQztFVINA==} engines: {node: '>=22.12.0'} @@ -1573,6 +1596,9 @@ packages: resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} engines: {node: '>= 20.19.0'} + cjs-module-lexer@1.4.3: + resolution: {integrity: sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==} + cliui@9.0.1: resolution: {integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==} engines: {node: '>=20'} @@ -1779,6 +1805,10 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + lru-cache@11.5.3: + resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==} + engines: {node: 20 || >=22} + lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true @@ -1795,6 +1825,10 @@ packages: resolution: {integrity: sha512-snEhs+6G5Tjd4I7tLCDOaoln2RgE0bD19RzEKgvgK2hZ5VKy3MpLhLTZ2fWpXSTg4K2cyPwp+VHATFJhxfnOeA==} engines: {node: '>=18.0.0'} + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + mrmime@2.0.1: resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} engines: {node: '>=10'} @@ -1838,6 +1872,9 @@ packages: vite-plus: optional: true + package-manager-detector@1.8.0: + resolution: {integrity: sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==} + path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -1873,6 +1910,11 @@ packages: proper-lockfile@4.1.2: resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==} + publint@0.3.25: + resolution: {integrity: sha512-WMMbn/d7JqRlfXQL/JUI4n5skC8cJ5WVr8/wT5mmiYWkUdENkZr1I5rgs2+dQPVRgoJd+JRYtB46MTsuDylw9g==} + engines: {node: '>=18'} + hasBin: true + react-is@17.0.2: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} @@ -1904,6 +1946,10 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + sade@1.8.1: + resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} + engines: {node: '>=6'} + semver@7.8.5: resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} engines: {node: '>=10'} @@ -1991,6 +2037,11 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + typescript@5.6.1-rc: + resolution: {integrity: sha512-E3b2+1zEFu84jB0YQi9BORDjz9+jGbwwy1Zi3G0LUNw7a7cePUrHMRNy8aPh53nXpkFGVHSxIZo5vKTfYaFiBQ==} + engines: {node: '>=14.17'} + hasBin: true + typescript@5.9.3: resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} @@ -2017,6 +2068,10 @@ packages: typescript: optional: true + validate-npm-package-name@5.0.1: + resolution: {integrity: sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + vite-plus@0.3.0: resolution: {integrity: sha512-GNWbWuWD37frCSFrz6MLzUo62bTv5IOJozHEgZYOkxsLkuQtTwm4TowzpfoGrSsfwhAAtfPd/sK1Y0+v1SwhZA==} engines: {node: ^20.19.0 || ^22.18.0 || >=24.11.0} @@ -2211,6 +2266,19 @@ snapshots: '@alchemy.run/sigil@0.1.0-alpha.1': {} + '@andrewbranch/untar.js@1.0.4': {} + + '@arethetypeswrong/core@0.18.5': + dependencies: + '@andrewbranch/untar.js': 1.0.4 + '@loaderkit/resolve': 1.0.6 + cjs-module-lexer: 1.4.3 + fflate: 0.8.3 + lru-cache: 11.5.3 + semver: 7.8.5 + typescript: 5.6.1-rc + validate-npm-package-name: 5.0.1 + '@babel/code-frame@7.29.7': dependencies: '@babel/helper-validator-identifier': 7.29.7 @@ -2223,6 +2291,8 @@ snapshots: '@blazediff/core@1.9.1': {} + '@braidai/lang@1.1.2': {} + '@chevrotain/cst-dts-gen@10.5.0': dependencies: '@chevrotain/gast': 10.5.0 @@ -2560,6 +2630,10 @@ snapshots: '@libsql/win32-x64-msvc@0.5.29': optional: true + '@loaderkit/resolve@1.0.6': + dependencies: + '@braidai/lang': 1.1.2 + '@mrleebo/prisma-ast@0.13.1': dependencies: chevrotain: 10.5.0 @@ -2822,6 +2896,10 @@ snapshots: '@prisma/query-plan-executor@7.2.0': {} + '@publint/pack@0.1.7': + dependencies: + tinyexec: 1.3.1 + '@puppeteer/browsers@3.2.3(yauzl@3.4.0)': dependencies: modern-tar: 0.8.5 @@ -3051,7 +3129,7 @@ snapshots: convert-source-map: 2.0.0 tinyrainbow: 3.2.0 - '@voidzero-dev/vite-plus-core@0.3.0(@types/node@24.19.1)(typescript@5.9.3)(yaml@2.9.1)': + '@voidzero-dev/vite-plus-core@0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(yaml@2.9.1)': dependencies: '@oxc-project/runtime': 0.146.0 '@oxc-project/types': 0.146.0 @@ -3060,6 +3138,7 @@ snapshots: yuku-codegen: 0.5.48 yuku-parser: 0.5.48 optionalDependencies: + '@arethetypeswrong/core': 0.18.5 '@types/node': 24.19.1 '@voidzero-dev/vite-plus-darwin-arm64': 0.3.0 '@voidzero-dev/vite-plus-darwin-x64': 0.3.0 @@ -3070,6 +3149,7 @@ snapshots: '@voidzero-dev/vite-plus-win32-arm64-msvc': 0.3.0 '@voidzero-dev/vite-plus-win32-x64-msvc': 0.3.0 fsevents: 2.3.3 + publint: 0.3.25 typescript: 5.9.3 yaml: 2.9.1 @@ -3256,6 +3336,8 @@ snapshots: dependencies: readdirp: 5.1.1 + cjs-module-lexer@1.4.3: {} + cliui@9.0.1: dependencies: string-width: 7.2.0 @@ -3408,6 +3490,8 @@ snapshots: lodash@4.17.21: {} + lru-cache@11.5.3: {} + lz-string@1.5.0: {} magic-string@0.30.21: @@ -3418,13 +3502,15 @@ snapshots: modern-tar@0.8.5: {} + mri@1.2.0: {} + mrmime@2.0.1: {} nanoid@3.3.19: {} obug@2.2.1: {} - oxfmt@0.64.0(vite-plus@0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)): + oxfmt@0.64.0(vite-plus@0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)): dependencies: tinypool: 2.1.0 optionalDependencies: @@ -3447,7 +3533,7 @@ snapshots: '@oxfmt/binding-win32-arm64-msvc': 0.64.0 '@oxfmt/binding-win32-ia32-msvc': 0.64.0 '@oxfmt/binding-win32-x64-msvc': 0.64.0 - vite-plus: 0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1) + vite-plus: 0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1) oxlint-tsgolint@7.0.2001: optionalDependencies: @@ -3458,7 +3544,7 @@ snapshots: '@oxlint-tsgolint/win32-arm64': 7.0.2001 '@oxlint-tsgolint/win32-x64': 7.0.2001 - oxlint@1.79.0(oxlint-tsgolint@7.0.2001)(vite-plus@0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)): + oxlint@1.79.0(oxlint-tsgolint@7.0.2001)(vite-plus@0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)): optionalDependencies: '@oxlint/binding-android-arm-eabi': 1.79.0 '@oxlint/binding-android-arm64': 1.79.0 @@ -3480,7 +3566,9 @@ snapshots: '@oxlint/binding-win32-ia32-msvc': 1.79.0 '@oxlint/binding-win32-x64-msvc': 1.79.0 oxlint-tsgolint: 7.0.2001 - vite-plus: 0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1) + vite-plus: 0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1) + + package-manager-detector@1.8.0: {} path-key@3.1.1: {} @@ -3514,6 +3602,13 @@ snapshots: retry: 0.12.0 signal-exit: 3.0.7 + publint@0.3.25: + dependencies: + '@publint/pack': 0.1.7 + package-manager-detector: 1.8.0 + picocolors: 1.1.1 + sade: 1.8.1 + react-is@17.0.2: {} readdirp@5.1.1: {} @@ -3577,6 +3672,10 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.2.5 '@rolldown/binding-win32-x64-msvc': 1.2.5 + sade@1.8.1: + dependencies: + mri: 1.2.0 + semver@7.8.5: {} sharp@0.35.5(@types/node@24.19.1): @@ -3670,6 +3769,8 @@ snapshots: tslib@2.8.1: {} + typescript@5.6.1-rc: {} + typescript@5.9.3: {} undici-types@7.24.6: {} @@ -3686,7 +3787,9 @@ snapshots: optionalDependencies: typescript: 5.9.3 - vite-plus@0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1): + validate-npm-package-name@5.0.1: {} + + vite-plus@0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1): dependencies: '@oxc-project/types': 0.146.0 '@oxlint/plugins': 1.79.0 @@ -3699,9 +3802,9 @@ snapshots: '@vitest/snapshot': 4.1.11 '@vitest/spy': 4.1.11 '@vitest/utils': 4.1.11 - '@voidzero-dev/vite-plus-core': 0.3.0(@types/node@24.19.1)(typescript@5.9.3)(yaml@2.9.1) - oxfmt: 0.64.0(vite-plus@0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)) - oxlint: 1.79.0(oxlint-tsgolint@7.0.2001)(vite-plus@0.3.0(@types/node@24.19.1)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)) + '@voidzero-dev/vite-plus-core': 0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(yaml@2.9.1) + oxfmt: 0.64.0(vite-plus@0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)) + oxlint: 1.79.0(oxlint-tsgolint@7.0.2001)(vite-plus@0.3.0(@arethetypeswrong/core@0.18.5)(@types/node@24.19.1)(publint@0.3.25)(typescript@5.9.3)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1))(yaml@2.9.1)) oxlint-tsgolint: 7.0.2001 vitest: 4.1.11(@types/node@24.19.1)(@vitest/browser-preview@4.1.11)(vite@8.3.2(@types/node@24.19.1)(yaml@2.9.1)) optionalDependencies: diff --git a/scripts/test-live.ts b/scripts/test-live.ts new file mode 100644 index 0000000..07c4d92 --- /dev/null +++ b/scripts/test-live.ts @@ -0,0 +1,15 @@ +// Runs the live tests with ALCHEMY_WORKERS_BUILDS_LIVE=1 in the child environment +// and forwards the exit code. Node starts the Vite+ entry point directly, so no +// shell is needed on macOS, Linux, or Windows. +import { spawn } from "node:child_process"; +import process from "node:process"; +import { fileURLToPath } from "node:url"; + +const vitePlus = fileURLToPath(import.meta.resolve("vite-plus/bin")); + +spawn(process.execPath, [vitePlus, "test", "--run", "test/live", ...process.argv.slice(2)], { + env: { ...process.env, ALCHEMY_WORKERS_BUILDS_LIVE: "1" }, + stdio: "inherit", +}).on("close", (code) => { + process.exitCode = code ?? 1; +}); diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 423a03c..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": false, - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "outDir": "lib", - "rootDir": "src", - "allowImportingTsExtensions": true, - "rewriteRelativeImportExtensions": true - }, - "include": ["src"] -} diff --git a/tsconfig.json b/tsconfig.json index 81ae816..a0cd1c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,10 +10,9 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "allowImportingTsExtensions": true, - "rewriteRelativeImportExtensions": false, "noEmit": true, "skipLibCheck": true, "isolatedModules": true }, - "include": ["src", "test", "examples", "vite.config.ts"] + "include": ["src", "test", "examples", "scripts", "vite.config.ts"] } diff --git a/vite.config.ts b/vite.config.ts index 4c4ed00..b077a4f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,4 +11,19 @@ export default defineConfig({ test: { include: ["test/**/*.test.ts"], }, + pack: { + outDir: "lib", + // "type": "module" makes the ESM output `index.js`, the file that `exports` names. + fixedExtension: false, + sourcemap: true, + dts: { sourcemap: true }, + publint: true, + // The package is ESM only, so the CommonJS resolution modes do not apply. + attw: { profile: "esm-only" }, + // A publint or attw finding fails the build. + failOnWarn: true, + }, + staged: { + "*": "vp check --fix", + }, });