mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-03 00:03:10 +08:00
use expo cli if available
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"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.",
|
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -53,31 +53,25 @@ async function runReactNativeBundleCommand(
|
|||||||
|
|
||||||
let cliPath;
|
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;
|
let usingExpo = false;
|
||||||
try {
|
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', {
|
cliPath = require.resolve('@expo/cli', {
|
||||||
paths: [process.cwd()],
|
paths: [process.cwd()],
|
||||||
});
|
});
|
||||||
usingExpo = true;
|
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';
|
const bundleCommand = usingExpo ? 'export:embed' : 'bundle';
|
||||||
|
|
||||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
Array.prototype.push.apply(reactNativeBundleArgs, [
|
||||||
|
|||||||
Reference in New Issue
Block a user