Comments (5)
The downside of this approach is that we have to
@blakef you have an unfinished sentence here.
Update a map of some kind between { [react-native-version]: template-version } within the package.json that init can lookup using https://registry.npmjs.org/react-native/latest which is guaranteed to have all reverse lookups.
IMHO this should be the preferred approach. I would not put the map inside the package.json
but inside a file that the init
command can easily access.
The logic could be something like:
- Users requested
init --version 0.75.0-rc.1
- Check if the version mapping is present for the given version
- if yes use the
template
package at the specified version. - if not, align the package to the minor version (so get the highest
0.75.x
version of template you can find).
- if yes use the
- Check if the version mapping is present for the given version
- Users requested
init --version next
(or any other NPM tag)- Resolve the tag and follow the same mapping algorithm mentioned above
from cli.
Do we really need the mapping? Unless there are breaking changes disguised as minor released, it shouldn't be problematic for any 0.75.x
RN version to download any 0.75.y
template. Keeping the mappings is gonna be a hassle for maintenance imho
from cli.
Thanks @cortinico and @thymikee.
@thymikee sure, I guess we can guarantee that template 0.75.<latest>
works with react-native 0.75.<latest>
. If folks want to step outside of that, then they're going to have to know what they're doing.
Upgrade Helper
One thing to consider is that rn-diff-purge assumes that the template and react-native have a 1:1 relationship. This would change that.
We can probably tweak rn-diff-purge to match these using https://registry.npmjs.org/react-native and the npmjs registry data:
curl https://registry.npmjs.org/react-native | jq '.time | with_entries(select(.key | test("-nightly-") | not)) | to_entries | sort_by(.value) | from_entries'
Gives us this:
...
"0.73.4": "2024-02-06T01:41:46.299Z",
"0.74.0-rc.0": "2024-02-21T17:45:56.390Z",
"0.73.5": "2024-02-26T19:11:08.247Z",
"0.71.17": "2024-02-27T02:12:54.109Z",
"0.74.0-rc.1": "2024-02-27T02:18:33.641Z",
"0.72.11": "2024-02-28T18:14:47.759Z",
"0.74.0-rc.2": "2024-03-04T20:50:40.367Z",
"0.73.6": "2024-03-11T10:31:58.694Z",
"0.74.0-rc.3": "2024-03-11T16:10:27.937Z",
"0.72.12": "2024-03-11T17:04:21.206Z",
"0.74.0-rc.4": "2024-03-18T16:31:36.248Z",
"0.74.0-rc.5": "2024-03-25T16:14:40.545Z",
"0.74.0-rc.6": "2024-04-02T12:14:10.038Z",
"modified": "2024-04-02T12:14:10.205Z"
Which we can correlate with template releases and update the rn-diff-purge
's new-release.sh script to more accurately capture the correct react-native:template relationship.
TL;DR / Outcome
We don't need a version table (that would have to be maintained). For projects that may require this, then can match the specified version of react-native
to the template
at the time using npm's API.
from cli.
Realistically, to make sure we have the parity between RN releases and upgrade helper, we should set up some automation that's triggered from RN release webhook and match accordingly. We should also have the freedom to amend those versions for critical bug fixes. Like:
[email protected]
-> (triggers template release) ->@react-native-community/[email protected]
-> (after bugfix) ->@react-native-community/[email protected]
from cli.
Sorry it took me a while to get around to comment here - I have been having mixed feelings about the versioning scheme having to be a 1:1 relationship with the npm react-native
releases but I think that ultimately it is the right call.
Blake, as you mentioned already, upgrade-helper has that as an expectation to work properly, and in a way we also want people to have this template and DX flow to behave exactly as before in order to minimise confusion. So with that in mind I think that even if it might just be a super small change (ex. the version in the package.json) this template should keep the 1:1.
from cli.
Related Issues (20)
- Passing registry for different package managers HOT 5
- Health Check Plugin isn't executed when running `react-native doctor` HOT 2
- react-native run-android: Failed to install the app on the device. Error: Could not find the correct install APK file.
- How to build android release but with JS dev flag enabled?
- On Android, app isn't opened automatically if applicationId is changed HOT 1
- API not working in React native android but working in ios. HOT 1
- Can CRNA change name inside project like NPX react-native init? HOT 1
- ✖ Could not create an empty Git repository, see debug logs with --verbose HOT 2
- Execution failed for task ':app:buildCMakeDebug[x86]' HOT 4
- Stuck at info JS server already running on Linux 22.04 HOT 1
- Unsupported class file major version 66 error. HOT 5
- Error type 3 Error: Activity class {....} does not exist HOT 2
- cannot start Android emulator version 34.1.20.0 (build_id 11610631) HOT 1
- Cannot find module 'execa' when running npx react-native clean
- Android Studio - Required for building and installing your app on Android HOT 16
- (node:23249) [DEP0040] DeprecationWarning: The punycode module is deprecated HOT 5
- error index.js: Cannot read properties of undefined (reading 'match'). HOT 1
- How do you set mode with 'react-native start'? HOT 3
- Error on fresh projects in Lauching app in the emulator, RN -v 0.73 - Starting: intent HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.