Browse Source

simplify cfg reading / merging

master
Guillermo Rauch 9 years ago
parent
commit
392638ff5a
  1. 15
      lib/login.js

15
lib/login.js

@ -1,9 +1,7 @@
import { homedir } from 'os';
import path from 'path';
import fs from 'fs-promise';
import chalk from 'chalk';
import fetch from 'node-fetch';
import * as cfg from './cfg';
import { stringify as stringifyQuery } from 'querystring';
import chalk from 'chalk';
const URL = 'http://api-registration.now.sh';
@ -77,13 +75,6 @@ async function register () {
}
export default async function () {
const file = path.resolve(homedir(), '.now.json');
const loginData = await register();
let existing = null;
try {
existing = await fs.readFile(file, 'utf8');
existing = JSON.parse(existing);
} catch (err) {}
const config = Object.assign({}, existing, loginData);
return fs.writeFile(file, JSON.stringify(config));
cfg.merge(loginData);
}

Loading…
Cancel
Save