Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pkg): add default fallback and types export #612

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function myPlugin(octokit, options) {
}
```

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