about summary refs log tree commit diff
path: root/plugins/withAndroidNoJitpackPlugin.js
blob: 959eb102829eeb01cc4da17cb13e0644bf19a5c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
  })
}