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. Afetch
method such as provided by thenode-fetch
npm module can be passed to make Octokit work in these environments.For
@octokit-next/core
and 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/request
method you can do thisimport { request } from "@octokit-next/request"; import fetch from "node-fetch"; const result = await request("GET /", { request: { fetch } });
-
Octokit.defaults
is nowOctokit.withDefaults
-
Octokit.plugin
is 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-types
will be renamed to@octokit/types-openapi
to be consistents with the@octokit/types-*
prefixed packages that only contain types -
@octokit/auth-token
:createTokenAuth()
no longer accepts atoken
string argument, but requiresoptions.token
. -
plugins now receive all options passed to the
Octokit
constructor as well as its defaults. Previously only the options passed to the constructor were passed
Octokit.DEFAULTS
octokit.options
- replace
request.defaults()
andendpoint.defaults()
withrequest.withDefaults()
andendpoint.withDefaults()
- remove
options.previews
fromnew Octokit(options)
- Add script to verify that
packages/*
folders andrelease.plugins
configuration inpackage.json
are in sync scripts/types-rest-api-diff/update.js
- remove all package folders before re-creating, so that obsolete packages get removed