Skip to content

Commit

Permalink
fix(pkg): add default fallback and types export (#612)
Browse files Browse the repository at this point in the history
* 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`
  • Loading branch information
wolfy1339 authored Apr 16, 2024
1 parent f6bae1b commit 069235f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ function myPlugin(octokit, options) {
}
```

> [!IMPORTANT]
> 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).
## `octokit.paginate()`

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()`.
Expand Down
8 changes: 5 additions & 3 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ async function main() {
{
...pkg,
files: ["dist-*/**", "bin/**"],
// Tooling currently are having issues with the "exports" field, ex: TypeScript, eslint
// We add a `main` and `types` field to the package.json for the time being
main: "dist-bundle/index.js",
types: "dist-types/index.d.ts",
exports: {
".": {
types: "./dist-types/index.d.ts",
import: "./dist-bundle/index.js",
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
default: "./dist-bundle/index.js",
},
"./types": {
types: "./dist-types/.d.ts",
},
},
sideEffects: false,
Expand Down

0 comments on commit 069235f

Please sign in to comment.