Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set project directory to install packages in init command (#262)
Fixes #260 and facebook/react-native#24103 by setting project directory on PackageManager which is needed to check for yarn.lock file. Summary: --------- I'm not sure how to test this but creating new projects fail with the exception ``` info Adding required dependencies internal/validators.js:125 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Object.join (path.js:1147:7) at isProjectUsingYarn (/path/to/app/node_modules/@react-native-community/cli/build/tools/yarn.js:101:51) at shouldUseYarn (/path/to/app/node_modules/@react-native-community/cli/build/tools/PackageManager.js:36:39) at Object.install (/path/to/app/node_modules/@react-native-community/cli/build/tools/PackageManager.js:44:10) at generateProject (/path/to/app/node_modules/@react-native-community/cli/build/commands/init/init.js:111:18) at Object.init (/path/to/app/node_modules/@react-native-community/cli/build/commands/init/init.js:94:3) at run (/Users/xxx/.config/yarn/global/node_modules/react-native-cli/index.js:302:7) at createProject (/Users/xxx/.config/yarn/global/node_modules/react-native-cli/index.js:249:3) at init (/Users/xxx/.config/yarn/global/node_modules/react-native-cli/index.js:200:5) ``` The error seems to be stemming from passing `undefined` for `projectDir` to `path.join`. Added a line to fix this. Test Plan: ---------- `react-native init TestProject` should not fail.
- Loading branch information