Experimental Octokit SDK for exploration only - DO NOT USE 🚫
⚠️
We use this repository to implement new features without the legacy of the current Octokit implementation.
This project is built as a monorepo using npm workspaces and is publishing native ES Modules. To set it up and run the tests Node 18 is required.
Currently working on:
- octokit/octokit.js#2127 - Separate types from code and make types composable/extendable
- octokit/octokit.js#2128 - Transition to native ES Modules + TypeScript declaration files
import { Octokit } from "octokit-next";
const octokit = new Octokit();
const { data } = await octokit.request("GET /repos/{owner}/{repo}", {
owner: "octokit",
repo: "octokit-next.js",
});
console.log(data);A list of breaking changes compared to latest @octokit/* modules
-
Node 16 and other JavaScript runtime environments that lack a global
fetch()method are no longer supported out-of-the-box. Afetchmethod such as provided by thenode-fetchnpm module can be passed to make Octokit work in these environments.For
@octokit-next/coreand other SDKs built upon it you can do thisimport { Octokit } from "octokit-next"; import fetch from "node-fetch"; const octokit = new Octokit({ request: { fetch } });
For the static
@octokit-next/requestmethod you can do thisimport { request } from "@octokit-next/request"; import fetch from "node-fetch"; const result = await request("GET /", { request: { fetch } });
-
Octokit.defaultsis nowOctokit.withDefaults -
Octokit.pluginis nowOctokit.withPlugins. Instead of accepting one argument per plugin, the method now accepts a single array argument with all plugins to be applied. -
@octokit/openapi-typeswill be renamed to@octokit/types-openapito be consistents with the@octokit/types-*prefixed packages that only contain types -
@octokit/auth-token:createTokenAuth()no longer accepts atokenstring argument, but requiresoptions.token. -
plugins now receive all options passed to the
Octokitconstructor as well as its defaults. Previously only the options passed to the constructor were passed
Octokit.DEFAULTSoctokit.options
- replace
request.defaults()andendpoint.defaults()withrequest.withDefaults()andendpoint.withDefaults() - remove
options.previewsfromnew Octokit(options) - Add script to verify that
packages/*folders andrelease.pluginsconfiguration inpackage.jsonare in sync scripts/types-rest-api-diff/update.js- remove all package folders before re-creating, so that obsolete packages get removed