From 286f44eb302138003aaadb2daf609397aa66cdda Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 15 Apr 2024 19:26:22 -0400 Subject: [PATCH 1/5] fix(pkg): add a default fallback See ocotkit/core.js#665 octokit/core.js#667 --- scripts/build.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index d4be5308..66b022a4 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -62,14 +62,13 @@ 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" }, }, sideEffects: false, From 3f7b160769583551db6e83faae2dbbf169bd71ad Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 15 Apr 2024 19:28:08 -0400 Subject: [PATCH 2/5] docs: add note on needed config changes for TypeScript --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9ebf695f..6c14a075 100644 --- a/README.md +++ b/README.md @@ -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()`. From 8d8829596341aeac7bd944e2277990c56bc835f2 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 15 Apr 2024 19:28:20 -0400 Subject: [PATCH 3/5] fix(pkg): add an export for `dist-types/types.d.ts` --- scripts/build.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/build.mjs b/scripts/build.mjs index 66b022a4..975dd6fd 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -70,6 +70,9 @@ async function main() { // 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, }, From 462cbc99dec0c33012c12b390835074e09c708df Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 15 Apr 2024 19:34:20 -0400 Subject: [PATCH 4/5] style: prettier --- scripts/build.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index 975dd6fd..98e7d3d0 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -68,11 +68,11 @@ async function main() { 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" + default: "./dist-bundle/index.js", }, "./types": { types: "./dist-types/.d.ts", - } + }, }, sideEffects: false, }, From 80ec079ed0951394bf18c97723787d72a921edaf Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 15 Apr 2024 20:03:31 -0400 Subject: [PATCH 5/5] docs: use callout --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c14a075..3ac766a3 100644 --- a/README.md +++ b/README.md @@ -73,7 +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). +> [!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()`