diff --git a/.github/workflows/build-templates.yml b/.github/workflows/build-templates.yml index c5a1de290..a92e5b016 100644 --- a/.github/workflows/build-templates.yml +++ b/.github/workflows/build-templates.yml @@ -22,8 +22,8 @@ jobs: fail-fast: false matrix: os: - - ubuntu - - macos + - ubuntu-20.04 + - macos-12 type: - module-legacy - module-mixed @@ -37,9 +37,9 @@ jobs: - kotlin-objc - kotlin-swift exclude: - - os: macos + - os: macos-12 language: kotlin-objc - - os: macos + - os: macos-12 language: kotlin-swift - type: module-new language: java-swift @@ -58,25 +58,25 @@ jobs: - type: view-mixed language: kotlin-swift include: - - os: ubuntu + - os: ubuntu-20.04 type: library language: js - - os: ubuntu + - os: ubuntu-20.04 type: module-legacy language: cpp - - os: ubuntu + - os: ubuntu-20.04 type: module-mixed language: cpp - - os: ubuntu + - os: ubuntu-20.04 type: module-new language: cpp - - os: macos + - os: macos-12 type: module-legacy language: cpp - - os: macos + - os: macos-12 type: module-mixed language: cpp - - os: macos + - os: macos-12 type: module-new language: cpp @@ -84,7 +84,7 @@ jobs: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.type }}-${{ matrix.language }} cancel-in-progress: true - runs-on: ${{ matrix.os }}-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -102,6 +102,8 @@ jobs: echo "work_dir=${{ matrix.os }}-${{ matrix.type }}-${{ matrix.language }}" >> $GITHUB_ENV - name: Create library + env: + USE_YARN: 1 run: | rm -rf ${{ env.work_dir }} # Workaround for tests failing intermittently ./packages/create-react-native-library/bin/create-react-native-library ${{ env.work_dir }} \ diff --git a/packages/create-react-native-library/src/utils/generateExampleApp.ts b/packages/create-react-native-library/src/utils/generateExampleApp.ts index de52dcb3e..0b372a524 100644 --- a/packages/create-react-native-library/src/utils/generateExampleApp.ts +++ b/packages/create-react-native-library/src/utils/generateExampleApp.ts @@ -79,11 +79,19 @@ export default async function generateExampleApp({ '--version', reactNativeVersion, '--skip-install', - '--npm', ] : // `npx create-expo-app example --no-install` ['create-expo-app@latest', directory, '--no-install']; + if (type === 'native') { + if (!process.env.USE_YARN) { + console.debug('Using React Native CLI with npm to create example app'); + args.push('--npm'); + } else { + console.debug('Using React Native CLI with Yarn to create example app'); + } + } + await spawn('npx', args, { cwd: dest, env: { ...process.env, npm_config_yes: 'true' },