mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 06:04:15 +00:00
Tweak cli config resolution
Summary: @public We need to tweak the resolution algorithm to start looking for the config file at the directory where the node script is running. This is needed to make development easier as internally we'll need 2 config files, one for open source and other one for internal use. This won't affect oss as for they we'll generate this file as part of the `init` command. Reviewed By: @vjeux Differential Revision: D2530161 fb-gh-sync-id: 17c21a56a26a91f2671197e8daa36c19adcea8ee
This commit is contained in:
parent
aacd2d90a4
commit
f39816eb38
3
breaking-changes.txt
Normal file
3
breaking-changes.txt
Normal file
@ -0,0 +1,3 @@
|
||||
0.14:
|
||||
- D2530161: Need to introduce rn-cli.config.js for existing projects
|
||||
|
@ -27,7 +27,7 @@ const hiddenCommands = {
|
||||
* Programmatic entry point for the cli. This function runs the given
|
||||
* command passing it the arguments array.
|
||||
*/
|
||||
function run(command, commandArgs) {
|
||||
function run(pwd, command, commandArgs) {
|
||||
if (!command) {
|
||||
throw new Error(helpMessage());
|
||||
}
|
||||
@ -38,7 +38,7 @@ function run(command, commandArgs) {
|
||||
throw new Error(helpMessage(command));
|
||||
}
|
||||
|
||||
commandToExec(commandArgs, Config.get()).done();
|
||||
commandToExec(commandArgs, Config.get(pwd)).done();
|
||||
}
|
||||
|
||||
function helpMessage(command) {
|
||||
|
@ -20,12 +20,12 @@ let cachedConfig = null;
|
||||
* It has to be on any parent directory of the cli.
|
||||
*/
|
||||
const Config = {
|
||||
get() {
|
||||
get(pwd) {
|
||||
if (cachedConfig) {
|
||||
return cachedConfig;
|
||||
}
|
||||
|
||||
const parentDir = findParentDirectory(__dirname, RN_CLI_CONFIG);
|
||||
const parentDir = findParentDirectory(pwd, RN_CLI_CONFIG);
|
||||
|
||||
if (!parentDir) {
|
||||
throw new Error(
|
||||
|
Loading…
x
Reference in New Issue
Block a user