Skip to content

Commit c61bb71

Browse files
committed
feat!: use react-native-test-app in default example/ app
1 parent 71f3874 commit c61bb71

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,22 @@ export default async function generateExampleApp({
6565
const directory = path.join(dest, 'example');
6666
const args =
6767
type === 'native'
68-
? // `npx react-native init <projectName> --directory example --skip-install`
68+
? // `npx --package react-native-test-app@latest init --name ${projectName}Example --destination example --version ${reactNativeVersion}`
6969
[
70-
'react-native@latest',
70+
'--package',
71+
`react-native-test-app@latest`,
7172
'init',
73+
'--name',
7274
`${projectName}Example`,
73-
'--directory',
75+
`--destination`,
7476
directory,
75-
'--version',
76-
reactNativeVersion,
77-
'--skip-install',
78-
'--npm',
77+
...(reactNativeVersion !== 'latest'
78+
? ['--version', reactNativeVersion]
79+
: []),
80+
'--platform',
81+
'ios',
82+
'--platform',
83+
'android',
7984
]
8085
: // `npx create-expo-app example --no-install --template blank`
8186
[
@@ -87,7 +92,6 @@ export default async function generateExampleApp({
8792
];
8893

8994
await spawn('npx', args, {
90-
cwd: dest,
9195
env: { ...process.env, npm_config_yes: 'true' },
9296
});
9397

packages/create-react-native-library/templates/example-legacy/example/react-native.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
const path = require('path');
22
const pak = require('../package.json');
3+
const { configureProjects } = require('react-native-test-app');
34

45
module.exports = {
6+
project: configureProjects({
7+
android: {
8+
sourceDir: 'android',
9+
},
10+
ios: {
11+
sourceDir: 'ios',
12+
},
13+
}),
514
dependencies: {
615
[pak.name]: {
716
root: path.join(__dirname, '..'),

packages/create-react-native-library/templates/native-common-example/example/react-native.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
const path = require('path');
22
const pak = require('../package.json');
3+
const { configureProjects } = require('react-native-test-app');
34

45
module.exports = {
6+
project: configureProjects({
7+
android: {
8+
sourceDir: 'android',
9+
},
10+
ios: {
11+
sourceDir: 'ios',
12+
},
13+
}),
514
dependencies: {
615
[pak.name]: {
716
root: path.join(__dirname, '..'),

0 commit comments

Comments
 (0)