|
|
@ -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)); |
|
|
|
} |
|
|
|