Skip to content

Commit

Permalink
CLI: use .hyper.js from repo root dir when running in dev mode (#2792)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tal Hayut authored and chabou committed Dec 15, 2018
1 parent 814ad7c commit f42c2e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
8 changes: 7 additions & 1 deletion cli/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f42c2e8

Please sign in to comment.