react-native-update-cli 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bundle.js CHANGED
@@ -109,15 +109,28 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
109
109
  let usingExpo = false;
110
110
  const getExpoCli = ()=>{
111
111
  try {
112
+ const searchPaths = [
113
+ process.cwd()
114
+ ];
115
+ // 尝试添加 expo 包的路径作为额外的搜索路径
116
+ try {
117
+ const expoPath = require.resolve('expo/package.json', {
118
+ paths: [
119
+ process.cwd()
120
+ ]
121
+ });
122
+ // 获取 expo 包的目录路径
123
+ const expoDir = expoPath.replace(/\/package\.json$/, '');
124
+ searchPaths.push(expoDir);
125
+ } catch (e) {
126
+ // expo 包不存在,忽略
127
+ }
128
+ // 尝试从搜索路径中解析 @expo/cli
112
129
  cliPath = require.resolve('@expo/cli', {
113
- paths: [
114
- process.cwd()
115
- ]
130
+ paths: searchPaths
116
131
  });
117
132
  const expoCliVersion = JSON.parse(_fsextra.readFileSync(require.resolve('@expo/cli/package.json', {
118
- paths: [
119
- process.cwd()
120
- ]
133
+ paths: searchPaths
121
134
  })).toString()).version;
122
135
  // expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
123
136
  if ((0, _compareversions.satisfies)(expoCliVersion, '>= 0.10.17')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/bundle.ts CHANGED
@@ -85,14 +85,30 @@ async function runReactNativeBundleCommand({
85
85
 
86
86
  const getExpoCli = () => {
87
87
  try {
88
+ const searchPaths = [process.cwd()];
89
+
90
+ // 尝试添加 expo 包的路径作为额外的搜索路径
91
+ try {
92
+ const expoPath = require.resolve('expo/package.json', {
93
+ paths: [process.cwd()],
94
+ });
95
+ // 获取 expo 包的目录路径
96
+ const expoDir = expoPath.replace(/\/package\.json$/, '');
97
+ searchPaths.push(expoDir);
98
+ } catch {
99
+ // expo 包不存在,忽略
100
+ }
101
+
102
+ // 尝试从搜索路径中解析 @expo/cli
88
103
  cliPath = require.resolve('@expo/cli', {
89
- paths: [process.cwd()],
104
+ paths: searchPaths,
90
105
  });
106
+
91
107
  const expoCliVersion = JSON.parse(
92
108
  fs
93
109
  .readFileSync(
94
110
  require.resolve('@expo/cli/package.json', {
95
- paths: [process.cwd()],
111
+ paths: searchPaths,
96
112
  }),
97
113
  )
98
114
  .toString(),