React native update template - react-native

I started my project with a template:
react-native init myApp --templateez-devs
The template has upgraded and I would like to know if there is a way to upgrade my project without be manually.

tl;dr
In a word, no. You'll have to do it manually.
Templates
The templating system is quite dumb it basically creates a new react-native project and then copies the files that are included in the template and then installs the dependencies that have been listed.
As you will undoubtably updated files that were included in the original template, you wouldn't want to just install it over your existing project and hope for the best. That would cause you lots of problems. You may also have installed dependencies that require linking with native code, the template wouldn't specifically know about these changes.
Ways to upgrade
So how can you update to the new template? Well it really depends on what you have done to the project. Unfortunately there is not going to be an easy way to do it.
To see what the major changes are between the templates I would look at the files included in the release that you are currently using, and the release that you plan to use and create a diff this can be done using the following command
diff -ur b a > ba.diff
where a and b are the directories that you are comparing.
Unfortunately the template that you are using doesn't create releases on their github https://github.com/maykonmichel/react-native-template-ez-devs/releases
You could attempt to download them off of their npm page https://www.npmjs.com/package/react-native-template-ez-devs .
Ultimately you can compare the changes on their github by looking at the commit history, you could look at the changelog if it existed, you can also look at the dependency versions that they are using and see if they have differed from the ones that you have used.
You can use github to do your compare
Here is an example of the comparison between the most recent commit and one from a few days before.
https://github.com/maykonmichel/react-native-template-ez-devs/compare/f4ffa06..04a1b8c

Related

How to upgrade Aurelia project from version v0.24.0 to current version v1.2.3

I'm trying to upgrade a very old version of Aurelia CLI project v0.24.0 to the current version v1.2.3. I've tried to follow the steps from this link from the docs but when I try to run it I receive this error:
So my question is what is the best approach to upgrade it from such an old version to the newest one?
Just a screenshot of error is too little info to give proper advice on. And between the currently latest version of v1.2.3 and v0.24.0 (Jan, 2017) there's roughly 3 years. Fun part is, you'd be amazed at relatively how little Aurelia core itself has changed. Simply because a lot remained stable.
Most impactful changes will be in either:
aurelia_project folder, with the build and config routines
bundler config (system.js, webpack, requirejs - whichever you've used)
That being said, this does not necessarily mean that your dependencies have also remained stable in those past three years. Especially in Javascript world. To accommodate for this, I would suggest:
Create a blank, new project with the latest Aurelia CLI
Copy/paste over the /src folder from your old project to your new one
Take in consideration specifics, like package.json from your old project and migrate them by hand (reinstalling) in your new project
Again, try to keep your bundler similar and you will have relatively little changes. But if you choose you want to migrate from System.Js to Webpack, it'll be a bit more hassle. But arguably, rewarding in the end if your project needs to be kept alive for a longer while.
Considering the age of your old project, restarting with a clean setup and config is what I would consider to be "the best way" to retouch only the necessities.

How can I use a fork of react-admin (or one of its packages) in my production environment?

I need a few changes to the ra-core package of the react-admin monorepo on my productive environment.
Can I tell a lerna published module to use my own published module as a submodule instead of it's own?
It's about this package:
https://github.com/marmelab/react-admin
https://www.npmjs.com/package/react-admin
I'm about to create a PR to maybe have these changes merged into the project itself, but I can't know when it will be merged and / or whether it will be even accepted.
But unfortunately I need these changes immediately and it's okay for me to use a fork of mine until it's clear what happens to the PR.
I tried to fork a new ra-core package and use this in my package.json, but this doesn't work. Locally linking is no problem, as I can link it directly in the react-admin module, but I need it in my production build process.
So I'm wondering if there is some way to tell the module in my package.json (react-admin) which comes with it's own subpackages to use one package that I provide in the package.json instead of it's subpackage.

Managing dependencies while working on a react-native library locally

I'm trying to develop a modification to an existing react native library (the library in question is this one, although hopefully the answer to my question will be generally applicable to any library development work. I have an existing application that I would like to use with a modified version of this library. I'm not quite sure how I can set this up so that the library can coexist with the app and both build processes run correctly when the library is modified. I'm happy to run a command to update the app when the library changes, although I'd like to avoid that if possible. In case it's relevant, I'm working on a Mac.
Things I've tried:
Cloned the existing library into a parent directory of my app (so they're project/myapp and project/react-navigation-tabs)
Then used npm link ../react-navigation-tabs from the app directory, which appeared to succesfully set up the link, but when I tried to test the app, the react native packaging server complained that importing "react" was an ambiguous reference (because both project/myapp/node_modules/react and project/react-navigation-tabs/node_modules/react existed)
Removed the link produced in the last step and tried npm install ../react-navigation-tabs instead. This again apparently succeeded, but then the react native packaging server complained that it 'couldn't find preset "react-native" relative to directory "project/react-navigation-tabs"'. The preset in question is installed in the project/myapp/node_modules directory, but it seems that the packager expects it to be installed in both locations.
So:
Is there any way of persuading npm to only install the necessary libraries in one location and share them? Or alternatively install the development dependencies in both locations?
Is there another way of organising the project that will allow me to perform the updates I need without needing to install dependencies in two separate locations? This is complicated by the fact that the library in question will (presumably) need transpiling before it can be used.

What exactly is react-native upgrade command doing? particularly to the gradle files?

I want to understand what the react-native upgrade command is doing, it sometimes changes the gradle files:
android/app/build.gradle
android/settings.gradle
Why does it asks if I want to Y/N to update does files? If I keep answering No is this gonna have bad impact on the application?
The upgrade command is intended to run after updating RN version in existing projects (and after running npm install so the new version is in your node_modules).
Essentially, the command copies all files from the app template which is used to initialize a new RN app. The template is what you get when you run the react-native init command. This is also the reason why it needs to run after the new RN version is installed, because the templates app comes with the react-native dependency itself.
The reason that it asks you if you want to replace each modified file is that it doesn't know why the content has changed. It's possible that you made changes to a file yourself after you initialized your RN app.
If you haven't made any changes - it is safe to replace the existing files; it would be as if you got the file after initializing a new RN app. If you did modify a file - I think that you'd still like to see what changes were made in the new version (they can sometimes be required), in this case you can approve the replace (assuming that you're using source control...) so you can review the changes and in the worst case you can reset them if they're not necessary.
Alternatively, you can use React Native Git Upgrade which can help you resolve conflicts more easily.

Third-Party Code and Git

When developing iOS applications, I frequently use third-party code from GitHub and reusable classes I created myself. What I have been doing is cloning the source code into a specific folder somewhere in ~/Documents, where I kept all the library code. Then I would drag the source files into the Xcode project and code away, with a local Git repository keeping track of the changes in my own source code. So far so good, but I recently found a severe problem: I wanted to switch back to a older version of my Xcode project and found that it did not compile anymore because it used an older version of the third-party code, and nowhere had I stored which version it used!
How is this problem usually solved? I have looked briefly into Git submodules, but I'm not sure if it's the right thing. I also briefly read about CocoaPods, but could I also use that for libraries I created myself?
It is actually solved with git submodule: the idea is to reference an exact commit for each submodule you need, allowing you to go back in the history, and find the coherent set of commits you need for your project to compile then.
(More in this answer)
However, that does require a slight change in your working tree structure, since each submodule would become sub-directories of the parent repo which represents your project.
Note also that it (git submodule) is useful for source dependencies.
CocoaPods would be more for building the binaries you depend on (binary dependency).