1const { withSettingsGradle } = require('@expo/config-plugins');
2
3const withSettingsImport = (config, { packageName, packagePath }) => {
4  return withSettingsGradle(config, (config) => {
5    if (config.modResults.language === 'groovy') {
6      if (!config.modResults.contents.includes(`:${packageName}`)) {
7        config.modResults.contents += `
8include(":${packageName}")
9project(":${packageName}").projectDir = new File("${packagePath}")`;
10      }
11    } else {
12      throw new Error(`Cannot setup "${packageName}" because the settings.gradle is not groovy`);
13    }
14    return config;
15  });
16};
17
18module.exports = withSettingsImport;
19