Skip to content

fix(lib/vscode): remove native-keymap and keytar #2961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2021
Merged

Conversation

oxy
Copy link

@oxy oxy commented Mar 24, 2021

native-keymap is only used in the electron process, so we don't need it.
This allows us to drop our libx11 and libxkbfile build dependencies.

@oxy oxy requested a review from a team as a code owner March 24, 2021 21:05
@oxy oxy force-pushed the remove-libx11-dep branch from 048d9ca to 01aa5ad Compare March 24, 2021 21:31
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just confused about the native-keymap declaration file if we're removing the dependency

@jsjoeio jsjoeio added this to the v3.9.2 milestone Mar 24, 2021
@oxy oxy force-pushed the remove-libx11-dep branch from 01aa5ad to cbe931d Compare March 25, 2021 11:18
@oxy oxy changed the title fix(lib/vscode): remove native-keymap fix(lib/vscode): remove native-keymap and keytar Mar 25, 2021
@oxy
Copy link
Author

oxy commented Mar 25, 2021

Update: I spent the day investigating keytar, which initially was a much scarier dep to remove, but also allows us to drop our dependency on libsecret-dev, which means CI no longer needs to pull in any desktop-specific Linux packages! 🎉

I put that change in this PR too, since it felt like the logical thing to do (they touch nearly the same lines in the Dockerfiles, which means that if I made two PRs, one would have to be rebased and have conflicts resolved).

There's some scarier stuff going on with how keytar is used in vscode, but it's not an issue to drop it:

keytar is provided for extensions to be able to use the operating system keyring (when running natively) to store password secrets. To make this work, VSCode actually has a hook on require that replaces require('keytar') in an extension with a RPC-like system that shares the same API, but is proxied elsewhere deep inside.

For the web, VSCode already includes class LocalStorageCredentialsProvider implements ICredentialsProvider which stores them in a JSON in local storage, and provides a keytar-esque API.

I've tested this by writing a custom VSCode extension that uses "keytar" injected by vscode to set credentials, and it successfully stores them in LocalStorage. I also tested against GH Codespaces, which shows the same behavior.

I've also added notes to the lib/vscode/src/typings files to indicate why I pulled them in.

@oxy oxy force-pushed the remove-libx11-dep branch 2 times, most recently from 6f4981b to 76eb78f Compare March 25, 2021 11:50
@@ -106,7 +104,6 @@
"@types/graceful-fs": "4.1.2",
"@types/gulp-postcss": "^8.0.0",
"@types/http-proxy-agent": "^2.0.1",
"@types/keytar": "^4.4.0",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for review: @types/keytar is deprecated since keytar includes types - I removed both and added a typings file.

native-keymap and keytar are only used in the electron process,
so we don't need them. This allows us to drop our dependencies on
libx11-dev, libxkbfile-dev, and libsecret-dev.
@oxy oxy force-pushed the remove-libx11-dep branch from 76eb78f to d44d96a Compare March 25, 2021 13:08
@oxy oxy requested a review from jsjoeio March 25, 2021 15:54
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo! Great work and thanks for adding great comments for future us!

Ship it!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Related to maintenance or clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants