Skip to content

Commit

Permalink
fix(deps): update github pkg to @octokit/rest pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Howard committed Jun 10, 2018
1 parent b5eb00b commit 36e1b5a
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 26 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"clean": "del './out' './coverage'"
},
"devDependencies": {
"@types/github": "7.1.0",
"@types/istanbul": "^0.4.29",
"@types/mocha": "^5.2.0",
"@types/node": "^10.3.0",
Expand All @@ -116,7 +115,7 @@
"vscode": "^1.1.6"
},
"dependencies": {
"github": "^14.0.0",
"@octokit/rest": "^15.8.1",
"node-git-utils": "^1.4.1",
"open": "^0.0.5",
"request": "^2.87.0",
Expand Down
10 changes: 5 additions & 5 deletions src/controllers/main.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class MainController {
this._showError(error);
}
}

updateStatusBar() {
if (!this._statusBarItem) {
this._statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
Expand Down Expand Up @@ -135,7 +135,7 @@ export class MainController {
private async _openCodeBlockInBrowser() {
try {
const details = this._getCurrentDocument();

const storageBlock = await this._provider.getStorageBlockById(details.storageBlockId);

open(storageBlock.html_url); // launch user's default browser
Expand All @@ -151,7 +151,7 @@ export class MainController {
try {

const details = this._getCurrentDocument();

await this._provider.deleteStorageBlock(details.storageBlockId);

const editors = window.visibleTextEditors;
Expand Down Expand Up @@ -343,15 +343,15 @@ export class MainController {
const directory = tmp.dirSync({ prefix });
return directory.name;
}

private async _openTextDocument(dir, filename, content) {
let file = path.join(dir, filename);
fs.writeFileSync(file, content);
return workspace.openTextDocument(file)
.then((doc: TextDocument) => window.showTextDocument(doc))
.then(() => commands.executeCommand('workbench.action.keepEditor'));
}

private async _loginUser() {
const providerName = this._provider.name;
const username: string = (await window.showInputBox({
Expand Down
2 changes: 1 addition & 1 deletion src/modules/github.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import github = require('github');
import github = require('@octokit/rest');

export default github;
14 changes: 7 additions & 7 deletions src/services/gist.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class GistService implements StorageService {
description = 'gist';

constructor(private _store: Memento, debug = false, private _tokenKey: string = 'gisttoken') {
this.gh = new github({ debug, headers: { 'user-agent': 'VSCode-Gist-Extension' } });
this.gh = new github({ headers: { 'user-agent': 'VSCode-Gist-Extension' } });
this._getToken();
}

Expand Down Expand Up @@ -88,13 +88,13 @@ export class GistService implements StorageService {
}

async getStorageBlockById(id: string) {
const gist = (await this.gh.gists.get({ id })).data;
const gist = (await this.gh.gists.get({ id, 'gist_id': id })).data;
return gist;
}

async deleteStorageBlock(id: string) {
try {
await this.gh.gists.delete({ id });
await this.gh.gists.delete({ id, 'gist_id': id });
} catch (error) {
console.error(error);
throw new Error('Unable to delete');
Expand All @@ -104,7 +104,7 @@ export class GistService implements StorageService {
async removeFileFromStorageBlock(id: string, fileName: string) {
try {
const files = { [fileName]: null };
this.gh.gists.edit({ id, files: JSON.stringify(files) });
this.gh.gists.edit({ id, 'gist_id': id, files: JSON.stringify(files) });
} catch (error) {
console.error(error);
throw new Error('Unable to remove file');
Expand All @@ -123,10 +123,10 @@ export class GistService implements StorageService {

async editFile(gistId: string, fileName: string, text: string): Promise<void> {
const files = { [fileName]: { content: text } };
return await this.gh.gists.edit({ id: gistId, files: JSON.stringify(files) });
return await <any>this.gh.gists.edit({ id: gistId, 'gist_id': gistId, files: JSON.stringify(files) });
}

async changeDescription(gistId: string, description: string) {
return await this.gh.gists.edit({ id: gistId, description, files: JSON.stringify({}) });
async changeDescription(gistId: string, description: string): Promise<void> {
return await <any>this.gh.gists.edit({ id: gistId, 'gist_id': gistId, description, files: JSON.stringify({}) });
}
}
71 changes: 60 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
# yarn lockfile v1


"@octokit/rest@^15.8.1":
version "15.8.1"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.8.1.tgz#8bcdece90026d3af5edd73bd49a8732cb3801d29"
dependencies:
before-after-hook "^1.1.0"
btoa-lite "^1.0.0"
debug "^3.1.0"
http-proxy-agent "^2.1.0"
https-proxy-agent "^2.2.0"
lodash "^4.17.4"
node-fetch "^2.1.1"
url-template "^2.0.8"

"@types/caseless@*":
version "0.12.1"
resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.1.tgz#9794c69c8385d0192acc471a540d1f8e0d16218a"
Expand All @@ -16,12 +29,6 @@
dependencies:
"@types/node" "*"

"@types/github@7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@types/github/-/github-7.1.0.tgz#f2f330173e622e0503c282369683511c41b5ec8d"
dependencies:
github "*"

"@types/glob@*":
version "5.0.35"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.35.tgz#1ae151c802cece940443b5ac246925c85189f32a"
Expand Down Expand Up @@ -93,6 +100,12 @@ add-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"

agent-base@4, agent-base@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.0.tgz#9838b5c3392b962bad031e6a4c5e1024abec45ce"
dependencies:
es6-promisify "^5.0.0"

ajv@^5.1.0:
version "5.5.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965"
Expand Down Expand Up @@ -317,6 +330,10 @@ beeper@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809"

before-after-hook@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.1.0.tgz#83165e15a59460d13702cb8febd6a1807896db5a"

block-stream@*:
version "0.0.9"
resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a"
Expand Down Expand Up @@ -373,6 +390,10 @@ browser-stdout@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f"

btoa-lite@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337"

buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
Expand Down Expand Up @@ -802,7 +823,7 @@ dateformat@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"

debug@3.1.0:
debug@3.1.0, debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
Expand Down Expand Up @@ -1017,6 +1038,16 @@ es6-map@^0.1.5:
es6-symbol "~3.1.1"
event-emitter "~0.3.5"

es6-promise@^4.0.3:
version "4.2.4"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29"

es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
dependencies:
es6-promise "^4.0.3"

es6-set@~0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
Expand Down Expand Up @@ -1396,10 +1427,6 @@ gitconfiglocal@^1.0.0:
dependencies:
ini "^1.3.2"

github@*, github@^14.0.0:
version "14.0.0"
resolved "https://registry.yarnpkg.com/github/-/github-14.0.0.tgz#b707ed88c33cd05e155c785d289aa6229c59a850"

glob-base@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
Expand Down Expand Up @@ -1793,6 +1820,13 @@ hosted-git-info@^2.1.4:
version "2.6.0"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222"

http-proxy-agent@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405"
dependencies:
agent-base "4"
debug "3.1.0"

http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
Expand All @@ -1801,6 +1835,13 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"

https-proxy-agent@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0"
dependencies:
agent-base "^4.1.0"
debug "^3.1.0"

import-lazy@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
Expand Down Expand Up @@ -2663,6 +2704,10 @@ next-tick@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"

node-fetch@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5"

node-git-utils@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/node-git-utils/-/node-git-utils-1.4.1.tgz#627f1fac72a70e1a57f7c53f2e6e87ded07baa5f"
Expand Down Expand Up @@ -3927,6 +3972,10 @@ url-parse@^1.1.9:
querystringify "^2.0.0"
requires-port "^1.0.0"

url-template@^2.0.8:
version "2.0.8"
resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21"

use@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/use/-/use-3.1.0.tgz#14716bf03fdfefd03040aef58d8b4b85f3a7c544"
Expand Down

0 comments on commit 36e1b5a

Please sign in to comment.