Last active
October 4, 2023 04:41
-
-
Save daltonmenezes/d67f587fb893a36a1a6b1f1b43cb1ae4 to your computer and use it in GitHub Desktop.
Get/Export Vercel envs script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(async () => { | |
const TIMEOUT_MS = 700 | |
const delay = () => new Promise((resolve) => setTimeout(resolve, TIMEOUT_MS)) | |
const revealButtons = document.querySelectorAll('button[aria-label="Click to reveal"]') | |
for (revealButton of revealButtons) { | |
revealButton.click() | |
await delay() | |
} | |
await delay() | |
const envKeys = [...document.querySelectorAll('span > span[class*="env-variables-"]')].map((key) => key.textContent) | |
const enValues = [...document.querySelectorAll('button > code[class*="env-var-value"]')].map((key) => key.textContent) | |
const envs = envKeys.reduce((acc, key, index) => { | |
envKeys[index] = enValues[index] | |
acc += `${key}="${enValues[index]}"\n` | |
return acc | |
}, '') | |
console.log(envs) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment