1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-10-07 11:05:15 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

use expo cli if available

This commit is contained in:
sunny.luo
2024-12-11 17:23:28 +08:00
parent bb777bf973
commit 6534379d81
2 changed files with 14 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update-cli",
"version": "1.34.2",
"version": "1.35.0",
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
"main": "index.js",
"bin": {

View File

@@ -53,31 +53,25 @@ async function runReactNativeBundleCommand(
let cliPath;
try {
// rn >= 0.75
cliPath = require.resolve('@react-native-community/cli/build/bin.js', {
paths: [process.cwd()],
});
} catch (e) {
// rn < 0.75
cliPath = require.resolve('react-native/local-cli/cli.js', {
paths: [process.cwd()],
});
}
let usingExpo = false;
try {
require.resolve('expo-router', {
paths: [process.cwd()],
});
console.log(`expo-router detected, will use @expo/cli to bundle.\n`);
// if using expo-router, use expo-cli
cliPath = require.resolve('@expo/cli', {
paths: [process.cwd()],
});
usingExpo = true;
} catch (e) {}
} catch (e) {
try {
// rn >= 0.75
cliPath = require.resolve('@react-native-community/cli/build/bin.js', {
paths: [process.cwd()],
});
} catch (e) {
// rn < 0.75
cliPath = require.resolve('react-native/local-cli/cli.js', {
paths: [process.cwd()],
});
}
}
const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
Array.prototype.push.apply(reactNativeBundleArgs, [