refactor: remove clipboardy dep

This commit is contained in:
iCrawl 2019-11-08 00:04:08 +01:00
parent 27705893af
commit c264b0adb4
No known key found for this signature in database
GPG key ID: E41A6DB922EC2CFE
3 changed files with 10 additions and 24 deletions

View file

@ -183,7 +183,6 @@
}, },
"dependencies": { "dependencies": {
"bufferutil": "^4.0.1", "bufferutil": "^4.0.1",
"clipboardy": "^2.1.0",
"discord-rpc": "discordjs/RPC", "discord-rpc": "discordjs/RPC",
"register-scheme": "devsnek/node-register-scheme", "register-scheme": "devsnek/node-register-scheme",
"utf-8-validate": "^5.0.2", "utf-8-validate": "^5.0.2",

View file

@ -1,10 +1,9 @@
const { Client } = require('discord-rpc'); // eslint-disable-line const { Client } = require('discord-rpc'); // eslint-disable-line
import { Disposable, StatusBarItem, Uri, window, workspace } from 'vscode'; import { Disposable, StatusBarItem, Uri, window, workspace, env } from 'vscode';
import * as vsls from 'vsls'; import * as vsls from 'vsls';
import Activity from '../structures/Activity'; import Activity from '../structures/Activity';
import Logger from '../structures/Logger'; import Logger from '../structures/Logger';
import { API } from '../git'; import { API } from '../git';
import * as clipboardy from 'clipboardy';
let activityTimer: NodeJS.Timer; let activityTimer: NodeJS.Timer;
@ -92,9 +91,10 @@ export default class RPCClient implements Disposable {
// VS Liveshare has this annoying bug where you convert a URL string to a URI object to autofill // VS Liveshare has this annoying bug where you convert a URL string to a URI object to autofill
// But the autofill will be empty, so to circumvent this I need to add copying the link to the clipboard // But the autofill will be empty, so to circumvent this I need to add copying the link to the clipboard
// And immediately pasting it after the window pops up empty // And immediately pasting it after the window pops up empty
await clipboardy.write(s); await env.clipboard.writeText(s);
await liveshare.join(Uri.parse(s)); const uriString = await env.clipboard.readText();
await clipboardy.read(); const uri = Uri.parse(uriString);
await liveshare.join(uri);
} catch (error) { } catch (error) {
Logger.log(error); Logger.log(error);
} }
@ -124,10 +124,11 @@ export default class RPCClient implements Disposable {
try { try {
const s = Buffer.from(secret, 'base64').toString(); const s = Buffer.from(secret, 'base64').toString();
// You might be asking yourself again again: "but why?" // You might be asking yourself again again: "but why?"
// See first comment on clipboardy above // See first comment above
await clipboardy.write(s); await env.clipboard.writeText(s);
await liveshare.join(Uri.parse(s)); const uriString = await env.clipboard.readText();
await clipboardy.read(); const uri = Uri.parse(uriString);
await liveshare.join(uri);
} catch (error) { } catch (error) {
Logger.log(error); Logger.log(error);
} }

View file

@ -457,11 +457,6 @@ aproba@^1.0.3, aproba@^1.1.1:
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==
arch@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/arch/-/arch-2.1.1.tgz#8f5c2731aa35a30929221bb0640eed65175ec84e"
integrity sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg==
are-we-there-yet@~1.1.2: are-we-there-yet@~1.1.2:
version "1.1.5" version "1.1.5"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21"
@ -948,14 +943,6 @@ cli-width@^2.0.0:
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=
clipboardy@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-2.1.0.tgz#0123a0c8fac92f256dc56335e0bb8be97a4909a5"
integrity sha512-2pzOUxWcLlXWtn+Jd6js3o12TysNOOVes/aQfg+MT/35vrxWzedHlLwyoJpXjsFKWm95BTNEcMGD9+a7mKzZkQ==
dependencies:
arch "^2.1.1"
execa "^1.0.0"
cliui@^5.0.0: cliui@^5.0.0:
version "5.0.0" version "5.0.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"
@ -3446,7 +3433,6 @@ prettier-linter-helpers@^1.0.0:
prettier@prettier/prettier: prettier@prettier/prettier:
version "1.18.2" version "1.18.2"
uid d4a7a47b048b8ced046e71d44dfc5de417b89221
resolved "https://codeload.github.com/prettier/prettier/tar.gz/d4a7a47b048b8ced046e71d44dfc5de417b89221" resolved "https://codeload.github.com/prettier/prettier/tar.gz/d4a7a47b048b8ced046e71d44dfc5de417b89221"
dependencies: dependencies:
"@angular/compiler" "8.2.13" "@angular/compiler" "8.2.13"