github-pages-deploy-action/node_modules/@octokit/rest/index.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-03-02 21:16:42 +08:00
const { requestLog } = require("@octokit/plugin-request-log");
const {
restEndpointMethods
} = require("@octokit/plugin-rest-endpoint-methods");
const Core = require("./lib/core");
2020-01-28 13:07:56 +08:00
const CORE_PLUGINS = [
require("./plugins/authentication"),
2020-03-02 21:16:42 +08:00
require("./plugins/authentication-deprecated"), // deprecated: remove in v17
requestLog,
2020-01-28 13:07:56 +08:00
require("./plugins/pagination"),
2020-03-02 21:16:42 +08:00
restEndpointMethods,
2020-01-28 13:07:56 +08:00
require("./plugins/validate"),
require("octokit-pagination-methods") // deprecated: remove in v17
];
2020-03-02 21:16:42 +08:00
const OctokitRest = Core.plugin(CORE_PLUGINS);
function DeprecatedOctokit(options) {
const warn =
options && 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);
}
const Octokit = Object.assign(DeprecatedOctokit, {
Octokit: OctokitRest
});
Object.keys(OctokitRest).forEach(key => {
/* istanbul ignore else */
if (OctokitRest.hasOwnProperty(key)) {
Octokit[key] = OctokitRest[key];
}
});
module.exports = Octokit;