react-native-update-cli 1.17.0 → 1.19.0
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 +21 -7
- package/package.json +1 -1
- package/src/bundle.js +29 -8
package/lib/bundle.js
CHANGED
|
@@ -41,9 +41,9 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
|
|
|
41
41
|
let gradleConfig = {};
|
|
42
42
|
if (platform === 'android') {
|
|
43
43
|
gradleConfig = await checkGradleConfig();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
if (gradleConfig.crunchPngs !== false) {
|
|
45
|
+
console.warn('android的crunchPngs选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n');
|
|
46
|
+
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
let reactNativeBundleArgs = [];
|
|
@@ -56,10 +56,23 @@ async function runReactNativeBundleCommand(bundleName, development, entryFile, o
|
|
|
56
56
|
|
|
57
57
|
fs.emptyDirSync(outputFolder);
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
let cliPath = require.resolve('react-native/local-cli/cli.js', {
|
|
60
60
|
paths: [process.cwd()]
|
|
61
|
-
})
|
|
62
|
-
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
require.resolve('expo-router', {
|
|
64
|
+
paths: [process.cwd()]
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
console.log(`expo-router detected, will use @expo/cli to bundle.\n`);
|
|
68
|
+
// if using expo-router, use expo-cli
|
|
69
|
+
cliPath = require.resolve('@expo/cli', {
|
|
70
|
+
paths: [process.cwd()]
|
|
71
|
+
});
|
|
72
|
+
} catch (e) {}
|
|
73
|
+
const bundleCommand = cliPath.includes('@expo/cli') ? 'export:embed' : 'bundle';
|
|
74
|
+
|
|
75
|
+
Array.prototype.push.apply(reactNativeBundleArgs, [cliPath, bundleCommand, '--assets-dest', outputFolder, '--bundle-output', path.join(outputFolder, bundleName), '--dev', development, '--entry-file', entryFile, '--platform', platform, '--reset-cache']);
|
|
63
76
|
|
|
64
77
|
if (sourcemapOutput) {
|
|
65
78
|
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
@@ -160,7 +173,8 @@ async function compileHermesByteCode(bundleName, outputFolder, sourcemapOutput)
|
|
|
160
173
|
if (sourcemapOutput) {
|
|
161
174
|
args.push('-output-source-map');
|
|
162
175
|
}
|
|
163
|
-
|
|
176
|
+
console.log('Running hermesc: ' + hermesCommand + ' ' + args.join(' ') + '\n');
|
|
177
|
+
spawnSync(hermesCommand, args, {
|
|
164
178
|
stdio: 'ignore'
|
|
165
179
|
});
|
|
166
180
|
}
|
package/package.json
CHANGED
package/src/bundle.js
CHANGED
|
@@ -31,9 +31,11 @@ async function runReactNativeBundleCommand(
|
|
|
31
31
|
let gradleConfig = {};
|
|
32
32
|
if (platform === 'android') {
|
|
33
33
|
gradleConfig = await checkGradleConfig();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (gradleConfig.crunchPngs !== false) {
|
|
35
|
+
console.warn(
|
|
36
|
+
'android的crunchPngs选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
|
|
37
|
+
);
|
|
38
|
+
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
let reactNativeBundleArgs = [];
|
|
@@ -49,11 +51,27 @@ async function runReactNativeBundleCommand(
|
|
|
49
51
|
|
|
50
52
|
fs.emptyDirSync(outputFolder);
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
let cliPath = require.resolve('react-native/local-cli/cli.js', {
|
|
55
|
+
paths: [process.cwd()],
|
|
56
|
+
});
|
|
57
|
+
try {
|
|
58
|
+
require.resolve('expo-router', {
|
|
59
|
+
paths: [process.cwd()],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
console.log(`expo-router detected, will use @expo/cli to bundle.\n`);
|
|
63
|
+
// if using expo-router, use expo-cli
|
|
64
|
+
cliPath = require.resolve('@expo/cli', {
|
|
54
65
|
paths: [process.cwd()],
|
|
55
|
-
})
|
|
56
|
-
|
|
66
|
+
});
|
|
67
|
+
} catch (e) {}
|
|
68
|
+
const bundleCommand = cliPath.includes('@expo/cli')
|
|
69
|
+
? 'export:embed'
|
|
70
|
+
: 'bundle';
|
|
71
|
+
|
|
72
|
+
Array.prototype.push.apply(reactNativeBundleArgs, [
|
|
73
|
+
cliPath,
|
|
74
|
+
bundleCommand,
|
|
57
75
|
'--assets-dest',
|
|
58
76
|
outputFolder,
|
|
59
77
|
'--bundle-output',
|
|
@@ -204,7 +222,10 @@ async function compileHermesByteCode(
|
|
|
204
222
|
if (sourcemapOutput) {
|
|
205
223
|
args.push('-output-source-map');
|
|
206
224
|
}
|
|
207
|
-
|
|
225
|
+
console.log(
|
|
226
|
+
'Running hermesc: ' + hermesCommand + ' ' + args.join(' ') + '\n',
|
|
227
|
+
);
|
|
228
|
+
spawnSync(hermesCommand, args, {
|
|
208
229
|
stdio: 'ignore',
|
|
209
230
|
});
|
|
210
231
|
}
|