-
-
Notifications
You must be signed in to change notification settings - Fork 197
Provide a React NativeScript based template through the CLI #4964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @etabakov , @shirakaba, I would like to share some information how NativeScript CLI works with So, getting back to the idea of having a React template - I think it is achievable even now. Here's my suggestion:
Regarding publishing the template in And one last thing about the template you've created (https://github.com/shirakaba/react-nativescript-starter/blob/ceae8b22d58f31dd02c8f924180e7818abf8847e/mycoolapp/package.json#L3) - in order to make it work with What do you think for this approach? |
Hi Rosen, thanks for those instructions. That approach can work fine. I’m on the phone so can’t investigate easily. I’m not sure exactly which parts of my starter app repo would need to be published to npm (i.e. what files should I include/ignore in the package, and is Also, at the moment any user’s app is going to be made as “mycoolapp”, with a corresponding app ID, if they use my template. Do I need to change anything in my starter app repo’s package.json to make the name customisable, or is it implicitly handled by the CLI? Thanks. |
Hey @shirakaba , During project creation CLI automatically replaces the id from the package.json with a calculated one based on the users input, i.e. when you run:
CLI will use the template and at one of the final steps, it will set the id inside package.json to be Regarding the files that should be published, the package that will be published in At the end of project creation CLI executes a special hook called after-projectCreate - by using it you can add additional logic in your template, for example in case you want to automatically add So, regarding the structure, I would recommend moving all files at the top of your GitHub repository. This will allow users to execute About the naming of the package, it depends on you - our templates are named About the versioning, as I've explained in my previous comment, I strongly recommend you to use the versionning mechanism that we are currently using for our templates, i.e. set your version in the package.json to 6.0.0 (as it currently uses 6.0.x versions of tns-core-modules, tns-android and tns-ios). Finally, as I'm not sure I've explained everything perfectly, I've prepared a PR (shirakaba/tns-template-blank-react#1) to your template, that you can check. I've tried to explain all changes in the commits, so you can have a better understanding why I've changed something. Hope it helps. |
@rosen-vladimirov Thank you very much for the PR! The commits are immensely helpful. I'll look over it in detail later – my next two weeks are very busy, but I might have a spare moment at some point in the coming days. |
If I publish for version I hope to sit down with this over the weekend. |
Hey @shirakaba , |
@shirakaba you can reference |
@rosen-vladimirov I've finished making a blank starter, which even supports HMR! Thank you for your patience. Incidentally, I've renamed the project to Creating an app from the repo master ✅tns create appFromMaster --template https://github.com/shirakaba/tns-template-blank-react/tarball/master
cd appFromMaster
# This works perfectly!
tns run ios Creating an app from the released package ❌tns create appFromRelease --template tns-template-blank-react
cd appFromRelease
# This fails to build, as it doesn't copy my webpack.config.js
tns run ios Can you advise as to why |
Hey @shirakaba ,
|
Ah, makes sense! I've included that now and republished the template (as Should I do anything to suppress these CLI warnings, or are they unavoidable?
|
@shirakaba , I'm glad you managed to create a react-nativescript template. Great work! |
Hey @shirakaba , |
Thank you! I've just released RNS v0.18.0 with support for NativeScript 6.4.0 and have published an updated template which incorporates that updated RNS version. |
Is your feature request related to a problem? Please describe.
A user should be able to start quickly with a React NativeScript project from the CLI.
Describe the solution you'd like
tns create
should be able to use a React NativeScript template to start my project from. The template should be available in the interactive prompt or through the CLI optionsDescribe alternatives you've considered
An alternative is to start with a React NativeScript template in the Playground, which is also going to be evaluated.
Additional context
The template to be used is proved by @shirakaba in a dedicated repository.
The text was updated successfully, but these errors were encountered: