mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
fix(cli): fix config path (#3636)
This commit is contained in:
parent
1c87f255b3
commit
b16de26cf9
1 changed files with 8 additions and 2 deletions
10
cli/api.js
10
cli/api.js
|
|
@ -6,13 +6,19 @@ const pify = require('pify');
|
|||
const recast = require('recast');
|
||||
const path = require('path');
|
||||
|
||||
// If the user defines XDG_CONFIG_HOME they definitely want their config there,
|
||||
// otherwise use the home directory in linux/mac and userdata in windows
|
||||
const applicationDirectory =
|
||||
process.env.XDG_CONFIG_HOME !== undefined
|
||||
? path.join(process.env.XDG_CONFIG_HOME, 'hyper')
|
||||
: process.platform == 'win32' ? path.join(process.env.APPDATA, 'Hyper') : os.homedir();
|
||||
|
||||
const devConfigFileName = path.join(__dirname, `../.hyper.js`);
|
||||
|
||||
let fileName =
|
||||
process.env.NODE_ENV !== 'production' && fs.existsSync(devConfigFileName)
|
||||
? devConfigFileName
|
||||
: `${os.homedir()}/.hyper.js`;
|
||||
|
||||
: path.join(applicationDirectory, '.hyper.js');
|
||||
/**
|
||||
* We need to make sure the file reading and parsing is lazy so that failure to
|
||||
* statically analyze the hyper configuration isn't fatal for all kinds of
|
||||
|
|
|
|||
Loading…
Reference in a new issue