mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-24 17:23:37 +08:00
Support sentry (#8)
* add logic to support sentry * udpate * change reference path * support git commits and version info * udate * add try catch for require.resolve * update upload sourcemap workflow
This commit is contained in:
30
src/utils/check-plugin.ts
Normal file
30
src/utils/check-plugin.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { plugins } from './plugin-config';
|
||||
|
||||
interface BundleParams {
|
||||
sentry: boolean;
|
||||
minify: boolean;
|
||||
sourcemap: boolean;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export async function checkPlugins(): Promise<BundleParams> {
|
||||
const params: BundleParams = {
|
||||
sentry: false,
|
||||
minify: true,
|
||||
sourcemap: false,
|
||||
};
|
||||
|
||||
for (const plugin of plugins) {
|
||||
try {
|
||||
const isEnabled = await plugin.detect();
|
||||
if (isEnabled && plugin.bundleParams) {
|
||||
Object.assign(params, plugin.bundleParams);
|
||||
console.log(`检测到 ${plugin.name} 插件,应用相应打包配置`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`检测 ${plugin.name} 插件时出错:`, err);
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
Reference in New Issue
Block a user