Skip to content

Commit b76440d

Browse files
committed
Update version to 2.2.1 in package.json and refactor argument handling in runReactNativeBundleCommand for improved clarity and efficiency.
1 parent e3c951b commit b76440d

File tree

2 files changed

+31
-46
lines changed

2 files changed

+31
-46
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update-cli",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "command line tool for react-native-update (remote updates for react native)",
55
"main": "index.js",
66
"bin": {

src/bundle.ts

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,12 @@ async function runReactNativeBundleCommand({
7575
const envArgs = process.env.PUSHY_ENV_ARGS;
7676

7777
if (envArgs) {
78-
Array.prototype.push.apply(
79-
reactNativeBundleArgs,
80-
envArgs.trim().split(/\s+/),
81-
);
78+
reactNativeBundleArgs.push(...envArgs.trim().split(/\s+/));
8279
}
8380

8481
fs.emptyDirSync(outputFolder);
8582

86-
let cliPath: string | undefined;
83+
let cliPath = '';
8784
let usingExpo = false;
8885

8986
const getExpoCli = () => {
@@ -104,7 +101,7 @@ async function runReactNativeBundleCommand({
104101
if (satisfies(expoCliVersion, '>= 0.10.17')) {
105102
usingExpo = true;
106103
} else {
107-
cliPath = undefined;
104+
cliPath = '';
108105
}
109106
} catch (e) {}
110107
};
@@ -166,49 +163,34 @@ async function runReactNativeBundleCommand({
166163
bundleCommand = 'build';
167164
}
168165

169-
if (platform === 'harmony') {
170-
Array.prototype.push.apply(reactNativeBundleArgs, [
171-
cliPath,
172-
bundleCommand,
173-
'--dev',
174-
dev,
175-
'--entry-file',
176-
entryFile,
177-
]);
166+
reactNativeBundleArgs.push(
167+
cliPath,
168+
bundleCommand,
169+
'--assets-dest',
170+
outputFolder,
171+
'--bundle-output',
172+
path.join(
173+
outputFolder,
174+
platform === 'harmony' ? 'bundle.harmony.js' : bundleName,
175+
),
176+
);
178177

179-
if (sourcemapOutput) {
180-
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
181-
}
178+
if (platform !== 'harmony') {
179+
reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
180+
}
182181

183-
if (config) {
184-
reactNativeBundleArgs.push('--config', config);
185-
}
182+
if (cli.taro) {
183+
reactNativeBundleArgs.push('--type', 'rn');
186184
} else {
187-
Array.prototype.push.apply(reactNativeBundleArgs, [
188-
cliPath,
189-
bundleCommand,
190-
'--assets-dest',
191-
outputFolder,
192-
'--bundle-output',
193-
path.join(outputFolder, bundleName),
194-
'--platform',
195-
platform,
196-
'--reset-cache',
197-
]);
198-
199-
if (cli.taro) {
200-
reactNativeBundleArgs.push(...['--type', 'rn']);
201-
} else {
202-
reactNativeBundleArgs.push(...['--dev', dev, '--entry-file', entryFile]);
203-
}
185+
reactNativeBundleArgs.push('--dev', dev, '--entry-file', entryFile);
186+
}
204187

205-
if (sourcemapOutput) {
206-
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
207-
}
188+
if (sourcemapOutput) {
189+
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
190+
}
208191

209-
if (config) {
210-
reactNativeBundleArgs.push('--config', config);
211-
}
192+
if (config) {
193+
reactNativeBundleArgs.push('--config', config);
212194
}
213195

214196
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
@@ -814,7 +796,10 @@ async function diffFromPackage(
814796
}
815797
});
816798

817-
zipfile.addBuffer(Buffer.from(JSON.stringify({ copies, copiesv2 })), '__diff.json');
799+
zipfile.addBuffer(
800+
Buffer.from(JSON.stringify({ copies, copiesv2 })),
801+
'__diff.json',
802+
);
818803
zipfile.end();
819804
await writePromise;
820805
}

0 commit comments

Comments
 (0)