Browse Source
* Automatically migrate the old configuration file * Fixed git.io links * credentials.json => auth.json * Let the user know * Removed trailing dotmaster
Leo Lamprecht
8 years ago
committed by
GitHub
6 changed files with 77 additions and 16 deletions
@ -1,7 +1,28 @@ |
|||
const getDefaultAuthCfg = () => ({ |
|||
_: |
|||
'This is your Now credentials file. DON\'T SHARE! More: https://git.io/v7dds', |
|||
credentials: [] |
|||
}) |
|||
// Native
|
|||
const { join } = require('path') |
|||
const { homedir } = require('os') |
|||
|
|||
module.exports = getDefaultAuthCfg |
|||
// Packages
|
|||
const { readJSON } = require('fs-extra') |
|||
|
|||
module.exports = async () => { |
|||
let migrated = false |
|||
|
|||
const config = { |
|||
_: 'This is your Now credentials file. DON\'T SHARE! More: https://git.io/v5ECz', |
|||
credentials: [] |
|||
} |
|||
|
|||
try { |
|||
const {token} = await readJSON(join(homedir(), '.now.json')) |
|||
|
|||
config.credentials.push({ |
|||
provider: 'sh', |
|||
token |
|||
}) |
|||
|
|||
migrated = true |
|||
} catch (err) {} |
|||
|
|||
return {config, migrated} |
|||
} |
|||
|
@ -1,6 +1,26 @@ |
|||
const getDefaultCfg = () => ({ |
|||
_: |
|||
'This is your Now config file. See `now config help`. More: https://git.io/v7dds' |
|||
}) |
|||
// Native
|
|||
const { join } = require('path') |
|||
const { homedir } = require('os') |
|||
|
|||
module.exports = getDefaultCfg |
|||
// Packages
|
|||
const { readJSON } = require('fs-extra') |
|||
|
|||
module.exports = async () => { |
|||
let migrated = false |
|||
|
|||
const config = { |
|||
_: 'This is your Now config file. See `now config help`. More: https://git.io/v5ECz' |
|||
} |
|||
|
|||
try { |
|||
const sh = await readJSON(join(homedir(), '.now.json')) |
|||
|
|||
delete sh.lastUpdate |
|||
delete sh.token |
|||
|
|||
Object.assign(config, { sh }) |
|||
migrated = true |
|||
} catch (err) {} |
|||
|
|||
return {config, migrated} |
|||
} |
|||
|
Loading…
Reference in new issue