diff --git a/lib/login.js b/lib/login.js index 19fdccc..478e593 100644 --- a/lib/login.js +++ b/lib/login.js @@ -77,6 +77,12 @@ async function register () { } export default async function () { + const path = resolve(os.homedir(), '.now.json'); const loginData = await register(); - return fs.writeFile(pathJoin(homedir(), '.now.json'), JSON.stringify(loginData)); + let existing = null; + try { + existing = await fs.readFile(path, 'utf8'); + } catch(err){} + const config = Object.extend({}, existing, loginData); + return fs.writeFile(path, JSON.stringify(config)); }