Browse Source

login: extend configuration instead of overwriting it

master
Guillermo Rauch 9 years ago
parent
commit
cbe6d9a34f
  1. 8
      lib/login.js

8
lib/login.js

@ -77,6 +77,12 @@ async function register () {
} }
export default async function () { export default async function () {
const path = resolve(os.homedir(), '.now.json');
const loginData = await register(); 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));
} }

Loading…
Cancel
Save