chore: bump react-native to 0.75 (#2205)
This commit is contained in:
Родитель
74025d5d8f
Коммит
988d4458d4
|
@ -5,7 +5,7 @@
|
|||
{
|
||||
"groupName": "@react-native-community/cli",
|
||||
"matchPackagePrefixes": ["@react-native-community/cli"],
|
||||
"allowedVersions": "^13.6.0"
|
||||
"allowedVersions": "^14.0.0"
|
||||
},
|
||||
{
|
||||
"groupName": "Android CameraX",
|
||||
|
@ -39,13 +39,15 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"matchPackageNames": ["com.facebook.react:hermes-engine", "react"],
|
||||
"enabled": false
|
||||
"groupName": "react",
|
||||
"matchPackageNames": ["@types/react", "react"],
|
||||
"allowedVersions": "^18.2.0"
|
||||
},
|
||||
{
|
||||
"groupName": "react-native",
|
||||
"matchPackageNames": [
|
||||
"@callstack/react-native-visionos",
|
||||
"@react-native-community/template",
|
||||
"@react-native/assets-registry",
|
||||
"@react-native/babel-plugin-codegen",
|
||||
"@react-native/babel-preset",
|
||||
|
@ -63,7 +65,7 @@
|
|||
"react-native-macos",
|
||||
"react-native-windows"
|
||||
],
|
||||
"allowedVersions": "^0.74.0"
|
||||
"allowedVersions": "^0.75.0"
|
||||
}
|
||||
],
|
||||
"postUpdateOptions": ["yarnDedupeHighest"],
|
||||
|
|
|
@ -9,6 +9,7 @@ on:
|
|||
# Nightly builds against react-native@nightly at 4:00, Monday through Friday
|
||||
- cron: 0 4 * * 1-5
|
||||
env:
|
||||
GRADLE_HANGS_ON_WINDOWS: 1 # https://github.com/microsoft/react-native-test-app/issues/2206
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
VisualStudioVersion: "17.0"
|
||||
concurrency:
|
||||
|
@ -88,6 +89,7 @@ jobs:
|
|||
- name: Validate Gradle wrapper
|
||||
uses: gradle/actions/wrapper-validation@v4
|
||||
- name: Populate Gradle cache
|
||||
if: ${{ runner.os != 'Windows' || env.GRADLE_HANGS_ON_WINDOWS != '1' }}
|
||||
uses: ./.github/actions/gradle
|
||||
with:
|
||||
arguments: clean
|
||||
|
@ -255,7 +257,7 @@ jobs:
|
|||
name: "Android"
|
||||
strategy:
|
||||
matrix:
|
||||
runner: [ubuntu-24.04, windows-2022]
|
||||
runner: [ubuntu-24.04] # TODO: Re-add Windows: https://github.com/microsoft/react-native-test-app/issues/2206
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -303,7 +305,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
template: [all, android]
|
||||
runner: [ubuntu-24.04, windows-2022]
|
||||
runner: [ubuntu-24.04] # TODO: Re-add Windows: https://github.com/microsoft/react-native-test-app/issues/2206
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: ${{ github.event_name != 'schedule' }}
|
||||
steps:
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -19,19 +19,19 @@
|
|||
"windows": "react-native run-windows --no-packager"
|
||||
},
|
||||
"dependencies": {
|
||||
"@callstack/react-native-visionos": "^0.74.0",
|
||||
"@callstack/react-native-visionos": "^0.75.0",
|
||||
"@react-native-webapis/web-storage": "^0.2.8",
|
||||
"react": "18.2.0",
|
||||
"react-native": "^0.74.0",
|
||||
"react-native-macos": "^0.74.0",
|
||||
"react-native-windows": "^0.74.0"
|
||||
"react": "^18.2.0",
|
||||
"react-native": "^0.75.0",
|
||||
"react-native-macos": "^0.75.2",
|
||||
"react-native-windows": "^0.75.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"@react-native-community/cli": "^13.6.0",
|
||||
"@react-native/babel-preset": "^0.74.0",
|
||||
"@react-native/metro-config": "^0.74.0",
|
||||
"@babel/core": "^7.20.0",
|
||||
"@babel/preset-env": "^7.20.0",
|
||||
"@react-native-community/cli": "^14.0.0",
|
||||
"@react-native/babel-preset": "^0.75.0",
|
||||
"@react-native/metro-config": "^0.75.0",
|
||||
"@rnx-kit/metro-config": "^1.3.17",
|
||||
"@rnx-kit/polyfills": "^0.1.1",
|
||||
"@rnx-kit/tsconfig": "^1.0.0",
|
||||
|
@ -45,12 +45,12 @@
|
|||
"eslintConfig": {
|
||||
"extends": "../.github/eslint.config.js"
|
||||
},
|
||||
"rnx-kit": {
|
||||
"rnx-kit//disabled": {
|
||||
"//": "This configuration is only used for Viewfinder",
|
||||
"kitType": "app",
|
||||
"alignDeps": {
|
||||
"requirements": [
|
||||
"react-native@0.74"
|
||||
"react-native@0.75"
|
||||
],
|
||||
"capabilities": [
|
||||
"core-android",
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
41
package.json
41
package.json
|
@ -119,13 +119,14 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"@babel/core": "^7.20.0",
|
||||
"@babel/preset-env": "^7.20.0",
|
||||
"@eslint/eslintrc": "^2.1.4",
|
||||
"@eslint/js": "^8.56.0",
|
||||
"@expo/config-plugins": "^8.0.0",
|
||||
"@microsoft/eslint-plugin-sdl": "^0.2.0",
|
||||
"@react-native-community/cli": "^13.6.0",
|
||||
"@react-native-community/cli": "^14.0.0",
|
||||
"@react-native-community/template": "^0.75.0",
|
||||
"@rnx-kit/eslint-plugin": "^0.7.0",
|
||||
"@rnx-kit/tsconfig": "^1.0.0",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
|
@ -140,10 +141,10 @@
|
|||
"memfs": "^4.0.0",
|
||||
"minimatch": "^9.0.0",
|
||||
"prettier": "^3.0.0",
|
||||
"react": "18.2.0",
|
||||
"react-native": "^0.74.0",
|
||||
"react-native-macos": "^0.74.0",
|
||||
"react-native-windows": "^0.74.0",
|
||||
"react": "^18.2.0",
|
||||
"react-native": "^0.75.0",
|
||||
"react-native-macos": "^0.75.2",
|
||||
"react-native-windows": "^0.75.0",
|
||||
"semantic-release": "^24.0.0",
|
||||
"suggestion-bot": "^3.0.0",
|
||||
"tsx": "^4.16.2",
|
||||
|
@ -166,19 +167,19 @@
|
|||
"@expo/json-file/@babel/code-frame": "^7.10.4",
|
||||
"@microsoft/eslint-plugin-sdl/eslint-plugin-react": "^7.33.0",
|
||||
"@pnpm/network.ca-file/graceful-fs": "~4.2.10",
|
||||
"@react-native-community/cli": "^13.6.0",
|
||||
"@react-native-community/cli-platform-android": "^13.6.0",
|
||||
"@react-native-community/cli-platform-apple": "^13.6.0",
|
||||
"@react-native-community/cli-platform-ios": "^13.6.0",
|
||||
"@react-native/assets-registry": "^0.74.0",
|
||||
"@react-native/codegen": "^0.74.0",
|
||||
"@react-native/community-cli-plugin": "^0.74.0",
|
||||
"@react-native/community-cli-plugin/@react-native-community/cli-server-api": "^13.6.0",
|
||||
"@react-native/community-cli-plugin/@react-native-community/cli-tools": "^13.6.0",
|
||||
"@react-native/gradle-plugin": "^0.74.0",
|
||||
"@react-native/js-polyfills": "^0.74.0",
|
||||
"@react-native/normalize-colors": "^0.74.0",
|
||||
"@react-native/virtualized-lists": "^0.74.0",
|
||||
"@react-native-community/cli": "^14.0.0",
|
||||
"@react-native-community/cli-platform-android": "^14.0.0",
|
||||
"@react-native-community/cli-platform-apple": "^14.0.0",
|
||||
"@react-native-community/cli-platform-ios": "^14.0.0",
|
||||
"@react-native/assets-registry": "^0.75.0",
|
||||
"@react-native/codegen": "^0.75.0",
|
||||
"@react-native/community-cli-plugin": "^0.75.0",
|
||||
"@react-native/community-cli-plugin/@react-native-community/cli-server-api": "^14.0.0",
|
||||
"@react-native/community-cli-plugin/@react-native-community/cli-tools": "^14.0.0",
|
||||
"@react-native/gradle-plugin": "^0.75.0",
|
||||
"@react-native/js-polyfills": "^0.75.0",
|
||||
"@react-native/normalize-colors": "^0.75.0",
|
||||
"@react-native/virtualized-lists": "^0.75.0",
|
||||
"@semantic-release/npm/npm": "link:./example",
|
||||
"appium/@types/semver": "^7.5.8",
|
||||
"appium/ajv": "^8.17.1",
|
||||
|
|
|
@ -6,12 +6,12 @@ const DEVICE_ID = "T-800";
|
|||
|
||||
/**
|
||||
* Runs the specified command.
|
||||
* @param {string} successString The string to look for
|
||||
* @param {RegExp} successPattern The string to look for
|
||||
* @param {...any} args The command to run and its arguments
|
||||
*/
|
||||
function run(successString, ...args) {
|
||||
function run(successPattern, ...args) {
|
||||
const { stderr } = spawnSync("yarn", args, { encoding: "utf-8" });
|
||||
if (!stderr.includes(successString)) {
|
||||
if (!successPattern.test(stderr)) {
|
||||
throw new Error(stderr);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ function runAndroid() {
|
|||
// If `@react-native-community/cli` reaches the point where it is looking for
|
||||
// a device, we can assume that it has successfully created a config and
|
||||
// determined that there is an Android project that can be built and launched.
|
||||
const success = "No Android device or emulator connected.";
|
||||
const success = /No Android device or emulator connected/;
|
||||
run(success, "android", "--deviceId", DEVICE_ID, "--no-packager");
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ function runIOS() {
|
|||
// If `@react-native-community/cli` reaches the point where it is looking for
|
||||
// a device, we can assume that it has successfully created a config and
|
||||
// determined that there is an iOS project that can be built and launched.
|
||||
const success = `Could not find a device named: "${DEVICE_ID}"`;
|
||||
const success = new RegExp(`Could not find .*: "${DEVICE_ID}"`);
|
||||
run(success, "ios", "--device", DEVICE_ID, "--no-packager");
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import { fileURLToPath } from "node:url";
|
|||
import { gatherConfig, writeAllFiles } from "../../scripts/configure.mjs";
|
||||
import { findNearest, readJSONFile } from "../../scripts/helpers.js";
|
||||
import type { ConfigureParams } from "../../scripts/types.js";
|
||||
import { templatePath } from "../template.js";
|
||||
|
||||
const GRADLE_TEST_TASK = "nodeTest";
|
||||
const MKDIR_OPTIONS = { recursive: true, mode: 0o755 };
|
||||
|
@ -63,6 +64,7 @@ async function makeProject(
|
|||
const { files } = gatherConfig({
|
||||
name,
|
||||
packagePath,
|
||||
templatePath,
|
||||
testAppPath: fileURLToPath(new URL("../..", import.meta.url)),
|
||||
targetVersion: reactNativeVersion(),
|
||||
platforms,
|
||||
|
|
|
@ -8,6 +8,10 @@ import {
|
|||
runGradleWithProject,
|
||||
} from "./gradle.js";
|
||||
|
||||
// TODO: https://github.com/microsoft/react-native-test-app/issues/2206
|
||||
const GRADLE_HANGS_ON_WINDOWS = process.platform === "win32";
|
||||
const testOptions = { skip: GRADLE_HANGS_ON_WINDOWS };
|
||||
|
||||
describe("test-app-util.gradle", () => {
|
||||
const defaultTestProject = "TestAppUtilTest";
|
||||
|
||||
|
@ -20,9 +24,13 @@ describe("test-app-util.gradle", () => {
|
|||
return runGradleWithProject(defaultTestProject, ["android"], setupFiles);
|
||||
}
|
||||
|
||||
after(() => removeProject(defaultTestProject));
|
||||
after(() => {
|
||||
if (!testOptions.skip) {
|
||||
removeProject(defaultTestProject);
|
||||
}
|
||||
});
|
||||
|
||||
it("getAppName() returns `displayName`", async () => {
|
||||
it("getAppName() returns `displayName`", testOptions, async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
|
@ -38,7 +46,7 @@ describe("test-app-util.gradle", () => {
|
|||
match(stdout, /getAppName\(\) = AppDisplayName/);
|
||||
});
|
||||
|
||||
it("getApplicationId() returns default id", async () => {
|
||||
it("getApplicationId() returns default id", testOptions, async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
|
@ -54,7 +62,7 @@ describe("test-app-util.gradle", () => {
|
|||
match(stdout, /getApplicationId\(\) = com.microsoft.reacttestapp/);
|
||||
});
|
||||
|
||||
it("getApplicationId() returns package name", async () => {
|
||||
it("getApplicationId() returns package name", testOptions, async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
|
@ -73,116 +81,140 @@ describe("test-app-util.gradle", () => {
|
|||
match(stdout, /getApplicationId\(\) = com.contoso.application.id/);
|
||||
});
|
||||
|
||||
it("getPackageVersionNumber() returns `react-native` version as a number", async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getPackageVersionNumber() = " + project.ext.getPackageVersionNumber("react-native", rootDir))'
|
||||
),
|
||||
});
|
||||
it(
|
||||
"getPackageVersionNumber() returns `react-native` version as a number",
|
||||
testOptions,
|
||||
async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getPackageVersionNumber() = " + project.ext.getPackageVersionNumber("react-native", rootDir))'
|
||||
),
|
||||
});
|
||||
|
||||
const versionNumber = toVersionNumber(reactNativeVersion());
|
||||
const versionNumber = toVersionNumber(reactNativeVersion());
|
||||
|
||||
equal(status, 0);
|
||||
match(
|
||||
stdout,
|
||||
new RegExp(`getPackageVersionNumber\\(\\) = ${versionNumber}`)
|
||||
);
|
||||
});
|
||||
equal(status, 0);
|
||||
match(
|
||||
stdout,
|
||||
new RegExp(`getPackageVersionNumber\\(\\) = ${versionNumber}`)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it("getSigningConfigs() fails if `storeFile` is missing", async () => {
|
||||
const { status, stderr } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: { signingConfigs: { debug: {} } },
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
it(
|
||||
"getSigningConfigs() fails if `storeFile` is missing",
|
||||
testOptions,
|
||||
async () => {
|
||||
const { status, stderr } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: { signingConfigs: { debug: {} } },
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
|
||||
equal(status, 1);
|
||||
match(stderr, /storeFile .* is missing/);
|
||||
});
|
||||
equal(status, 1);
|
||||
match(stderr, /storeFile .* is missing/);
|
||||
}
|
||||
);
|
||||
|
||||
it("getSigningConfigs() skips empty `signingConfigs` config", async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: { signingConfigs: {} },
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
it(
|
||||
"getSigningConfigs() skips empty `signingConfigs` config",
|
||||
testOptions,
|
||||
async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: { signingConfigs: {} },
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
|
||||
equal(status, 0);
|
||||
match(stdout, /getSigningConfigs\(\) = \[:\]/);
|
||||
});
|
||||
equal(status, 0);
|
||||
match(stdout, /getSigningConfigs\(\) = \[:\]/);
|
||||
}
|
||||
);
|
||||
|
||||
it("getSigningConfigs() returns debug signing config", async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: {
|
||||
signingConfigs: {
|
||||
debug: {
|
||||
storeFile: "../README.md",
|
||||
it(
|
||||
"getSigningConfigs() returns debug signing config",
|
||||
testOptions,
|
||||
async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: {
|
||||
signingConfigs: {
|
||||
debug: {
|
||||
storeFile: "../README.md",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
|
||||
equal(status, 0);
|
||||
match(
|
||||
stdout,
|
||||
/getSigningConfigs\(\) = \[debug:\[keyAlias:androiddebugkey, keyPassword:android, storePassword:android, storeFile:.*\]\]/
|
||||
);
|
||||
});
|
||||
equal(status, 0);
|
||||
match(
|
||||
stdout,
|
||||
/getSigningConfigs\(\) = \[debug:\[keyAlias:androiddebugkey, keyPassword:android, storePassword:android, storeFile:.*\]\]/
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it("getSigningConfigs() returns release signing config", async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: {
|
||||
signingConfigs: {
|
||||
release: {
|
||||
storeFile: "../README.md",
|
||||
it(
|
||||
"getSigningConfigs() returns release signing config",
|
||||
testOptions,
|
||||
async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"app.json": JSON.stringify({
|
||||
name: "AppName",
|
||||
displayName: "AppDisplayName",
|
||||
resources: ["dist/res", "dist/main.android.jsbundle"],
|
||||
android: {
|
||||
signingConfigs: {
|
||||
release: {
|
||||
storeFile: "../README.md",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
}),
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("getSigningConfigs() = " + project.ext.getSigningConfigs())'
|
||||
),
|
||||
});
|
||||
|
||||
equal(status, 0);
|
||||
match(
|
||||
stdout,
|
||||
/getSigningConfigs\(\) = \[release:\[keyAlias:androiddebugkey, keyPassword:android, storePassword:android, storeFile:.*\]\]/
|
||||
);
|
||||
});
|
||||
equal(status, 0);
|
||||
match(
|
||||
stdout,
|
||||
/getSigningConfigs\(\) = \[release:\[keyAlias:androiddebugkey, keyPassword:android, storePassword:android, storeFile:.*\]\]/
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it("toVersionNumber() handles pre-release identifiers", async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("toVersionNumber() = " + project.ext.toVersionNumber("1.2.3-053c2b4be"))'
|
||||
),
|
||||
});
|
||||
it(
|
||||
"toVersionNumber() handles pre-release identifiers",
|
||||
testOptions,
|
||||
async () => {
|
||||
const { status, stdout } = await runGradle({
|
||||
"android/build.gradle": buildGradle(
|
||||
'println("toVersionNumber() = " + project.ext.toVersionNumber("1.2.3-053c2b4be"))'
|
||||
),
|
||||
});
|
||||
|
||||
equal(status, 0);
|
||||
match(stdout, new RegExp(`toVersionNumber\\(\\) = ${v(1, 2, 3)}`));
|
||||
});
|
||||
equal(status, 0);
|
||||
match(stdout, new RegExp(`toVersionNumber\\(\\) = ${v(1, 2, 3)}`));
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -4,9 +4,14 @@ import { gatherConfig as gatherConfigActual } from "../../scripts/configure.mjs"
|
|||
import { readTextFile } from "../../scripts/helpers.js";
|
||||
import { join } from "../../scripts/template.mjs";
|
||||
import type { Configuration, ConfigureParams } from "../../scripts/types.js";
|
||||
import { templatePath } from "../template.js";
|
||||
import { mockParams } from "./mockParams.js";
|
||||
|
||||
describe("gatherConfig()", () => {
|
||||
const templateDir = templatePath.substring(
|
||||
templatePath.lastIndexOf("node_modules")
|
||||
);
|
||||
|
||||
/**
|
||||
* Like `gatherConfig()`, but with normalized newlines and paths.
|
||||
*
|
||||
|
@ -17,7 +22,7 @@ describe("gatherConfig()", () => {
|
|||
function gatherConfig(params: ConfigureParams): Configuration {
|
||||
const normalize = (p: string) => p.replaceAll("\\", "/");
|
||||
|
||||
const config = gatherConfigActual(params, true);
|
||||
const config = gatherConfigActual({ ...params, templatePath }, true);
|
||||
config.files = Object.fromEntries(
|
||||
Object.entries(config.files).map(([key, value]) => [
|
||||
normalize(key),
|
||||
|
@ -45,7 +50,7 @@ describe("gatherConfig()", () => {
|
|||
source: "example/.gitignore",
|
||||
},
|
||||
".watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
"android/build.gradle": join(
|
||||
"buildscript {",
|
||||
|
@ -131,7 +136,7 @@ describe("gatherConfig()", () => {
|
|||
""
|
||||
),
|
||||
"babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"ios/Podfile": join(
|
||||
"ws_dir = Pathname.new(__dir__)",
|
||||
|
@ -231,19 +236,19 @@ describe("gatherConfig()", () => {
|
|||
source: "example/.gitignore",
|
||||
},
|
||||
".watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
"babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"common/.gitignore": {
|
||||
source: "example/.gitignore",
|
||||
},
|
||||
"common/.watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
"common/babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"common/metro.config.js": {
|
||||
source: "example/metro.config.js",
|
||||
|
@ -321,10 +326,10 @@ describe("gatherConfig()", () => {
|
|||
source: "example/.gitignore",
|
||||
},
|
||||
".watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
"babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"ios/Podfile": join(
|
||||
"ws_dir = Pathname.new(__dir__)",
|
||||
|
@ -393,7 +398,7 @@ describe("gatherConfig()", () => {
|
|||
source: "example/.gitignore",
|
||||
},
|
||||
".watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
"android/build.gradle": join(
|
||||
"buildscript {",
|
||||
|
@ -479,7 +484,7 @@ describe("gatherConfig()", () => {
|
|||
""
|
||||
),
|
||||
"babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"ios/Podfile": join(
|
||||
"ws_dir = Pathname.new(__dir__)",
|
||||
|
@ -551,7 +556,7 @@ describe("gatherConfig()", () => {
|
|||
source: "example/.gitignore",
|
||||
},
|
||||
".watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
Podfile: join(
|
||||
"ws_dir = Pathname.new(__dir__)",
|
||||
|
@ -566,7 +571,7 @@ describe("gatherConfig()", () => {
|
|||
""
|
||||
),
|
||||
"babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"metro.config.js": {
|
||||
source: "example/metro.config.js",
|
||||
|
@ -609,7 +614,7 @@ describe("gatherConfig()", () => {
|
|||
source: "example/.gitignore",
|
||||
},
|
||||
".watchmanconfig": {
|
||||
source: "node_modules/react-native/template/_watchmanconfig",
|
||||
source: `${templateDir}/_watchmanconfig`,
|
||||
},
|
||||
"android/build.gradle": join(
|
||||
"buildscript {",
|
||||
|
@ -695,7 +700,7 @@ describe("gatherConfig()", () => {
|
|||
""
|
||||
),
|
||||
"babel.config.js": {
|
||||
source: "node_modules/react-native/template/babel.config.js",
|
||||
source: `${templateDir}/babel.config.js`,
|
||||
},
|
||||
"ios/Podfile": join(
|
||||
"ws_dir = Pathname.new(__dir__)",
|
||||
|
|
|
@ -6,11 +6,12 @@ import {
|
|||
getPlatformPackage,
|
||||
} from "../../scripts/configure.mjs";
|
||||
import type { ConfigureParams, Platform } from "../../scripts/types.js";
|
||||
import { templatePath } from "../template.js";
|
||||
import { mockParams } from "./mockParams.js";
|
||||
|
||||
describe("getConfig()", () => {
|
||||
const getConfig: typeof getConfigActual = (params, platform) =>
|
||||
getConfigActual(params, platform, true);
|
||||
getConfigActual({ ...params, templatePath }, platform, true);
|
||||
|
||||
/**
|
||||
* Gets the list of dependencies from specified config.
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import * as path from "node:path";
|
||||
import { findNearest } from "../scripts/helpers.js";
|
||||
|
||||
const templateDir = findNearest(
|
||||
"node_modules/@react-native-community/template"
|
||||
);
|
||||
|
||||
if (!templateDir) {
|
||||
throw new Error("Cannot find module '@react-native-community/template'");
|
||||
}
|
||||
|
||||
export const templatePath = path
|
||||
.join(templateDir, "template")
|
||||
.replaceAll("\\", "/");
|
991
yarn.lock
991
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче