diff --git a/History.md b/History.md index ca24460..a40aaa0 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,9 @@ +0.9.4 / 2016-03-03 +================== + + * login: extend configuration instead of overwriting it [@rauchg] + 0.9.3 / 2016-03-03 ================== diff --git a/lib/login.js b/lib/login.js index 478e593..9ddd9a0 100644 --- a/lib/login.js +++ b/lib/login.js @@ -1,5 +1,5 @@ import { homedir } from 'os'; -import { join as pathJoin } from 'path'; +import path from 'path'; import fs from 'fs-promise'; import fetch from 'node-fetch'; import { stringify as stringifyQuery } from 'querystring'; @@ -77,12 +77,13 @@ async function register () { } export default async function () { - const path = resolve(os.homedir(), '.now.json'); + const file = path.resolve(homedir(), '.now.json'); const loginData = await register(); let existing = null; try { - existing = await fs.readFile(path, 'utf8'); - } catch(err){} + existing = await fs.readFile(file, 'utf8'); + existing = JSON.parse(existing); + } catch (err) {} const config = Object.extend({}, existing, loginData); - return fs.writeFile(path, JSON.stringify(config)); + return fs.writeFile(file, JSON.stringify(config)); } diff --git a/package.json b/package.json index b0faae1..76be4c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "now", - "version": "0.9.3", + "version": "0.9.4", "description": "Realtime Deployments for Node.JS apps.", "main": "./build/lib/index", "files": [