Skip to content

Commit

Permalink
refactor: check if example has react & react-native deps
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Jul 4, 2024
1 parent 847151c commit 0bf4c83
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/create-react-native-library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,14 +801,16 @@ async function create(_argv: yargs.Arguments<any>) {
path.join(folder, 'example', 'package.json')
);

if (!rootPackageJson.devDependencies) {
rootPackageJson.devDependencies = {};
if (
examplePackageJson.dependencies.react &&
examplePackageJson.dependencies['react-native']
) {
rootPackageJson.devDependencies = rootPackageJson.devDependencies || {};
rootPackageJson.devDependencies.react =
examplePackageJson.dependencies.react;
rootPackageJson.devDependencies['react-native'] =
examplePackageJson.dependencies['react-native'];
}

rootPackageJson.devDependencies.react =
examplePackageJson.dependencies.react;
rootPackageJson.devDependencies['react-native'] =
examplePackageJson.dependencies['react-native'];
}

// Some of the passed args can already be derived from the generated package.json file.
Expand Down

0 comments on commit 0bf4c83

Please sign in to comment.