Created
July 5, 2019 20:19
Revisions
-
scottrippey created this gist
Jul 5, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ async function main() { // Do the thing: console.log(` This script copies settings and sign-in creds from prod to dev. It should prompt you for your system creds (twice), to access the prod creds. `); await copyPassword('credentials', 'InVision Studio', 'InVision Studio (Dev)'); await copyAppDataFolder('InVision Studio', 'InVision Studio (Dev)'); console.log('Copied credentials successfully!'); } async function copyAppDataFolder(src, dest) { const electron = require('electron'); const fse = require('fs-extra'); const appData = electron.app.getPath('appData'); console.log(`Copying '${appData}/${src}' to '${dest}'...`); await fse.rmdir(`${appData}/${dest}`).catch(err => null); await fse.copy(`${appData}/${src}`, `${appData}/${dest}`); } async function copyPassword(key, source, dest) { const keytar = require('keytar'); console.log(`Copying '${key}' from '${source}' to '${dest}'...`); const value = await keytar.getPassword(source, key); await keytar.setPassword(dest, key, value); } main().then(() => { process.exit(0); }, (err) => { console.error(err); process.exit(1); }); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ #!/bin/bash npx electron ./test-migration.js