react-native-community / cli

The React Native Community CLI - command line tools to help you build RN apps
MIT License
2.4k stars 904 forks source link

Running init with a nightly version doesn't stamp the correct version #2511

Open jonthysell opened 1 month ago

jonthysell commented 1 month ago

Environment

info Fetching system and libraries information... System: OS: Windows 11 10.0.26100 CPU: "(24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores " Memory: 54.54 GB / 63.86 GB Binaries: Node: version: 18.18.0 path: C:\Program Files\nodejs\node.EXE Yarn: version: 3.6.4 path: C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: version: 9.8.1 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: AllowDevelopmentWithoutDevLicense: Enabled AllowAllTrustedApps: Enabled Versions:

Description

I need to be able to create a new project with a specific (nightly) RN version. If I call @react-native-community/cli init with a particular version of RN, I expect the project to use that particular version.

This worked fine before the changes from needing to call @react-native-community/cli instead of react-native and the template being moved into it's own package.

Reproducible Demo

Run

npx --yes @react-native-community/cli@latest init testcsapp --version 0.76.0-nightly-20240901-305b4357e --verbose --skip-install --install-pods false --skip-git-init true

Check package.json, see nightly versions and incorrect CLI dependencies everywhere.

Actual:

"dependencies": {
    "react": "19.0.0-rc-fb9a90fa48-20240614",
    "react-native": "nightly"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "14.0.0-alpha.11",
    "@react-native-community/cli-platform-android": "14.0.0-alpha.11",
    "@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
    "@react-native/babel-preset": "nightly",
    "@react-native/eslint-config": "nightly",
    "@react-native/metro-config": "nightly",
    "@react-native/typescript-config": "nightly",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
    "typescript": "5.0.4"
  },

Expected:

"dependencies": {
    "react": "19.0.0-rc-fb9a90fa48-20240614",
-    "react-native": "nightly"
+    "react-native": "0.76.0-nightly-20240901-305b4357e"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
-    "@react-native-community/cli": "14.0.0-alpha.11",
+    "@react-native-community/cli": "14.0.0",
-    "@react-native-community/cli-platform-android": "14.0.0-alpha.11",
+    "@react-native-community/cli-platform-android": "14.0.0",
-    "@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
+    "@react-native-community/cli-platform-ios": "14.0.0",
-    "@react-native/babel-preset": "nightly",
+    "@react-native/babel-preset": "0.76.0-nightly-20240901-305b4357e",
-    "@react-native/eslint-config": "nightly",
+    "@react-native/eslint-config": "0.76.0-nightly-20240901-305b4357e",
-    "@react-native/metro-config": "nightly",
+    "@react-native/metro-config": "0.76.0-nightly-20240901-305b4357e",
-    "@react-native/typescript-config": "nightly",
+    "@react-native/typescript-config": "0.76.0-nightly-20240901-305b4357e",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
    "typescript": "5.0.4"
  },
szymonrybczak commented 1 month ago

hey @jonthysell!

Regarding CLI version I just created a bump Pull Request inside template repo, so nightlies will pull correct version: https://github.com/react-native-community/template/pull/58 👍

Regarding nightly version - @blakef, could you please jump in here? :pray: