Skip to content

Commit 63e1859

Browse files
committed
docs(playbook): add JS→TS and AVA→Vitest conversion order\n\n- Always convert JS in src to TS\n- Never convert fixtures to TS\n- Always convert JS in test to TS\n- Run AVA after JS→TS + package.json changes; then convert to Vitest and run Vitest thereafter\n\nRefs #1933
1 parent 7038aeb commit 63e1859

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.charlie/playbooks/upgrade-plugin-to-esm-only.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,19 @@ Upgrade a single plugin under `packages/<name>` to publish ESM-only output with
8585
- Use `node:` specifiers for built-ins (e.g., `import path from 'node:path'`).
8686
- Prefer URL utilities where needed (`fileURLToPath(new URL('.', import.meta.url))`).
8787
- Inline and export public types from `src/index.ts`; avoid separate `types/` unless unavoidable.
88+
- Conversion rules for file types:
89+
- Always convert any `.js` in `src/` to `.ts`.
90+
- Never convert files in test `fixtures/` to TypeScript—keep fixtures exactly as authored.
91+
- Always convert any `.js` in `test/` to `.ts` (test sources only; exclude `test/**/fixtures/**`).
8892

89-
6. Tests: drop CJS branches; ESM everywhere
93+
6. Tests: order of operations (AVA → Vitest) and ESM
9094

9195
- Remove CJS-specific branches/assertions from tests.
92-
- Keep the existing runner (AVA) if it already handles ESM in Node 20. If the package already uses Vitest in this repo, keep that pattern.
96+
- Follow this sequence for reliability:
97+
1. After JS→TS conversion in `src/` and `test/` and after any `package.json` changes, always run the AVA test suite.
98+
2. Only after verifying AVA tests run without modifications, convert the AVA tests to Vitest.
99+
3. After converting tests to Vitest, always run the Vitest suite after any subsequent `src/` change.
100+
- Note: If a package already uses Vitest, start at step 3 and skip AVA‑specific steps.
93101
- Ensure Rollup bundles created in tests are `await bundle.close()`-d to avoid leaks.
94102

95103
7. Clean up package artifacts

0 commit comments

Comments
 (0)