Skip to content

Commit f738ef5

Browse files
committed
Update octokit version
1 parent adbfe47 commit f738ef5

File tree

12 files changed

+4467
-2552
lines changed

12 files changed

+4467
-2552
lines changed

.babelrc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2+
"presets": ["@babel/preset-env"],
23
"plugins": [
34
["module-resolver", {
45
"alias": {
56
"test": "./test"
67
},
78
"root": ["./src"]
8-
}]
9-
],
10-
"presets": ["es2015-node", "stage-1"]
9+
}],
10+
["lodash"]
11+
12+
]
1113
}

dist/bin/labels.js

100644100755
Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
#! /usr/bin/env node
2-
'use strict';
3-
4-
var _copyFromRepoCommand = require('../commands/copy-from-repo-command');
5-
6-
var _listCommand = require('../commands/list-command');
7-
8-
var _updateCommand = require('../commands/update-command');
9-
10-
var _package = require('../../package.json');
11-
12-
var _yargs = require('yargs');
13-
14-
var _yargs2 = _interopRequireDefault(_yargs);
15-
16-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
172

183
/**
19-
* Program options.
4+
* Module dependencies.
205
*/
21-
22-
_yargs2.default // eslint-disable-line no-unused-expressions
23-
.usage('Usage: $0 [options]').env('GITHUB_LABELS').command(['*', 'update'], 'Update repository labels', _updateCommand.updateConfig, _updateCommand.update).command('copy', 'Copy labels from repository', _copyFromRepoCommand.copyFromRepoConfig, _copyFromRepoCommand.copyFromRepo).command('list', 'List labels from repository', _listCommand.listConfig, _listCommand.list).help('h').alias('h', 'help').version('version', 'Version', _package.version).alias('V', 'version').wrap(null).argv;
24-
6+
"use strict";
7+
8+
var _copyFromRepoCommand = require("../commands/copy-from-repo-command");
9+
var _listCommand = require("../commands/list-command");
10+
var _updateCommand = require("../commands/update-command");
11+
var _package = require("../../package.json");
12+
var _yargs = _interopRequireDefault(require("yargs"));
13+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
2514
/**
26-
* Module dependencies.
27-
*/
15+
* Program options.
16+
*/
17+
_yargs["default"] // eslint-disable-line no-unused-expressions
18+
.usage('Usage: $0 [options]').env('GITHUB_LABELS').command(['*', 'update'], 'Update repository labels', _updateCommand.updateConfig, _updateCommand.update).command('copy', 'Copy labels from repository', _copyFromRepoCommand.copyFromRepoConfig, _copyFromRepoCommand.copyFromRepo).command('list', 'List labels from repository', _listCommand.listConfig, _listCommand.list).help('h').alias('h', 'help').version('version', 'Version', _package.version).alias('V', 'version').wrap(null).argv;

dist/client.js

Lines changed: 332 additions & 180 deletions
Large diffs are not rendered by default.

dist/commands/copy-from-repo-command.js

Lines changed: 95 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/commands/list-command.js

Lines changed: 88 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/commands/update-command.js

Lines changed: 106 additions & 87 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 102 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"lint-staged"
4646
],
4747
"dependencies": {
48-
"@octokit/rest": "^15.9.2",
48+
"@octokit/rest": "^19.0.5",
4949
"bluebird": "^3.3.1",
5050
"fs": "^0.0.2",
5151
"inquirer": "^6.0.0",
@@ -54,20 +54,20 @@
5454
"yargs": "^11.0.0"
5555
},
5656
"devDependencies": {
57-
"babel-cli": "^6.4.0",
58-
"babel-jest": "^23.2.0",
59-
"babel-plugin-module-resolver": "^3.1.1",
60-
"babel-preset-es2015-node": "^6.1.1",
61-
"babel-preset-stage-1": "^6.24.1",
57+
"@babel/cli": "^7.20.7",
58+
"@babel/core": "^7.20.12",
59+
"@babel/node": "^7.20.7",
60+
"@babel/preset-env": "^7.20.2",
61+
"babel-plugin-lodash": "^3.3.4",
62+
"babel-plugin-module-resolver": "^4.1.0",
6263
"coveralls": "^3.0.1",
6364
"eslint": "5.0.1",
6465
"eslint-config-seegno": "10.0.0",
6566
"faker": "^4.1.0",
66-
"jest": "^23.2.0",
67+
"jest": "^27.0.6",
6768
"lint-staged": "7.2.0",
68-
"pre-commit": "^1.2.2",
69-
"standard-http-error": "^2.0.0"
70-
},
69+
"pre-commit": "^1.2.2"
70+
},
7171
"engines": {
7272
"node": "^6.14.0 || ^8.10.0 || >=9.10.0"
7373
},

src/bin/labels.js

100644100755
File mode changed.

src/client.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
* Module dependencies.
44
*/
55

6+
import { Octokit } from '@octokit/rest';
67
import { differenceBy, get, has } from 'lodash';
7-
import Github from '@octokit/rest';
88

99
/**
10-
* GitHub configuration.
10+
* GitHub timeout default value.
1111
*/
1212

13-
const config = {
14-
debug: false,
15-
timeout: 5000,
16-
version: '3.0.0'
17-
};
13+
const defaultTimeout = 5000;
1814

1915
/**
2016
* Get repository owner and name and include a validation.
@@ -41,9 +37,11 @@ export default class Client {
4137
*/
4238

4339
constructor({ token, ...options }) {
44-
this.github = new Github({ ...config, ...options });
45-
46-
this.github.authenticate({ token, type: 'oauth' });
40+
this.github = new Octokit({
41+
auth: token,
42+
request: { timeout: defaultTimeout },
43+
...options
44+
});
4745
}
4846

4947
/**
@@ -71,7 +69,7 @@ export default class Client {
7169
try {
7270
label = await this.getLabel(repository, name);
7371
} catch (err) {
74-
if (!has(err, 'code') || get(err, 'code') !== 404) {
72+
if (!has(err, 'status') || get(err, 'status') !== 404) {
7573
throw err;
7674
}
7775
}
@@ -104,7 +102,7 @@ export default class Client {
104102
async getLabels(repository) {
105103
const { owner, repo } = getRepositoryOptions(repository);
106104

107-
const result = await this.github.issues.getLabels({
105+
const result = await this.github.issues.listLabelsForRepo({
108106
owner,
109107
repo
110108
});

0 commit comments

Comments
 (0)