Skip to content

Commit

Permalink
Add .d.cts files for cjs bundles (#11905)
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas authored Jun 25, 2024
1 parent a07c516 commit 29755da
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-icons-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Add `.d.cts` files for cjs bundles
11 changes: 11 additions & 0 deletions config/prepareDist.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,14 @@ entryPoints.forEach(function buildPackageJson({
) + "\n"
);
});

entryPoints.forEach(function buildCts({
dirs,
bundleName = dirs[dirs.length - 1],
}) {
if (!dirs.length) return;
fs.writeFileSync(
path.join(distRoot, ...dirs, `${bundleName}.d.cts`),
'export * from "./index.d.ts";\n'
);
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"**/*.md",
"**/*.cjs",
"**/*.cjs.map",
"**/*.d.cts",
"**/*.js",
"**/*.js.map",
"**/*.d.ts",
Expand Down

0 comments on commit 29755da

Please sign in to comment.