From c390c3278869df4df54b7831b515c91536cee4f0 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Dec 2024 04:00:27 +0000 Subject: [PATCH] Remove unreliable repository (#7176) --- app.config.js | 1 + plugins/withAndroidNoJitpackPlugin.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 plugins/withAndroidNoJitpackPlugin.js diff --git a/app.config.js b/app.config.js index 630ea5ad8c..1461b7b885 100644 --- a/app.config.js +++ b/app.config.js @@ -232,6 +232,7 @@ module.exports = function (config) { './plugins/withAndroidManifestFCMIconPlugin.js', './plugins/withAndroidStylesAccentColorPlugin.js', './plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js', + './plugins/withAndroidNoJitpackPlugin.js', './plugins/shareExtension/withShareExtensions.js', './plugins/notificationsExtension/withNotificationsExtension.js', './plugins/withAppDelegateReferrer.js', diff --git a/plugins/withAndroidNoJitpackPlugin.js b/plugins/withAndroidNoJitpackPlugin.js new file mode 100644 index 0000000000..959eb10282 --- /dev/null +++ b/plugins/withAndroidNoJitpackPlugin.js @@ -0,0 +1,20 @@ +const {withProjectBuildGradle} = require('@expo/config-plugins') + +const jitpackRepository = "maven { url 'https://www.jitpack.io' }" + +module.exports = function withAndroidNoJitpackPlugin(config) { + return withProjectBuildGradle(config, config => { + if (!config.modResults.contents.includes(jitpackRepository)) { + throw Error( + 'Expected to find the jitpack string in the config. ' + + 'You MUST verify whether it was actually removed upstream, ' + + 'or if the format has changed and this plugin no longer recognizes it.', + ) + } + config.modResults.contents = config.modResults.contents.replaceAll( + jitpackRepository, + '', + ) + return config + }) +}