chore: refactor scripts for octokit update (#16284)

* chore: refactor scripts for octokit

* update release script

* update more octokit scripts

* cleanup

* remove unecessary refactor

* fixup package lock
This commit is contained in:
Shelley Vohr 2019-01-08 12:05:58 -08:00 committed by GitHub
parent 434f1368a0
commit 000be5d1d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 444 additions and 280 deletions

View file

@ -2,23 +2,19 @@ const temp = require('temp')
const fs = require('fs')
const path = require('path')
const childProcess = require('child_process')
const GitHubApi = require('github')
const { getCurrentBranch } = require('./lib/utils.js')
const request = require('request')
const semver = require('semver')
const rootPackageJson = require('../package.json')
const octokit = require('@octokit/rest')({
headers: { 'User-Agent': 'electron-npm-publisher' }
})
if (!process.env.ELECTRON_NPM_OTP) {
console.error('Please set ELECTRON_NPM_OTP')
process.exit(1)
}
const github = new GitHubApi({
// debug: true,
headers: { 'User-Agent': 'electron-npm-publisher' },
followRedirects: false
})
let tempDir
temp.track() // track and cleanup files at exit
@ -72,7 +68,7 @@ new Promise((resolve, reject) => {
JSON.stringify(packageJson, null, 2)
)
return github.repos.getReleases({
return octokit.repos.listReleases({
owner: 'electron',
repo: rootPackageJson.version.indexOf('nightly') > 0 ? 'nightlies' : 'electron'
})