mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-10-28 21:33:10 +08:00
Refactor Hermes option handling in CLI and bundle commands; rename 'disableHermes' to 'hermes' for clarity and update related logic in bundle.ts and provider.ts.
This commit is contained in:
2
cli.json
2
cli.json
@@ -213,7 +213,7 @@
|
||||
"rncli": {
|
||||
"default": false
|
||||
},
|
||||
"disableHermes": {
|
||||
"hermes": {
|
||||
"default": false
|
||||
},
|
||||
"name": {
|
||||
|
||||
@@ -42,7 +42,7 @@ async function runReactNativeBundleCommand({
|
||||
platform,
|
||||
sourcemapOutput,
|
||||
config,
|
||||
disableHermes,
|
||||
forceHermes,
|
||||
cli,
|
||||
}: {
|
||||
bundleName: string;
|
||||
@@ -52,7 +52,7 @@ async function runReactNativeBundleCommand({
|
||||
platform: string;
|
||||
sourcemapOutput: string;
|
||||
config?: string;
|
||||
disableHermes?: boolean;
|
||||
forceHermes?: boolean;
|
||||
cli: {
|
||||
taro?: boolean;
|
||||
expo?: boolean;
|
||||
@@ -163,16 +163,21 @@ async function runReactNativeBundleCommand({
|
||||
bundleCommand = 'build';
|
||||
}
|
||||
|
||||
if (platform === 'harmony') {
|
||||
bundleName = 'harmony.bundle.js';
|
||||
if (forceHermes === undefined) {
|
||||
// enable hermes by default for harmony
|
||||
forceHermes = true;
|
||||
}
|
||||
}
|
||||
|
||||
reactNativeBundleArgs.push(
|
||||
cliPath,
|
||||
bundleCommand,
|
||||
'--assets-dest',
|
||||
outputFolder,
|
||||
'--bundle-output',
|
||||
path.join(
|
||||
outputFolder,
|
||||
platform === 'harmony' ? 'harmony.bundle.js' : bundleName,
|
||||
),
|
||||
path.join(outputFolder, bundleName),
|
||||
);
|
||||
|
||||
if (platform !== 'harmony') {
|
||||
@@ -213,9 +218,9 @@ async function runReactNativeBundleCommand({
|
||||
} else {
|
||||
let hermesEnabled: boolean | undefined = false;
|
||||
|
||||
if (disableHermes) {
|
||||
hermesEnabled = false;
|
||||
console.log(t('hermesDisabled'));
|
||||
if (forceHermes) {
|
||||
hermesEnabled = true;
|
||||
console.log(t('forceHermes'));
|
||||
} else if (platform === 'android') {
|
||||
const gradlePropeties = await new Promise<{
|
||||
hermesEnabled?: boolean;
|
||||
@@ -445,7 +450,12 @@ async function uploadSourcemapForSentry(
|
||||
}
|
||||
}
|
||||
|
||||
const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
|
||||
const ignorePackingFileNames = [
|
||||
'.',
|
||||
'..',
|
||||
'index.bundlejs.map',
|
||||
'harmony.bundle.js.map',
|
||||
];
|
||||
const ignorePackingExtensions = ['DS_Store', 'txt.map'];
|
||||
async function pack(dir: string, output: string) {
|
||||
console.log(t('packing'));
|
||||
@@ -886,7 +896,7 @@ export const bundleCommands = {
|
||||
taro,
|
||||
expo,
|
||||
rncli,
|
||||
disableHermes,
|
||||
hermes,
|
||||
name,
|
||||
description,
|
||||
metaInfo,
|
||||
@@ -927,7 +937,7 @@ export const bundleCommands = {
|
||||
outputFolder: intermediaDir,
|
||||
platform,
|
||||
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
||||
disableHermes: !!disableHermes,
|
||||
forceHermes: hermes as unknown as boolean,
|
||||
cli: {
|
||||
taro: !!taro,
|
||||
expo: !!expo,
|
||||
|
||||
@@ -49,7 +49,7 @@ export default {
|
||||
fileGenerated: '{{- file}} generated.',
|
||||
fileSizeExceeded:
|
||||
'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{- pricingPageUrl}}',
|
||||
hermesDisabled: 'Hermes disabled',
|
||||
forceHermes: 'Forcing Hermes enabled for this build',
|
||||
hermesEnabledCompiling: 'Hermes enabled, now compiling to hermes bytecode:\n',
|
||||
ipaUploadSuccess:
|
||||
'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||
|
||||
@@ -47,7 +47,7 @@ export default {
|
||||
fileGenerated: '已生成 {{- file}}',
|
||||
fileSizeExceeded:
|
||||
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
|
||||
hermesDisabled: 'Hermes 已禁用',
|
||||
forceHermes: '强制启用 Hermes 编译',
|
||||
hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
||||
ipaUploadSuccess:
|
||||
'已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||
|
||||
@@ -53,7 +53,7 @@ export const bundleModule: CLIModule = {
|
||||
taro = false,
|
||||
expo = false,
|
||||
rncli = false,
|
||||
disableHermes = false,
|
||||
hermes = false,
|
||||
output,
|
||||
} = context.options;
|
||||
|
||||
@@ -73,7 +73,7 @@ export const bundleModule: CLIModule = {
|
||||
taro,
|
||||
expo,
|
||||
rncli,
|
||||
disableHermes,
|
||||
hermes,
|
||||
intermediaDir: '${tempDir}/intermedia/${platform}',
|
||||
output: '${tempDir}/output/${platform}.${time}.ppk',
|
||||
};
|
||||
@@ -170,10 +170,10 @@ export const bundleModule: CLIModule = {
|
||||
default: false,
|
||||
description: 'Use React Native CLI',
|
||||
},
|
||||
disableHermes: {
|
||||
hermes: {
|
||||
hasValue: false,
|
||||
default: false,
|
||||
description: 'Disable Hermes',
|
||||
description: 'Force enable Hermes',
|
||||
},
|
||||
name: {
|
||||
hasValue: true,
|
||||
|
||||
@@ -42,7 +42,7 @@ export class CLIProviderImpl implements CLIProvider {
|
||||
taro: options.taro || false,
|
||||
expo: options.expo || false,
|
||||
rncli: options.rncli || false,
|
||||
disableHermes: options.disableHermes || false,
|
||||
hermes: options.hermes || false,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export interface BundleOptions {
|
||||
taro?: boolean;
|
||||
expo?: boolean;
|
||||
rncli?: boolean;
|
||||
disableHermes?: boolean;
|
||||
hermes?: boolean;
|
||||
}
|
||||
|
||||
export interface PublishOptions {
|
||||
|
||||
Reference in New Issue
Block a user