mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-10-28 21:33:10 +08:00
Update version to 2.2.1 in package.json and refactor argument handling in runReactNativeBundleCommand for improved clarity and efficiency.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"name": "react-native-update-cli",
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"description": "command line tool for react-native-update (remote updates for react native)",
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -75,15 +75,12 @@ async function runReactNativeBundleCommand({
|
|||||||
const envArgs = process.env.PUSHY_ENV_ARGS;
|
const envArgs = process.env.PUSHY_ENV_ARGS;
|
||||||
|
|
||||||
if (envArgs) {
|
if (envArgs) {
|
||||||
Array.prototype.push.apply(
|
reactNativeBundleArgs.push(...envArgs.trim().split(/\s+/));
|
||||||
reactNativeBundleArgs,
|
|
||||||
envArgs.trim().split(/\s+/),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.emptyDirSync(outputFolder);
|
fs.emptyDirSync(outputFolder);
|
||||||
|
|
||||||
let cliPath: string | undefined;
|
let cliPath = '';
|
||||||
let usingExpo = false;
|
let usingExpo = false;
|
||||||
|
|
||||||
const getExpoCli = () => {
|
const getExpoCli = () => {
|
||||||
@@ -104,7 +101,7 @@ async function runReactNativeBundleCommand({
|
|||||||
if (satisfies(expoCliVersion, '>= 0.10.17')) {
|
if (satisfies(expoCliVersion, '>= 0.10.17')) {
|
||||||
usingExpo = true;
|
usingExpo = true;
|
||||||
} else {
|
} else {
|
||||||
cliPath = undefined;
|
cliPath = '';
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
};
|
};
|
||||||
@@ -166,49 +163,34 @@ async function runReactNativeBundleCommand({
|
|||||||
bundleCommand = 'build';
|
bundleCommand = 'build';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform === 'harmony') {
|
reactNativeBundleArgs.push(
|
||||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
cliPath,
|
||||||
cliPath,
|
bundleCommand,
|
||||||
bundleCommand,
|
'--assets-dest',
|
||||||
'--dev',
|
outputFolder,
|
||||||
dev,
|
'--bundle-output',
|
||||||
'--entry-file',
|
path.join(
|
||||||
entryFile,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
|
||||||
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config) {
|
|
||||||
reactNativeBundleArgs.push('--config', config);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
|
||||||
cliPath,
|
|
||||||
bundleCommand,
|
|
||||||
'--assets-dest',
|
|
||||||
outputFolder,
|
outputFolder,
|
||||||
'--bundle-output',
|
platform === 'harmony' ? 'bundle.harmony.js' : bundleName,
|
||||||
path.join(outputFolder, bundleName),
|
),
|
||||||
'--platform',
|
);
|
||||||
platform,
|
|
||||||
'--reset-cache',
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (cli.taro) {
|
if (platform !== 'harmony') {
|
||||||
reactNativeBundleArgs.push(...['--type', 'rn']);
|
reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
|
||||||
} else {
|
}
|
||||||
reactNativeBundleArgs.push(...['--dev', dev, '--entry-file', entryFile]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
if (cli.taro) {
|
||||||
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
reactNativeBundleArgs.push('--type', 'rn');
|
||||||
}
|
} else {
|
||||||
|
reactNativeBundleArgs.push('--dev', dev, '--entry-file', entryFile);
|
||||||
|
}
|
||||||
|
|
||||||
if (config) {
|
if (sourcemapOutput) {
|
||||||
reactNativeBundleArgs.push('--config', config);
|
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config) {
|
||||||
|
reactNativeBundleArgs.push('--config', config);
|
||||||
}
|
}
|
||||||
|
|
||||||
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
||||||
@@ -814,7 +796,10 @@ async function diffFromPackage(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
zipfile.addBuffer(Buffer.from(JSON.stringify({ copies, copiesv2 })), '__diff.json');
|
zipfile.addBuffer(
|
||||||
|
Buffer.from(JSON.stringify({ copies, copiesv2 })),
|
||||||
|
'__diff.json',
|
||||||
|
);
|
||||||
zipfile.end();
|
zipfile.end();
|
||||||
await writePromise;
|
await writePromise;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user