You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to include and use @react-native-community/cli in tools such as create-react-native-module and react-native-module-init to generate an example project rather than relying on the user to install some version of the CLI. This was suggested in brody4hire/create-react-native-module#204.
One solution would be to use a utility such as execa to spawn and wait for the CLI to generate the example project. But I think it would be smoother to simply import and call a function in @react-native-community/cli to generate the example project.
When I tried using this exported function in create-react-native-module I was not happy with the result due to the lack of flexibility, as in this abandoned PR: brody4hire/create-react-native-module#420
Another disadvantage is that react-native would be needed as a peer dependency.
There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
Describe the Feature
Background
I would like to include and use
@react-native-community/cli
in tools such ascreate-react-native-module
andreact-native-module-init
to generate an example project rather than relying on the user to install some version of the CLI. This was suggested in brody4hire/create-react-native-module#204.One solution would be to use a utility such as
execa
to spawn and wait for the CLI to generate the example project. But I think it would be smoother to simply import and call a function in@react-native-community/cli
to generate the example project.@react-native-community/cli
does export aninit
function but it seems to point into an internalinitCompat
module: https://github.com/react-native-community/cli/blob/v5.0.1-alpha.2/packages/cli/src/index.ts#L11This exported function seems to assume that it should generate the project based on the React Native template in node_modules: https://github.com/react-native-community/cli/blob/v5.0.1-alpha.2/packages/cli/src/tools/generator/templates.ts#L25
When I tried using this exported function in
create-react-native-module
I was not happy with the result due to the lack of flexibility, as in this abandoned PR: brody4hire/create-react-native-module#420Another disadvantage is that
react-native
would be needed as a peer dependency.Requested feature
Export a better init function that allows a different React Native version such as [email protected] or the wonderful react-native-tvos fork. Here is the function that I would like to use: https://github.com/react-native-community/cli/blob/v5.0.1-alpha.2/packages/cli/src/commands/init/init.ts#L196-L220
Temporary workaround
I made https://github.com/brodybits/react-native-init-func with the following workaround in its
index.js
:Possible Implementations
Simply export a function such as https://github.com/react-native-community/cli/blob/v5.0.1-alpha.2/packages/cli/src/commands/init/init.ts#L196-L220
Related Issues
N/A
The text was updated successfully, but these errors were encountered: