CLI: use .hyper.js from repo root dir when running in dev mode (#2792)

This commit is contained in:
Tal Hayut 2018-04-20 18:02:30 +03:00 committed by CHaBou
parent 814ad7ca40
commit f42c2e8471
2 changed files with 16 additions and 1 deletions

9
.vscode/launch.json vendored
View file

@ -8,6 +8,15 @@
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"program": "${workspaceRoot}/app/index.js",
"protocol": "inspector"
},
{
"type": "node",
"request": "launch",
"name": "cli",
"runtimeExecutable": "node",
"program": "${workspaceRoot}/bin/cli.js",
"args": ["--help"],
"protocol": "inspector"
}
]
}

View file

@ -4,8 +4,14 @@ const got = require('got');
const registryUrl = require('registry-url')();
const pify = require('pify');
const recast = require('recast');
const path = require('path');
const fileName = `${os.homedir()}/.hyper.js`;
const devConfigFileName = path.join(__dirname, `../.hyper.js`);
let fileName =
process.env.NODE_ENV !== 'production' && fs.existsSync(devConfigFileName)
? devConfigFileName
: `${os.homedir()}/.hyper.js`;
/**
* We need to make sure the file reading and parsing is lazy so that failure to