Skip to content

Commit bc1b53e

Browse files
committed
fix: move Gemfile to the root
1 parent 1706d80 commit bc1b53e

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

packages/create-react-native-library/src/exampleApp/generateExampleApp.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const FILES_TO_DELETE = [
1919
'tsconfig.json',
2020
];
2121

22+
const FILES_TO_MOVE = ['.bundle', 'Gemfile'];
23+
2224
const PACKAGES_TO_REMOVE = [
2325
'@react-native/eslint-config',
2426
'@tsconfig/react-native',
@@ -42,14 +44,14 @@ const PACKAGES_TO_ADD_WEB = {
4244

4345
export default async function generateExampleApp({
4446
config,
45-
destination,
47+
root,
4648
reactNativeVersion = 'latest',
4749
}: {
4850
config: TemplateConfiguration;
49-
destination: string;
51+
root: string;
5052
reactNativeVersion?: string;
5153
}) {
52-
const directory = path.join(destination, 'example');
54+
const directory = path.join(root, 'example');
5355

5456
// `npx --package react-native-test-app@latest init --name ${projectName}Example --destination example --version ${reactNativeVersion}`
5557
const testAppArgs = [
@@ -117,6 +119,13 @@ export default async function generateExampleApp({
117119
await fs.remove(path.join(directory, file));
118120
}
119121

122+
// Move files to the root
123+
for (const file of FILES_TO_MOVE) {
124+
if (await fs.pathExists(path.join(directory, file))) {
125+
await fs.move(path.join(directory, file), path.join(root, file));
126+
}
127+
}
128+
120129
// Patch the example app's package.json
121130
const pkg = await fs.readJSON(path.join(directory, 'package.json'));
122131

packages/create-react-native-library/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ async function create(_argv: yargs.Arguments<Args>) {
107107
spinner.text = 'Generating example app';
108108

109109
await generateExampleApp({
110-
destination: folder,
110+
root: folder,
111111
reactNativeVersion: answers.reactNativeVersion,
112112
config,
113113
});

packages/create-react-native-library/templates/common/$.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ android.iml
4646
example/ios/Pods
4747

4848
# Ruby
49-
example/vendor/
49+
/vendor/
5050

5151
# node.js
5252
#

packages/create-react-native-library/templates/common/CONTRIBUTING.md

+14
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ To invoke **Nitrogen**, use the following command:
3535
yarn nitrogen
3636
```
3737

38+
<% } -%>
39+
<% if (project.native) { -%>
40+
You also need to install the required ruby gems for the iOS project with [bundler](https://bundler.io/). To install the gems, run the following command in the root directory:
41+
42+
```sh
43+
bundle install
44+
```
45+
46+
Now, you can install [CocoaPods](https://cocoapods.org/) for the iOS project. To do this, run the following command in the `example/ios` directory:
47+
48+
```sh
49+
bundle exec pod install
50+
```
51+
3852
<% } -%>
3953
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
4054

0 commit comments

Comments
 (0)