diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f8603d6a..3866e1386 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,9 +58,7 @@ jobs: distribution: 'zulu' java-version: 17 - - uses: gradle/gradle-build-action@v2 - with: - gradle-version: 8.0.1 + - uses: gradle/actions/setup-gradle@v3 - uses: ruby/setup-ruby@v1 if: runner.os == 'macOS' diff --git a/__e2e__/__snapshots__/config.test.ts.snap b/__e2e__/__snapshots__/config.test.ts.snap index de4d477f0..b2b7c4c2a 100644 --- a/__e2e__/__snapshots__/config.test.ts.snap +++ b/__e2e__/__snapshots__/config.test.ts.snap @@ -4,7 +4,7 @@ exports[`shows up current config without unnecessary output 1`] = ` { "root": "<>/TestProject", "reactNativePath": "<>/TestProject/node_modules/react-native", - "reactNativeVersion": "0.73", + "reactNativeVersion": "0.74", "dependencies": {}, "commands": [ { @@ -72,6 +72,12 @@ exports[`shows up current config without unnecessary output 1`] = ` "options": [ "<>" ] + }, + { + "name": "codegen", + "options": [ + "<>" + ] } ], "healthChecks": [], diff --git a/__e2e__/config.test.ts b/__e2e__/config.test.ts index 9c4e99527..ecd954409 100644 --- a/__e2e__/config.test.ts +++ b/__e2e__/config.test.ts @@ -8,8 +8,6 @@ import { writeFiles, spawnScript, replaceProjectRootInOutput, - getAllPackages, - addRNCPrefix, } from '../jest/helpers'; const DIR = getTempDirectory('test_root'); @@ -38,15 +36,6 @@ function createCorruptedSetupEnvScript() { } beforeAll(() => { - const packages = getAllPackages(); - - // Register all packages to be linked - for (const pkg of packages) { - spawnScript('yarn', ['link'], { - cwd: path.join(__dirname, `../packages/${pkg}`), - }); - } - // Clean up folder and re-create a new project cleanup(DIR); writeFiles(DIR, {}); @@ -55,7 +44,7 @@ beforeAll(() => { runCLI(DIR, ['init', 'TestProject', '--install-pods']); // Link CLI to the project - spawnScript('yarn', ['link', ...addRNCPrefix(packages)], { + spawnScript('yarn', ['link', __dirname, '--all'], { cwd: path.join(DIR, 'TestProject'), }); }); diff --git a/__e2e__/init.test.ts b/__e2e__/init.test.ts index 99c66b648..162741178 100644 --- a/__e2e__/init.test.ts +++ b/__e2e__/init.test.ts @@ -1,15 +1,8 @@ import fs from 'fs'; import path from 'path'; import {runCLI, getTempDirectory, cleanup, writeFiles} from '../jest/helpers'; -import {execSync} from 'child_process'; -import semver from 'semver'; import slash from 'slash'; -const yarnVersion = semver.parse(execSync('yarn --version').toString().trim())!; - -// .yarnrc -> .yarnrc.yml >= 2.0.0: yarnpkg/berry/issues/239 -const yarnConfigFile = yarnVersion.major > 1 ? '.yarnrc.yml' : '.yarnrc'; - const DIR = getTempDirectory('command-init'); const PROJECT_NAME = 'TestInit'; @@ -30,7 +23,7 @@ function createCustomTemplateFiles() { const customTemplateCopiedFiles = [ '.git', '.yarn', - yarnConfigFile, + '.yarnrc.yml', // .yarnrc.yml for Yarn versions >= 2.0.0 'dir', 'file', 'node_modules', @@ -185,7 +178,7 @@ test('init uses npm as the package manager with --npm', () => { // Remove yarn specific files and node_modules const filteredFiles = customTemplateCopiedFiles.filter( (file) => - !['yarn.lock', 'node_modules', yarnConfigFile, '.yarn'].includes(file), + !['yarn.lock', 'node_modules', '.yarnrc.yml', '.yarn'].includes(file), ); // Add package-lock.json diff --git a/__e2e__/root.test.ts b/__e2e__/root.test.ts index e296c2d9e..48e814f39 100644 --- a/__e2e__/root.test.ts +++ b/__e2e__/root.test.ts @@ -6,45 +6,33 @@ import { getTempDirectory, cleanup, writeFiles, - addRNCPrefix, - getAllPackages, } from '../jest/helpers'; -const cwd = getTempDirectory('test_different_roots'); +const DIR = getTempDirectory('test_different_roots'); beforeAll(() => { - const packages = getAllPackages(); - - // Register all packages to be linked - for (const pkg of packages) { - spawnScript('yarn', ['link'], { - cwd: path.join(__dirname, `../packages/${pkg}`), - }); - } - // Clean up folder and re-create a new project - cleanup(cwd); - writeFiles(cwd, {}); + cleanup(DIR); + writeFiles(DIR, {}); // Initialise React Native project - runCLI(cwd, ['init', 'TestProject']); + runCLI(DIR, ['init', 'TestProject', '--install-pods']); // Link CLI to the project - - spawnScript('yarn', ['link', ...addRNCPrefix(packages)], { - cwd: path.join(cwd, 'TestProject'), + spawnScript('yarn', ['link', __dirname, '--all'], { + cwd: path.join(DIR, 'TestProject'), }); }); afterAll(() => { - cleanup(cwd); + cleanup(DIR); }); test('works when Gradle is run outside of the project hierarchy', async () => { /** * Location of Android project */ - const androidProjectRoot = path.join(cwd, 'TestProject/android'); + const androidProjectRoot = path.join(DIR, 'TestProject/android'); /* * Grab absolute path to Gradle wrapper. The fact that we are using @@ -54,13 +42,9 @@ test('works when Gradle is run outside of the project hierarchy', async () => { const gradleWrapper = path.join(androidProjectRoot, 'gradlew'); // Make sure that we use `-bin` distribution of Gradle - await spawnScript( - gradleWrapper, - ['wrapper', '--gradle-version=8.0.1', '--distribution-type', 'bin'], - { - cwd: androidProjectRoot, - }, - ); + await spawnScript(gradleWrapper, ['wrapper', '--distribution-type', 'bin'], { + cwd: androidProjectRoot, + }); // Execute `gradle` with `-p` flag and `cwd` outside of project hierarchy const {stdout} = spawnScript(gradleWrapper, ['-p', androidProjectRoot], { diff --git a/scripts/buildTs.js b/scripts/buildTs.js index 854a601b8..f727fca6a 100644 --- a/scripts/buildTs.js +++ b/scripts/buildTs.js @@ -35,7 +35,7 @@ console.log(chalk.inverse('Building TypeScript definition files')); process.stdout.write(adjustToTerminalWidth('Building\n')); try { - execa.sync('node', args, {stdio: 'inherit'}); + execa.sync('node', args, {stdio: 'inherit', shell: true}); process.stdout.write(`${OK}\n`); } catch (e) { process.stdout.write('\n');