You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(playbook): map exports via '.' and add tsconfig symlink step
- Use explicit . export with types/import (+default) for compatibility
- Replace tsconfig JSON example with symlink to .config/tsconfig.plugin.json
- Update verify jq path and add symlink check
- Clarify package.json files note and prefer .npmignore for maps
Note: `package.json` `files` does not support negation patterns. To exclude maps from the published package, add an `.npmignore` entry:
42
+
43
+
```
44
+
dist/**/*.map
45
+
```
46
+
47
+
If you must disable map emission, either update the shared `.config/tsconfig.plugin.json` (affects all packages) or create a package-local `tsconfig.build.json` that extends it with `"sourceMap": false` and `"declarationMap": false`, then change the build script to `tsc --project tsconfig.build.json`.
30
48
31
49
3. Build scripts: TypeScript emit to dist
50
+
32
51
- Prefer a tsc-only build for packages that do not need bundling:
33
52
- In `$PKG/package.json`, set scripts:
34
53
```json
@@ -40,30 +59,33 @@ Upgrade a single plugin under `packages/<name>` to publish ESM-only output with
40
59
```
41
60
- If this package still needs bundling for tests/examples, keep its Rollup config but point inputs at the TypeScript output in `dist/` instead of sources.
42
61
43
-
4. TypeScript config: emit ESM to `dist/`
44
-
- Create or update `$PKG/tsconfig.json` to extend the shared plugin config and emit declarations:
45
-
```json
46
-
{
47
-
"extends": "../../.config/tsconfig.base.json",
48
-
"compilerOptions": {
49
-
"noEmit": false,
50
-
"outDir": "dist",
51
-
"rootDir": "src",
52
-
"declaration": true,
53
-
"declarationMap": true
54
-
},
55
-
"include": ["src/**/*"]
56
-
}
62
+
4. TypeScript config: use the shared plugin config (symlink)
63
+
64
+
- Replace any existing `$PKG/tsconfig.json` with a symlink to the shared plugin config (`.config/tsconfig.plugin.json`), which already enables emit to `dist/` and declaration maps:
The shared config content lives at `.config/tsconfig.plugin.json`.
58
78
- Delete any package-local `rollup` build scripts that produced CJS, and remove any `types/` folder if declarations were hand-authored (they will now be generated).
59
79
60
80
5. Source: convert to pure ESM and modern Node APIs
81
+
61
82
- Replace `require`, `module.exports`, and `__dirname` patterns with ESM equivalents.
62
83
- Use `node:` specifiers for built-ins (e.g., `import path from 'node:path'`).
63
84
- Prefer URL utilities where needed (`fileURLToPath(new URL('.', import.meta.url))`).
64
85
- Inline and export public types from `src/index.ts`; avoid separate `types/` unless unavoidable.
65
86
66
87
6. Tests: drop CJS branches; ESM everywhere
88
+
67
89
- Remove CJS-specific branches/assertions from tests.
68
90
- 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.
69
91
- Ensure Rollup bundles created in tests are `await bundle.close()`-d to avoid leaks.
@@ -80,9 +102,13 @@ Upgrade a single plugin under `packages/<name>` to publish ESM-only output with
80
102
pnpm -C $PKG build
81
103
tree $PKG/dist | sed -n '1,80p'
82
104
```
105
+
- Symlink exists and points at the shared config:
106
+
```bash
107
+
test -L "$PKG/tsconfig.json"&& ls -l "$PKG/tsconfig.json"|| (echo "tsconfig.json symlink missing"&&exit 1)
0 commit comments