oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.46k stars 2.13k forks source link

nx monorepo #1639

Closed johnf closed 3 months ago

johnf commented 4 months ago

Is there a way to use the new version in monorepo projects? Currently the Copy Fonts command from react-native-vector-icons.podspec fails because it cannot find node_modules.

We're using NX as our monorepo solution and, as an example, the folder structure is like so:

I got the application to build by editing PROJECT_ROOT from ${PODS_ROOT}/../.. to ${PODS_ROOT}/../../../.. but this is not feasible in the long-run because this has to be done on every dev environment and after every reinstall.

If you have any pointers or solutions for this, I'd greatly appreciate them. Thank you!

Originally posted by @seliceantitus in https://github.com/oblador/react-native-vector-icons/issues/1612#issuecomment-2239002968

johnf commented 4 months ago

@seliceantitus Are you able to provide the error output. In theory PODS_ROOT should be apps/mobile/ios/Pods would would set PROJECT_ROOT to apps/mobile which is where your package.json should be.

The script then uses resolveNodeModuleDir to workout where node_modules is from there.

Have a quick look at https://github.com/oblador/react-native-vector-icons/blob/monorepo/packages/common/src/scripts/getFonts.ts The PROJECT_ROOT gets passed to that script as the first argument.