Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 64 additions & 30 deletions .github/scripts/UpgradeSmokeTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

param(
[string]$RnwVersion = "latest",
[bool]$UpgradeCli = $False,
[bool]$UpgradeRnOrg = $False,
[bool]$Force = $False
)

Expand Down Expand Up @@ -40,6 +42,48 @@ Function Compare-SemVer([string]$Left, [string]$Right) {
return $Result
}

Function Upgrade-Package([string]$DependencyName, [string]$DependencyVersion) {
$yarnUpgradeCmd = "upgrade"
if (Test-Path ".yarn") {
$yarnUpgradeCmd = "up"
}

Write-Host -NoNewline "Upgrading to $DependencyName@$DependencyVersion..."
yarn $yarnUpgradeCmd $DependencyName@$DependencyVersion | Out-Null

if ($LastExitCode -ne 0) {
Write-Host " failed."
Write-Error "Failed to upgrade to $DependencyName@$DependencyVersion"
exit $LastExitCode
}

Write-Host " success."
}

Function Get-DependencyVersion([string]$PackageName, [string]$PackageVersion, [string]$DependencyName) {
[string]$DependencyVersion = npm info $PackageName@$PackageVersion dependencies.$DependencyName
Write-Host "Package $PackageName@$PackageVersion depends on $DependencyName@$DependencyVersion"
return $DependencyVersion
}

Function Get-DevDependencyVersion([string]$PackageName, [string]$PackageVersion, [string]$DependencyName) {
[string]$DependencyVersion = npm info $PackageName@$PackageVersion devDependencies.$DependencyName
Write-Host "Package $PackageName@$PackageVersion dev depends on $DependencyName@$DependencyVersion"
return $DependencyVersion
}

Function Upgrade-RnwDependency([string]$RnwVersion, [string]$DependencyName) {
[string]$DependencyVersion = Get-DependencyVersion 'react-native-windows' $RnwVersion $DependencyName

Upgrade-Package $DependencyName $DependencyVersion
}

Function Upgrade-RnwDevDependency([string]$RnwVersion, [string]$DependencyName) {
[string]$DependencyVersion = Get-DevDependencyVersion 'react-native-windows' $RnwVersion $DependencyName

Upgrade-Package $DependencyName $DependencyVersion
}

Write-Host "UpgradeSmokeTest -RnwVersion $RnwVersion"

[string]$LocalRnwVersion = $null
Expand Down Expand Up @@ -89,39 +133,29 @@ if ($Force) {
Write-Host "Starting upgrade..."
}

[string]$ReactVersion = npm info react-native-windows@$TargetRnwVersion devDependencies.react
Write-Host "RNW $TargetRnwVersion depends on react@$ReactVersion"

[string]$ReactNativeVersion = npm info react-native-windows@$TargetRnwVersion devDependencies.react-native
Write-Host "RNW $TargetRnwVersion depends on react-native@$ReactNativeVersion"

$yarnUpgradeCmd = "upgrade"
if (Test-Path ".yarn") {
$yarnUpgradeCmd = "up"
}

Write-Host "Upgrading to react@$ReactVersion..."
yarn $yarnUpgradeCmd react@$ReactVersion

if ($LastExitCode -ne 0) {
Write-Error "Failed to upgrade to react @$ReactVersion"
exit $LastExitCode
# Upgrade based on RNW dev dependencies
Upgrade-RnwDevDependency $TargetRnwVersion 'react'
Upgrade-RnwDevDependency $TargetRnwVersion 'react-native'
Upgrade-RnwDevDependency $TargetRnwVersion 'react'
Upgrade-RnwDevDependency $TargetRnwVersion '@types/react'

# Upgrade based on RNW dependencies
if ($UpgradeCli) {
Upgrade-RnwDependency $TargetRnwVersion '@react-native-community/cli'
Upgrade-RnwDependency $TargetRnwVersion '@react-native-community/cli-platform-android'
Upgrade-RnwDependency $TargetRnwVersion '@react-native-community/cli-platform-ios'
}

Write-Host "Upgrading to react-native@$ReactNativeVersion..."
yarn $yarnUpgradeCmd react-native@$ReactNativeVersion

if ($LastExitCode -ne 0) {
Write-Error "Failed to upgrade to react-native@$ReactNativeVersion"
exit $LastExitCode
# Upgrade @react-native/* dependencies based on react-native
if ($UpgradeRnOrg) {
[string]$RnVersion = Get-DevDependencyVersion 'react-native-windows' $RnwVersion 'react-native'
Upgrade-Package '@react-native/metro-config' "^$($RnVersion.Substring(0, 4)).0"
Upgrade-Package '@react-native/babel-preset' "^$($RnVersion.Substring(0, 4)).0"
Upgrade-Package '@react-native/eslint-config' "^$($RnVersion.Substring(0, 4)).0"
Upgrade-Package '@react-native/typescript-config' "^$($RnVersion.Substring(0, 4)).0"
}

Write-Host "Upgrading to react-native-windows@$TargetRnwVersion..."
yarn $yarnUpgradeCmd react-native-windows@$TargetRnwVersion

if ($LastExitCode -ne 0) {
Write-Error "Failed to upgrade to react-native-windows@$TargetRnwVersion"
exit $LastExitCode
}
# Upgrade RNW itself
Upgrade-Package 'react-native-windows' $TargetRnwVersion

exit 0
15 changes: 14 additions & 1 deletion samples/NativeModuleSample/cpp-lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,17 @@ yarn example-old windows

### Upgrade

**TODO**
First run the **Setup** steps above. Then run the `UpgradeSmokeTest.ps1` script with the target RNW version (usually `latest`):

```ps1
..\..\..\.github\scripts\UpgradeSmokeTest.ps1 latest $True $True $True
```

Then call the following to update the JS and codegen with:

```cmd
yarn prepare
yarn codegen-windows
```

Finally, build and verify *both* example apps as per the **Run** steps above. If both apps work without issue, then go ahead and submit the PR with your changes.
15 changes: 7 additions & 8 deletions samples/NativeModuleSample/cpp-lib/example-old/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"test:windows": "jest --config jest.config.windows.js"
},
"dependencies": {
"react": "18.3.1",
"react-native": "0.76.0",
"react-native-windows": "0.76.0"
"react": "19.0.0",
"react-native": "0.78.0",
"react-native-windows": "0.78.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand All @@ -19,11 +19,10 @@
"@react-native-community/cli": "15.0.0-alpha.2",
"@react-native-community/cli-platform-android": "15.0.0-alpha.2",
"@react-native-community/cli-platform-ios": "15.0.0-alpha.2",
"@react-native/babel-preset": "0.76.0",
"@react-native/metro-config": "0.76.0",
"@react-native/typescript-config": "0.76.0",
"@rnx-kit/jest-preset": "^0.1.17",
"metro-config": "^0.81.0"
"@react-native/babel-preset": "0.78.0",
"@react-native/metro-config": "0.78.0",
"@react-native/typescript-config": "0.78.0",
"@rnx-kit/jest-preset": "^0.1.17"
},
"engines": {
"node": ">=18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
},
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.ReactNative.Cxx": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "MYmg+K4RF/XOyKu4pPmE4IlLFR3oDwh2LmikAedyBqkCoLFGZVuxQ1apPVZKZXlLoABaXHl/Nc36ZHV2sNxI8w==",
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "b37+ruqhuA/HCi8TYVAcklgSdiBUhHyU3/0RJbcdWSyXrACVY10pTGR4tgzFjU8APwl5hAR+Q8zBj2ObMnkK1A==",
"dependencies": {
"Microsoft.ReactNative": "0.76.0"
"Microsoft.ReactNative": "0.78.2"
}
},
"Microsoft.UI.Xaml": {
Expand All @@ -46,18 +46,18 @@
"nativemodulesample": {
"type": "Project",
"dependencies": {
"Microsoft.ReactNative": "[0.76.0, )",
"Microsoft.ReactNative.Cxx": "[0.76.0, )",
"Microsoft.ReactNative": "[0.78.2, )",
"Microsoft.ReactNative.Cxx": "[0.78.2, )",
"Microsoft.UI.Xaml": "[2.8.0, )"
}
}
},
"native,Version=v0.0/win10-arm": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand All @@ -68,9 +68,9 @@
"native,Version=v0.0/win10-arm-aot": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand All @@ -81,9 +81,9 @@
"native,Version=v0.0/win10-arm64-aot": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand All @@ -94,9 +94,9 @@
"native,Version=v0.0/win10-x64": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand All @@ -107,9 +107,9 @@
"native,Version=v0.0/win10-x64-aot": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand All @@ -120,9 +120,9 @@
"native,Version=v0.0/win10-x86": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand All @@ -133,9 +133,9 @@
"native,Version=v0.0/win10-x86-aot": {
"Microsoft.ReactNative": {
"type": "Direct",
"requested": "[0.76.0, )",
"resolved": "0.76.0",
"contentHash": "Ro7YU/18AD1SI4+W04EhGfPLnpc9k58Dy9i5xLoC0b/NlOBz/ahWzuOgXimOMQHG1tnoBoIasNBIovZQe4svaA=="
"requested": "[0.78.2, )",
"resolved": "0.78.2",
"contentHash": "dC8qT8Y7PX8LmOfSE+Xh3Mt6a7r7EHx1wO6mI3ZGU9kTahqtf759fE0oatydEgvCvugYvZIu0BFarZpvVSOmhA=="
},
"Microsoft.Web.WebView2": {
"type": "Transitive",
Expand Down
12 changes: 6 additions & 6 deletions samples/NativeModuleSample/cpp-lib/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"test:windows": "jest --config jest.config.windows.js"
},
"dependencies": {
"react": "18.3.1",
"react-native": "0.76.0",
"react-native-windows": "0.76.0"
"react": "19.0.0",
"react-native": "0.78.0",
"react-native-windows": "0.78.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand All @@ -19,9 +19,9 @@
"@react-native-community/cli": "15.0.0-alpha.2",
"@react-native-community/cli-platform-android": "15.0.0-alpha.2",
"@react-native-community/cli-platform-ios": "15.0.0-alpha.2",
"@react-native/babel-preset": "0.76.0",
"@react-native/metro-config": "0.76.0",
"@react-native/typescript-config": "0.76.0",
"@react-native/babel-preset": "0.78.0",
"@react-native/metro-config": "0.78.0",
"@react-native/typescript-config": "0.78.0",
"@rnx-kit/jest-preset": "^0.1.17"
},
"engines": {
Expand Down
Loading