From 45e242435a458193171387a46fa0a22dc7f4e3fa Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Wed, 6 Dec 2023 20:55:01 +0100 Subject: [PATCH] feat: add support for react native 0.73 --- .github/workflows/build-templates.yml | 2 - .../templates/common/$.yarnrc.yml | 3 -- .../templates/common/CONTRIBUTING.md | 2 +- .../templates/common/babel.config.js | 2 +- .../example-legacy/example/babel.config.js | 2 +- .../scripts/pod-install.cjs | 40 ------------------- 6 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 packages/create-react-native-library/templates/native-common-example/scripts/pod-install.cjs diff --git a/.github/workflows/build-templates.yml b/.github/workflows/build-templates.yml index 19c45ddf6..416c3a9e0 100644 --- a/.github/workflows/build-templates.yml +++ b/.github/workflows/build-templates.yml @@ -133,8 +133,6 @@ jobs: touch yarn.lock # Without this Yarn will fail due to the parent directory being a Yarn workspace rm -f example/yarn.lock # Workaround for cached yarn.lock from older version yarn install --no-immutable - env: - POD_INSTALL: 0 - name: Get build target working-directory: ${{ env.work_dir }} diff --git a/packages/create-react-native-library/templates/common/$.yarnrc.yml b/packages/create-react-native-library/templates/common/$.yarnrc.yml index fc9e8529f..13215d637 100644 --- a/packages/create-react-native-library/templates/common/$.yarnrc.yml +++ b/packages/create-react-native-library/templates/common/$.yarnrc.yml @@ -2,9 +2,6 @@ nodeLinker: node-modules nmHoistingLimits: workspaces plugins: -<% if (example === 'native') { -%> - - path: scripts/pod-install.cjs -<% } -%> - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs spec: "@yarnpkg/plugin-interactive-tools" - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs diff --git a/packages/create-react-native-library/templates/common/CONTRIBUTING.md b/packages/create-react-native-library/templates/common/CONTRIBUTING.md index f4691993a..75082eb97 100644 --- a/packages/create-react-native-library/templates/common/CONTRIBUTING.md +++ b/packages/create-react-native-library/templates/common/CONTRIBUTING.md @@ -144,7 +144,7 @@ yarn release The `package.json` file contains various scripts for common tasks: -- `yarn`: setup project by installing dependencies and pods - run with `POD_INSTALL=0` to skip installing pods. +- `yarn`: setup project by installing dependencies. - `yarn typecheck`: type-check files with TypeScript. - `yarn lint`: lint files with ESLint. - `yarn test`: run unit tests with Jest. diff --git a/packages/create-react-native-library/templates/common/babel.config.js b/packages/create-react-native-library/templates/common/babel.config.js index f842b77fc..f7b3da3b3 100644 --- a/packages/create-react-native-library/templates/common/babel.config.js +++ b/packages/create-react-native-library/templates/common/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: ['module:metro-react-native-babel-preset'], + presets: ['module:@react-native/babel-preset'], }; diff --git a/packages/create-react-native-library/templates/example-legacy/example/babel.config.js b/packages/create-react-native-library/templates/example-legacy/example/babel.config.js index adea77bdb..d9addbbab 100644 --- a/packages/create-react-native-library/templates/example-legacy/example/babel.config.js +++ b/packages/create-react-native-library/templates/example-legacy/example/babel.config.js @@ -2,7 +2,7 @@ const path = require('path'); const pak = require('../package.json'); module.exports = { - presets: ['module:metro-react-native-babel-preset'], + presets: ['module:@react-native/babel-preset'], plugins: [ [ 'module-resolver', diff --git a/packages/create-react-native-library/templates/native-common-example/scripts/pod-install.cjs b/packages/create-react-native-library/templates/native-common-example/scripts/pod-install.cjs deleted file mode 100644 index 654c92297..000000000 --- a/packages/create-react-native-library/templates/native-common-example/scripts/pod-install.cjs +++ /dev/null @@ -1,40 +0,0 @@ -const child_process = require('child_process'); - -module.exports = { - name: 'pod-install', - factory() { - return { - hooks: { - afterAllInstalled(project, options) { - if (process.env.POD_INSTALL === '0') { - return; - } - - if ( - options && - (options.mode === 'update-lockfile' || - options.mode === 'skip-build') - ) { - return; - } - - const result = child_process.spawnSync( - 'yarn', - ['pod-install', 'example/ios'], - { - cwd: project.cwd, - env: process.env, - stdio: 'inherit', - encoding: 'utf-8', - shell: true, - } - ); - - if (result.status !== 0) { - throw new Error('Failed to run pod-install'); - } - }, - }, - }; - }, -};