-
Notifications
You must be signed in to change notification settings - Fork 40
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
RFC: Move to VSCode Profile Export #7
Comments
import fetch from 'node-fetch' and Add your access token to the request header. |
Recently Next.js showcased the new API Routes format for |
We can also fetch the data inside the component without compromising the personal key, as the requests will always be made on the server. |
Hello there, here is some thoughts on how to implement this feature. After exporting the Profile from VSCode a new Secret Gist will be created on your account by default. To fetch this Gist you need to copy its ID, ex: fetch('https://api.github.com/gists/your-gist-id-123', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.GIST_ACCESS_TOKEN}`
}
}) To generate the token its quite easy just to go Settings > Developer Settings > Personal Access Tokens > New Token (Classic) > Add a name, set an expiration time, and choose Some things that I noticed:
{
["..."]
"content": "{\"name\":\"Mateus\",\"settings\":\"{\\\"settings\\\":\\\"{\\\\r\\\\n \\\\\\\"workbench.startupEditor\\\\\\\": \\\\\\\"none\\\\\\\",\\\\r\\\\n"
["..."]
} Here is some reference docs that I've used:
Please let me know what you think |
@mateusabelli Thanks for that! I'm still trying to find somehow to avoid copying the gist ID manually, but for now I think that's it. |
@diego3g Oh that's nice, I thought about some ideas to avoid having to copy the ID manually. fetch('https://api.github.com/users/YOUR-USERNAME/gists', {
method: 'GET',
// We still need the token for the secret Gists
headers: {
Authorization: `Bearer ${process.env.GIST_ACCESS_TOKEN}`
}
}) Heres and example response from that fetch: [
{
["..."]
"files": {
"TITLE OF YOUR GIST": {
"filename": "TITLE OF YOUR GIST",
"type": "text/plain",
"language": null,
"raw_url": "THE URL OF YOUR RAW GIST",
"size": 88829
}
},
["..."]
},
] Now with that data, we can write code that targets Gists containing a certain title and then access their |
What about instead of copy-pasting the Gist ID on the code, to use the new Vercel Edge Config feature? It lets you change data on the fly and it is good for A/B tests, but it may work for this situation. |
@guilherssousa I think that's a great idea, Edge Config could definitely replace the hard coded id. There is only one thing that I noticed with this approach, since VSCode won't update the previous Gist published, it would be required to manually update the Gist ID there too, it might not be an issue because its super simple to use but just something to consider. Please let me know what you think. |
Today we are using copy/paste Gists to share VSCode settings/extensions but it is a manual task as VSCode Settings Sync does not support Gist anymore.
Yesterday I found out that VSCode has a new Profiles setting where we can switch between a set of preconfigured config/extensions/keybindings.
Also, VSCode supports exporting the profile as a Gist and copying the link to the clipboard.
The only problem here is that the Gist is private so we'll need to add an access token on Next so we can pull data from it.
Example of Gist: https://gist.github.com/diego3g/44fb3d8ef7837854ef69798a121abef3
The text was updated successfully, but these errors were encountered: