Skip to content

Commit 069235f

Browse files
authored
fix(pkg): add default fallback and types export (#612)
* fix(pkg): add a default fallback See ocotkit/core.js#665 octokit/core.js#667 * docs: add note on needed config changes for TypeScript * fix(pkg): add an export for `dist-types/types.d.ts`
1 parent f6bae1b commit 069235f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ function myPlugin(octokit, options) {
7373
}
7474
```
7575

76+
> [!IMPORTANT]
77+
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json`. See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).
78+
7679
## `octokit.paginate()`
7780

7881
The `paginateRest` plugin adds a new `octokit.paginate()` method which accepts the same parameters as [`octokit.request`](https://github.com/octokit/request.js#request). Only "List ..." endpoints such as [List issues for a repository](https://developer.github.com/v3/issues/#list-issues-for-a-repository) are supporting pagination. Their [response includes a Link header](https://developer.github.com/v3/issues/#response-1). For other endpoints, `octokit.paginate()` behaves the same as `octokit.request()`.

scripts/build.mjs

+5-3
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,16 @@ async function main() {
6262
{
6363
...pkg,
6464
files: ["dist-*/**", "bin/**"],
65-
// Tooling currently are having issues with the "exports" field, ex: TypeScript, eslint
66-
// We add a `main` and `types` field to the package.json for the time being
67-
main: "dist-bundle/index.js",
6865
types: "dist-types/index.d.ts",
6966
exports: {
7067
".": {
7168
types: "./dist-types/index.d.ts",
7269
import: "./dist-bundle/index.js",
70+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
71+
default: "./dist-bundle/index.js",
72+
},
73+
"./types": {
74+
types: "./dist-types/.d.ts",
7375
},
7476
},
7577
sideEffects: false,

0 commit comments

Comments
 (0)