Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: deprecate const Octokit = require("@octokit/rest") in favor o…
…f `const { Octokit } = require("@octokit/rest")`
  • Loading branch information
gr2m committed Feb 3, 2020
1 parent d1ad161 commit bbc3e48
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion index.js
Expand Up @@ -16,4 +16,17 @@ const CORE_PLUGINS = [
require("octokit-pagination-methods") // deprecated: remove in v17
];

module.exports = Octokit.plugin(CORE_PLUGINS);
const OctokitRest = Octokit.plugin(CORE_PLUGINS);

function DeprecatedOctokit(options) {
const warn =
options.log && options.log.warn ? options.log.warn : console.warn;
warn(
'[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead'
);
return new OctokitRest(options);
}

module.exports = Object.assign(DeprecatedOctokit, {
Octokit: OctokitRest
});

0 comments on commit bbc3e48

Please sign in to comment.