Skip to content

Commit

Permalink
Fix missing TS dependency for RN < 0.71 (#272)
Browse files Browse the repository at this point in the history
Now that typescript types are included in RN, they've deprecated the
package `@types/react-native`, which unfortunately breaks creating new
test apps for RN < 0.71 because RNX needs the types to do its codegen
and they're no longer available.

This PR fixes our CI/PR workflows to use the typescript templates for
the older versions so we get typescript and the proper RN types.
  • Loading branch information
jonthysell authored Feb 2, 2024
1 parent 1a36e8c commit 511b107
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,42 @@ jobs:
strategy:
fail-fast: false
matrix:
rnwVersion: [ '0.71-stable', 'latest'] # test *all* versions that use VS 2022. aka any RNW version >= min in package.json and >= 0.71
rnwVersion: [ '0.72-stable', '0.71-stable'] # test *all* versions that use VS 2022. aka any RNW version >= min in package.json and >= 0.71
useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet
include:
- rnwVersion: '0.72-stable'
rnTemplate: 'react-native@0.72-stable'
- rnwVersion: '0.71-stable'
rnTemplate: 'react-native@0.71-stable'
uses: ./.github/workflows/template-testcli.yml
with:
vmImage: windows-2022
rnwVersion: ${{ matrix.rnwVersion }}
useRnwNuGet: ${{ matrix.useRnwNuGet }}
rnTemplate: ${{ matrix.rnTemplate }}

call-testcli-old:
name: Test CLI (VS 2019)
strategy:
fail-fast: false
matrix:
rnwVersion: ['0.67-stable', '0.68-stable', '0.69-stable', '0.70-stable'] # test *all* versions that use VS 2019. aka any RNW version >= min in package.json and < 0.71
rnwVersion: ['0.70-stable', '0.69-stable', '0.68-stable', '0.67-stable'] # test *all* versions that use VS 2019. aka any RNW version >= min in package.json and < 0.71
useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet
include:
- rnwVersion: '0.70-stable'
rnTemplate: 'react-native-template-typescript@6.12.11'
- rnwVersion: '0.69-stable'
rnTemplate: 'react-native-template-typescript@6.11.9'
- rnwVersion: '0.68-stable'
rnTemplate: 'react-native-template-typescript@6.10.4'
- rnwVersion: '0.67-stable'
rnTemplate: 'react-native-template-typescript@6.9.6'
uses: ./.github/workflows/template-testcli.yml
with:
vmImage: windows-2019
rnwVersion: ${{ matrix.rnwVersion }}
useRnwNuGet: ${{ matrix.useRnwNuGet }}
rnTemplate: ${{ matrix.rnTemplate }}

call-buildnpmpackage:
name: Build NPM Package
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,39 @@ jobs:
strategy:
fail-fast: true
matrix:
rnwVersion: ['0.71-stable', 'latest'] # test *key* versions that use VS 2022. aka any RNW version >= 0.71 used by supported partners and/or Active/Maintenance from https://microsoft.github.io/react-native-windows/support
rnwVersion: ['0.72-stable', '0.71-stable'] # test *key* versions that use VS 2022. aka any RNW version >= 0.71 used by supported partners and/or Active/Maintenance from https://microsoft.github.io/react-native-windows/support
useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet
include:
- rnwVersion: '0.72-stable'
rnTemplate: 'react-native@0.72-stable'
- rnwVersion: '0.71-stable'
rnTemplate: 'react-native@0.71-stable'
uses: ./.github/workflows/template-testcli.yml
with:
vmImage: windows-2022
rnwVersion: ${{ matrix.rnwVersion }}
useRnwNuGet: ${{ matrix.useRnwNuGet }}
rnTemplate: ${{ matrix.rnTemplate }}

call-testcli-old:
name: Test CLI (VS 2019)
needs: setupcheck
strategy:
fail-fast: true
matrix:
rnwVersion: ['0.67-stable', '0.69-stable'] # test *key* versions that use VS 2019. aka any RNW version < 0.71 that are used by supported partners
rnwVersion: ['0.69-stable', '0.67-stable'] # test *key* versions that use VS 2019. aka any RNW version < 0.71 that are used by supported partners
useRnwNuGet: [false, true] # test building with both RNW source and RNW NuGet
include:
- rnwVersion: '0.69-stable'
rnTemplate: 'react-native-template-typescript@6.11.9'
- rnwVersion: '0.67-stable'
rnTemplate: 'react-native-template-typescript@6.9.6'
uses: ./.github/workflows/template-testcli.yml
with:
vmImage: windows-2019
rnwVersion: ${{ matrix.rnwVersion }}
useRnwNuGet: ${{ matrix.useRnwNuGet }}
rnTemplate: ${{ matrix.rnTemplate }}

call-buildnpmpackage:
name: Build NPM Package
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/template-testcli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
required: false
default: false
type: boolean
rnTemplate:
required: false
default: 'react-native@latest'
type: string

jobs:
testcli:
Expand All @@ -34,7 +38,7 @@ jobs:
working-directory: package

- name: create react-native@${{ inputs.rnwVersion }} app
run: npx react-native init testrnx --template react-native@${{ inputs.rnwVersion }}
run: npx react-native init testrnx --template ${{ inputs.rnTemplate }}
working-directory: ../

- name: add Windows (RNW via ${{ inputs.useRnwNuGet && 'NuGet' || 'Source' }})
Expand Down

0 comments on commit 511b107

Please sign in to comment.