jamonholmgren / react-native-colo-loco

Colocate your native modules and components with your JavaScript/JSX files.
293 stars 12 forks source link

Add support for MainApplication.kt #31

Open joshuayoes opened 9 months ago

joshuayoes commented 9 months ago

How to reproduce:

  1. npx ignite-cli@latest new
  2. npx install-colo-loco

Gets the following error:

npx install-colo-loco
Setting up React Native Colo Loco!
App name? [AdvancedContacts]
Source folder? [app]
App package name? [com.advancedcontacts]
Setting up React Native Colo Loco for AdvancedContacts in app
node:internal/readline/emitKeypressEvents:74
            throw err;
            ^

Error: ENOENT: no such file or directory, open './android/app/src/main/java/com/advancedcontacts/MainApplication.java'
    at Object.openSync (node:fs:599:3)
    at Object.readFileSync (node:fs:467:35)
    at setupAndroid (/Users/joshuayoes/Code/AdvancedContacts/node_modules/react-native-colo-loco/scripts/install-colo-loco:216:38)
    at Interface.setupColoLoco (/Users/joshuayoes/Code/AdvancedContacts/node_modules/react-native-colo-loco/scripts/install-colo-loco:95:3)
    at Interface.emit (node:events:525:35)
    at Interface.close (node:internal/readline/interface:536:10)
    at /Users/joshuayoes/Code/AdvancedContacts/node_modules/react-native-colo-loco/scripts/install-colo-loco:80:14
    at [_onLine] [as _onLine] (node:internal/readline/interface:423:7)
    at [_line] [as _line] (node:internal/readline/interface:886:18)
    at [_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1264:22) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: './android/app/src/main/java/com/advancedcontacts/MainApplication.java'
}

Node.js v18.7.0

Expo 50 now creates android/app/src/main/java/com/advancedcontacts/MainApplication.kt instead of android/app/src/main/java/com/advancedcontacts/MainApplication.java.

We need to add support for detecting if there is a .java or .kt entrypoint here https://github.com/jamonholmgren/react-native-colo-loco/blob/main/scripts/install-colo-loco#L215

jamonholmgren commented 9 months ago

Hm, not sure I have time to tackle this right now. Do we also need a MyAppPackage.kt instead of MyAppPackage.java if it's a Kotlin project?