Skip to content

Commit 8959c60

Browse files
authored
Merge pull request #75 from shm-open/feature/add_params
feat: add extraBundlerOptions and extraHermesFlags params
2 parents c845191 + 6fda542 commit 8959c60

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/command-executor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,7 @@ export var releaseReact = (command: cli.IReleaseReactCommand): Promise<void> =>
13951395
platform,
13961396
command.sourcemapOutput,
13971397
command.config,
1398+
command.extraBundlerOptions,
13981399
),
13991400
)
14001401
.then(() => {
@@ -1405,7 +1406,7 @@ export var releaseReact = (command: cli.IReleaseReactCommand): Promise<void> =>
14051406
bundleName,
14061407
outputFolder,
14071408
command.sourcemapOutput,
1408-
[], // TODO: extra flags
1409+
command.extraHermesFlags,
14091410
);
14101411
}
14111412
});
@@ -1416,7 +1417,7 @@ export var releaseReact = (command: cli.IReleaseReactCommand): Promise<void> =>
14161417
bundleName,
14171418
outputFolder,
14181419
command.sourcemapOutput,
1419-
[], // TODO: extra flags
1420+
command.extraHermesFlags,
14201421
);
14211422
}
14221423
});

src/command-parser.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,20 @@ var argv = yargs
10771077
description: 'Path to the React Native CLI configuration file',
10781078
type: 'string',
10791079
})
1080+
.option('extraBundlerOptions', {
1081+
default: [],
1082+
demand: false,
1083+
description:
1084+
'Option that gets passed to react-native bundler. Can be specified multiple times',
1085+
type: 'array',
1086+
})
1087+
.option('extraHermesFlags', {
1088+
default: [],
1089+
demand: false,
1090+
description:
1091+
'Flag that gets passed to Hermes, JavaScript to bytecode compiler. Can be specified multiple times',
1092+
type: 'array',
1093+
})
10801094
.check((argv: any, aliases: { [aliases: string]: string }): any => {
10811095
return checkValidReleaseOptions(argv);
10821096
});
@@ -1540,6 +1554,10 @@ function createCommand(): cli.ICommand {
15401554
releaseReactCommand.sourcemapOutputDir = argv['sourcemapOutputDir'] as string;
15411555
releaseReactCommand.outputDir = argv['outputDir'] as string;
15421556
releaseReactCommand.config = argv['config'] as string;
1557+
releaseReactCommand.extraBundlerOptions = argv[
1558+
'extraBundlerOptions'
1559+
] as string[];
1560+
releaseReactCommand.extraHermesFlags = argv['extraHermesFlags'] as string[];
15431561
}
15441562
break;
15451563

src/definitions/cli.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ export interface IReleaseReactCommand extends IReleaseBaseCommand {
206206
sourcemapOutputDir?: string;
207207
outputDir?: string;
208208
config?: string;
209+
extraBundlerOptions?: string[];
210+
extraHermesFlags?: string[];
209211
}
210212

211213
export interface IRollbackCommand extends ICommand {

src/lib/react-native-utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export function runReactNativeBundleCommand(
270270
platform: string,
271271
sourcemapOutput: string,
272272
config: string,
273+
extraBundlerOptions?: string[],
273274
): Promise<void> {
274275
let reactNativeBundleArgs: string[] = [];
275276
let envNodeArgs: string = process.env.CODE_PUSH_NODE_ARGS;
@@ -291,6 +292,7 @@ export function runReactNativeBundleCommand(
291292
entryFile,
292293
'--platform',
293294
platform,
295+
...extraBundlerOptions,
294296
]);
295297

296298
if (sourcemapOutput) {

0 commit comments

Comments
 (0)