mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 09:41:38 +08:00
add logic to remove soucemap and merge sourcemap params (#9)
* add logic to remove soucemap and merge sourcemap params * Update bundle.js --------- Co-authored-by: Sunny Luo <sunnylqm@gmail.com>
This commit is contained in:
@@ -87,7 +87,6 @@ async function runReactNativeBundleCommand(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const bundleParams = await checkPlugins();
|
const bundleParams = await checkPlugins();
|
||||||
const minifyOption = bundleParams.minify;
|
|
||||||
const isSentry = bundleParams.sentry;
|
const isSentry = bundleParams.sentry;
|
||||||
const bundleCommand = usingExpo
|
const bundleCommand = usingExpo
|
||||||
? 'export:embed'
|
? 'export:embed'
|
||||||
@@ -126,8 +125,6 @@ async function runReactNativeBundleCommand(
|
|||||||
'--platform',
|
'--platform',
|
||||||
platform,
|
platform,
|
||||||
'--reset-cache',
|
'--reset-cache',
|
||||||
'--minify',
|
|
||||||
minifyOption,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
if (sourcemapOutput) {
|
||||||
@@ -420,7 +417,7 @@ async function pack(dir, output) {
|
|||||||
}
|
}
|
||||||
const childs = fs.readdirSync(root);
|
const childs = fs.readdirSync(root);
|
||||||
for (const name of childs) {
|
for (const name of childs) {
|
||||||
if (name === '.' || name === '..' || name === 'index.bundlejs.map') {
|
if (name === '.' || name === '..' || name === 'index.bundlejs.map' || name === 'index.bundlejs.txt.map') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fullPath = path.join(root, name);
|
const fullPath = path.join(root, name);
|
||||||
@@ -814,14 +811,14 @@ export const commands = {
|
|||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
options.platform || (await question('平台(ios/android/harmony):')),
|
||||||
);
|
);
|
||||||
|
|
||||||
const { bundleName, entryFile, intermediaDir, output, dev } =
|
const { bundleName, entryFile, intermediaDir, output, dev, sourcemap } =
|
||||||
translateOptions({
|
translateOptions({
|
||||||
...options,
|
...options,
|
||||||
platform,
|
platform,
|
||||||
});
|
});
|
||||||
|
|
||||||
const bundleParams = await checkPlugins();
|
const bundleParams = await checkPlugins();
|
||||||
const sourcemap = bundleParams.sourcemap;
|
const sourcemapPlugin = bundleParams.sourcemap;
|
||||||
const isSentry = bundleParams.sentry;
|
const isSentry = bundleParams.sentry;
|
||||||
|
|
||||||
const sourcemapOutput = path.join(intermediaDir, `${bundleName}.map`);
|
const sourcemapOutput = path.join(intermediaDir, `${bundleName}.map`);
|
||||||
@@ -842,7 +839,7 @@ export const commands = {
|
|||||||
entryFile,
|
entryFile,
|
||||||
intermediaDir,
|
intermediaDir,
|
||||||
platform,
|
platform,
|
||||||
sourcemap ? sourcemapOutput : '',
|
sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
||||||
);
|
);
|
||||||
|
|
||||||
await pack(path.resolve(intermediaDir), realOutput);
|
await pack(path.resolve(intermediaDir), realOutput);
|
||||||
|
@@ -2,7 +2,6 @@ import { plugins } from './plugin-config';
|
|||||||
|
|
||||||
interface BundleParams {
|
interface BundleParams {
|
||||||
sentry: boolean;
|
sentry: boolean;
|
||||||
minify: boolean;
|
|
||||||
sourcemap: boolean;
|
sourcemap: boolean;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
@@ -10,7 +9,6 @@ interface BundleParams {
|
|||||||
export async function checkPlugins(): Promise<BundleParams> {
|
export async function checkPlugins(): Promise<BundleParams> {
|
||||||
const params: BundleParams = {
|
const params: BundleParams = {
|
||||||
sentry: false,
|
sentry: false,
|
||||||
minify: true,
|
|
||||||
sourcemap: false,
|
sourcemap: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -3,7 +3,6 @@ import fs from 'fs-extra';
|
|||||||
interface PluginConfig {
|
interface PluginConfig {
|
||||||
name: string;
|
name: string;
|
||||||
bundleParams?: {
|
bundleParams?: {
|
||||||
minify?: boolean;
|
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
detect: () => Promise<boolean>;
|
detect: () => Promise<boolean>;
|
||||||
@@ -14,7 +13,6 @@ export const plugins: PluginConfig[] = [
|
|||||||
name: 'sentry',
|
name: 'sentry',
|
||||||
bundleParams: {
|
bundleParams: {
|
||||||
sentry: true,
|
sentry: true,
|
||||||
minify: false,
|
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
},
|
},
|
||||||
detect: async () => {
|
detect: async () => {
|
||||||
|
Reference in New Issue
Block a user