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

Update version to 2.3.2 in package.json and enhance search paths for @expo/cli in runReactNativeBundleCommand to include expo package directory.

This commit is contained in:
sunnylqm
2025-10-31 16:07:02 +08:00
parent b973ace443
commit 6751daf8e0
2 changed files with 19 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update-cli", "name": "react-native-update-cli",
"version": "2.3.1", "version": "2.3.2",
"description": "command line tool for react-native-update (remote updates for react native)", "description": "command line tool for react-native-update (remote updates for react native)",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@@ -85,14 +85,30 @@ async function runReactNativeBundleCommand({
const getExpoCli = () => { const getExpoCli = () => {
try { try {
cliPath = require.resolve('@expo/cli', { const searchPaths = [process.cwd()];
// 尝试添加 expo 包的路径作为额外的搜索路径
try {
const expoPath = require.resolve('expo/package.json', {
paths: [process.cwd()], paths: [process.cwd()],
}); });
// 获取 expo 包的目录路径
const expoDir = expoPath.replace(/\/package\.json$/, '');
searchPaths.push(expoDir);
} catch {
// expo 包不存在,忽略
}
// 尝试从搜索路径中解析 @expo/cli
cliPath = require.resolve('@expo/cli', {
paths: searchPaths,
});
const expoCliVersion = JSON.parse( const expoCliVersion = JSON.parse(
fs fs
.readFileSync( .readFileSync(
require.resolve('@expo/cli/package.json', { require.resolve('@expo/cli/package.json', {
paths: [process.cwd()], paths: searchPaths,
}), }),
) )
.toString(), .toString(),