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": {
|
"rncli": {
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
"disableHermes": {
|
"hermes": {
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ async function runReactNativeBundleCommand({
|
|||||||
platform,
|
platform,
|
||||||
sourcemapOutput,
|
sourcemapOutput,
|
||||||
config,
|
config,
|
||||||
disableHermes,
|
forceHermes,
|
||||||
cli,
|
cli,
|
||||||
}: {
|
}: {
|
||||||
bundleName: string;
|
bundleName: string;
|
||||||
@@ -52,7 +52,7 @@ async function runReactNativeBundleCommand({
|
|||||||
platform: string;
|
platform: string;
|
||||||
sourcemapOutput: string;
|
sourcemapOutput: string;
|
||||||
config?: string;
|
config?: string;
|
||||||
disableHermes?: boolean;
|
forceHermes?: boolean;
|
||||||
cli: {
|
cli: {
|
||||||
taro?: boolean;
|
taro?: boolean;
|
||||||
expo?: boolean;
|
expo?: boolean;
|
||||||
@@ -163,16 +163,21 @@ async function runReactNativeBundleCommand({
|
|||||||
bundleCommand = 'build';
|
bundleCommand = 'build';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (platform === 'harmony') {
|
||||||
|
bundleName = 'harmony.bundle.js';
|
||||||
|
if (forceHermes === undefined) {
|
||||||
|
// enable hermes by default for harmony
|
||||||
|
forceHermes = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reactNativeBundleArgs.push(
|
reactNativeBundleArgs.push(
|
||||||
cliPath,
|
cliPath,
|
||||||
bundleCommand,
|
bundleCommand,
|
||||||
'--assets-dest',
|
'--assets-dest',
|
||||||
outputFolder,
|
outputFolder,
|
||||||
'--bundle-output',
|
'--bundle-output',
|
||||||
path.join(
|
path.join(outputFolder, bundleName),
|
||||||
outputFolder,
|
|
||||||
platform === 'harmony' ? 'harmony.bundle.js' : bundleName,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (platform !== 'harmony') {
|
if (platform !== 'harmony') {
|
||||||
@@ -213,9 +218,9 @@ async function runReactNativeBundleCommand({
|
|||||||
} else {
|
} else {
|
||||||
let hermesEnabled: boolean | undefined = false;
|
let hermesEnabled: boolean | undefined = false;
|
||||||
|
|
||||||
if (disableHermes) {
|
if (forceHermes) {
|
||||||
hermesEnabled = false;
|
hermesEnabled = true;
|
||||||
console.log(t('hermesDisabled'));
|
console.log(t('forceHermes'));
|
||||||
} else if (platform === 'android') {
|
} else if (platform === 'android') {
|
||||||
const gradlePropeties = await new Promise<{
|
const gradlePropeties = await new Promise<{
|
||||||
hermesEnabled?: boolean;
|
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'];
|
const ignorePackingExtensions = ['DS_Store', 'txt.map'];
|
||||||
async function pack(dir: string, output: string) {
|
async function pack(dir: string, output: string) {
|
||||||
console.log(t('packing'));
|
console.log(t('packing'));
|
||||||
@@ -886,7 +896,7 @@ export const bundleCommands = {
|
|||||||
taro,
|
taro,
|
||||||
expo,
|
expo,
|
||||||
rncli,
|
rncli,
|
||||||
disableHermes,
|
hermes,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
metaInfo,
|
metaInfo,
|
||||||
@@ -927,7 +937,7 @@ export const bundleCommands = {
|
|||||||
outputFolder: intermediaDir,
|
outputFolder: intermediaDir,
|
||||||
platform,
|
platform,
|
||||||
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
||||||
disableHermes: !!disableHermes,
|
forceHermes: hermes as unknown as boolean,
|
||||||
cli: {
|
cli: {
|
||||||
taro: !!taro,
|
taro: !!taro,
|
||||||
expo: !!expo,
|
expo: !!expo,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default {
|
|||||||
fileGenerated: '{{- file}} generated.',
|
fileGenerated: '{{- file}} generated.',
|
||||||
fileSizeExceeded:
|
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}}',
|
'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',
|
hermesEnabledCompiling: 'Hermes enabled, now compiling to hermes bytecode:\n',
|
||||||
ipaUploadSuccess:
|
ipaUploadSuccess:
|
||||||
'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default {
|
|||||||
fileGenerated: '已生成 {{- file}}',
|
fileGenerated: '已生成 {{- file}}',
|
||||||
fileSizeExceeded:
|
fileSizeExceeded:
|
||||||
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
|
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
|
||||||
hermesDisabled: 'Hermes 已禁用',
|
forceHermes: '强制启用 Hermes 编译',
|
||||||
hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
||||||
ipaUploadSuccess:
|
ipaUploadSuccess:
|
||||||
'已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
'已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export const bundleModule: CLIModule = {
|
|||||||
taro = false,
|
taro = false,
|
||||||
expo = false,
|
expo = false,
|
||||||
rncli = false,
|
rncli = false,
|
||||||
disableHermes = false,
|
hermes = false,
|
||||||
output,
|
output,
|
||||||
} = context.options;
|
} = context.options;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ export const bundleModule: CLIModule = {
|
|||||||
taro,
|
taro,
|
||||||
expo,
|
expo,
|
||||||
rncli,
|
rncli,
|
||||||
disableHermes,
|
hermes,
|
||||||
intermediaDir: '${tempDir}/intermedia/${platform}',
|
intermediaDir: '${tempDir}/intermedia/${platform}',
|
||||||
output: '${tempDir}/output/${platform}.${time}.ppk',
|
output: '${tempDir}/output/${platform}.${time}.ppk',
|
||||||
};
|
};
|
||||||
@@ -170,10 +170,10 @@ export const bundleModule: CLIModule = {
|
|||||||
default: false,
|
default: false,
|
||||||
description: 'Use React Native CLI',
|
description: 'Use React Native CLI',
|
||||||
},
|
},
|
||||||
disableHermes: {
|
hermes: {
|
||||||
hasValue: false,
|
hasValue: false,
|
||||||
default: false,
|
default: false,
|
||||||
description: 'Disable Hermes',
|
description: 'Force enable Hermes',
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
hasValue: true,
|
hasValue: true,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class CLIProviderImpl implements CLIProvider {
|
|||||||
taro: options.taro || false,
|
taro: options.taro || false,
|
||||||
expo: options.expo || false,
|
expo: options.expo || false,
|
||||||
rncli: options.rncli || false,
|
rncli: options.rncli || false,
|
||||||
disableHermes: options.disableHermes || false,
|
hermes: options.hermes || false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export interface BundleOptions {
|
|||||||
taro?: boolean;
|
taro?: boolean;
|
||||||
expo?: boolean;
|
expo?: boolean;
|
||||||
rncli?: boolean;
|
rncli?: boolean;
|
||||||
disableHermes?: boolean;
|
hermes?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PublishOptions {
|
export interface PublishOptions {
|
||||||
|
|||||||
Reference in New Issue
Block a user