Last active
March 21, 2025 11:04
-
-
Save jarredkenny/b5763f63dc91f1cf862f4b12fdcaed0d to your computer and use it in GitHub Desktop.
Expo Local Maven Dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ConfigContext, ExpoConfig } from "@expo/config"; | |
import withCustomMavenRepo from "@myorg/package/withCustomMavenRepo"; | |
import pkg from "./package.json"; | |
export default ({ config }: ConfigContext): ExpoConfig => | |
withCustomMavenRepo({ | |
...config, | |
name: "the-app", | |
version: pkg.version, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./.npmignore | |
./CHANGELOG.md | |
./dist | |
./dist/ScanBridgeModule.js | |
./dist/ScanBridgeModule.web.d.ts.map | |
./dist/index.js | |
./dist/ScanBridgeModule.web.js | |
./dist/ScanBridgeModule.d.ts | |
./dist/ScanBridgeModule.web.d.ts | |
./dist/ScanBridgeModule.js.map | |
./dist/index.js.map | |
./dist/ScanBridgeModule.web.js.map | |
./dist/index.d.ts | |
./dist/index.d.ts.map | |
./dist/ScanBridgeModule.d.ts.map | |
./node_modules | |
./node_modules/@types | |
./expo-module.config.json | |
./eas.json | |
./README.md | |
./.turbo | |
./.turbo/turbo-typecheck.log | |
./.turbo/turbo-test.log | |
./.turbo/turbo-lint.log | |
./.turbo/turbo-compile.log | |
./withCustomMavenRepo.js | |
./.gitignore | |
./package.json | |
./android | |
./android/local-maven-repo | |
./android/local-maven-repo/com | |
./android/local-maven-repo/com/tracktile | |
./android/local-maven-repo/com/tracktile/chainway-p80-sdk | |
./android/local-maven-repo/com/tracktile/chainway-p80-sdk/1.0.0 | |
./android/local-maven-repo/com/tracktile/chainway-p80-sdk/1.0.0/chainway-p80-sdk-1.0.0.pom | |
./android/local-maven-repo/com/tracktile/chainway-p80-sdk/1.0.0/chainway-p80-sdk-1.0.0.aar | |
./android/build.gradle | |
./android/src | |
./android/src/main | |
./android/src/main/AndroidManifest.xml | |
./android/src/main/java | |
./android/src/main/java/expo | |
./android/src/main/java/expo/modules | |
./android/src/main/java/expo/modules/scanbridge | |
./android/src/main/java/expo/modules/scanbridge/ScanBridgeModule.kt | |
./.eslintrc.js | |
./tsconfig.json | |
./src | |
./src/ScanBridgeModule.ts | |
./src/index.ts | |
./src/ScanBridgeModule.web.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { withDangerousMod } = require("@expo/config-plugins"); | |
const fs = require("fs"); | |
const path = require("path"); | |
const withCustomMavenRepo = (config) => { | |
return withDangerousMod(config, [ | |
"android", | |
async (config) => { | |
const filePath = path.join( | |
config.modRequest.platformProjectRoot, | |
"build.gradle" | |
); | |
let fileContents = await fs.promises.readFile(filePath, "utf8"); | |
// Define the Maven repository string | |
// const mavenRepoString = ` maven { url uri('${repoPath}') }\n`; | |
const mavenRepoString = ` maven { url uri("$\{rootDir\}/../../../packages/scan-bridge/android/local-maven-repo") }\n`; | |
// Insert the Maven repo line in the allprojects -> repositories block | |
const repositoriesRegex = /(allprojects\s*\{\s*repositories\s*\{)/; | |
fileContents = fileContents.replace( | |
repositoriesRegex, | |
`$1\n${mavenRepoString}` | |
); | |
// Write the modified contents back to the file | |
await fs.promises.writeFile(filePath, fileContents, "utf8"); | |
return config; | |
}, | |
]); | |
}; | |
module.exports = withCustomMavenRepo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment