chore: update octokit/rest

pull/2049/head
tangjinzhou 2020-04-09 23:11:01 +08:00
parent dd5df852ef
commit 503d358188
2 changed files with 7 additions and 11 deletions

View File

@ -11,7 +11,7 @@ const transformLess = require('./transformLess');
const webpack = require('webpack'); const webpack = require('webpack');
const babel = require('gulp-babel'); const babel = require('gulp-babel');
const argv = require('minimist')(process.argv.slice(2)); const argv = require('minimist')(process.argv.slice(2));
const GitHub = require('@octokit/rest'); const { Octokit } = require('@octokit/rest');
const packageJson = require(`${process.cwd()}/package.json`); const packageJson = require(`${process.cwd()}/package.json`);
// const getNpm = require('./getNpm') // const getNpm = require('./getNpm')
@ -168,10 +168,8 @@ function githubRelease(done) {
console.log('no changelog found, skip'); console.log('no changelog found, skip');
return; return;
} }
const github = new GitHub(); const github = new Octokit({
github.authenticate({ auth: process.env.GITHUB_TOKEN,
type: 'oauth',
token: process.env.GITHUB_TOKEN,
}); });
const date = new Date(); const date = new Date();
const { version } = packageJson; const { version } = packageJson;
@ -311,10 +309,8 @@ gulp.task(
if (!process.env.NPM_TOKEN) { if (!process.env.NPM_TOKEN) {
console.log('no NPM token found, skip'); console.log('no NPM token found, skip');
} else { } else {
const github = new GitHub(); const github = new Octokit({
github.authenticate({ auth: process.env.GITHUB_TOKEN,
type: 'oauth',
token: process.env.GITHUB_TOKEN,
}); });
const [_, owner, repo] = execSync('git remote get-url origin') // eslint-disable-line const [_, owner, repo] = execSync('git remote get-url origin') // eslint-disable-line
.toString() .toString()

View File

@ -1,4 +1,4 @@
const GitHub = require('@octokit/rest'); const { Octokit } = require('@octokit/rest');
const Base64 = require('js-base64').Base64; const Base64 = require('js-base64').Base64;
const fs = require('fs'); const fs = require('fs');
const fse = require('fs-extra'); const fse = require('fs-extra');
@ -10,7 +10,7 @@ const tag = '3.26.13';
const clientId = '5f6ccfdc4cdc69f8ba12'; const clientId = '5f6ccfdc4cdc69f8ba12';
const clientSecret = process.env.CLIENT_SECRET; const clientSecret = process.env.CLIENT_SECRET;
const github = new GitHub(); const github = new Octokit();
async function syncFiles(data = []) { async function syncFiles(data = []) {
for (const item of data) { for (const item of data) {