Skip to content

Commit 6534379

Browse files
author
sunny.luo
committed
use expo cli if available
1 parent bb777bf commit 6534379

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update-cli",
3-
"version": "1.34.2",
3+
"version": "1.35.0",
44
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
55
"main": "index.js",
66
"bin": {

src/bundle.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,25 @@ async function runReactNativeBundleCommand(
5353

5454
let cliPath;
5555

56-
try {
57-
// rn >= 0.75
58-
cliPath = require.resolve('@react-native-community/cli/build/bin.js', {
59-
paths: [process.cwd()],
60-
});
61-
} catch (e) {
62-
// rn < 0.75
63-
cliPath = require.resolve('react-native/local-cli/cli.js', {
64-
paths: [process.cwd()],
65-
});
66-
}
67-
6856
let usingExpo = false;
6957
try {
70-
require.resolve('expo-router', {
71-
paths: [process.cwd()],
72-
});
73-
74-
console.log(`expo-router detected, will use @expo/cli to bundle.\n`);
75-
// if using expo-router, use expo-cli
7658
cliPath = require.resolve('@expo/cli', {
7759
paths: [process.cwd()],
7860
});
7961
usingExpo = true;
80-
} catch (e) {}
62+
} catch (e) {
63+
try {
64+
// rn >= 0.75
65+
cliPath = require.resolve('@react-native-community/cli/build/bin.js', {
66+
paths: [process.cwd()],
67+
});
68+
} catch (e) {
69+
// rn < 0.75
70+
cliPath = require.resolve('react-native/local-cli/cli.js', {
71+
paths: [process.cwd()],
72+
});
73+
}
74+
}
8175
const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
8276

8377
Array.prototype.push.apply(reactNativeBundleArgs, [

0 commit comments

Comments
 (0)