26 lines
740 B
JavaScript
26 lines
740 B
JavaScript
import { readFile, writeFile } from 'node:fs/promises'
|
|
import { resolve } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
async function main() {
|
|
const scriptDir = fileURLToPath(new URL('.', import.meta.url))
|
|
const mobileRoot = resolve(scriptDir, '..')
|
|
const appGradle = resolve(mobileRoot, 'android', 'app', 'build.gradle')
|
|
|
|
let text = await readFile(appGradle, 'utf8')
|
|
const before = "implementation project(':capacitor-android')"
|
|
const after = 'implementation "com.capacitorjs:core:7.6.2"'
|
|
|
|
if (text.includes(after)) return
|
|
if (!text.includes(before)) return
|
|
|
|
text = text.replace(before, after)
|
|
await writeFile(appGradle, text, 'utf8')
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err)
|
|
process.exit(1)
|
|
})
|
|
|