Skip to content

Commit b405846

Browse files
committed
fix: remove manual RN config for 0.79 compatibility
1 parent 5c445c3 commit b405846

3 files changed

Lines changed: 32 additions & 31 deletions

File tree

__tests__/config.test.ts

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
import fs from "fs";
22
import path from "path";
33

4-
describe("react-native config", () => {
5-
it("exposes podspec path and android package", () => {
6-
const config = require("../react-native.config.js");
7-
expect(config).toHaveProperty("dependency.platforms.ios.podspec");
8-
expect(config).toHaveProperty("dependency.platforms.android.packageImportPath", "com.contactsupdated.ContactsLastUpdatedPackage");
9-
expect(config).toHaveProperty("dependency.platforms.android.packageInstance", "new ContactsLastUpdatedPackage()");
4+
describe("package metadata", () => {
5+
const root = path.resolve(__dirname, "..");
106

11-
const podspecPath = config.dependency.platforms.ios.podspec as string;
12-
const resolved = path.resolve(__dirname, "..", podspecPath);
13-
expect(fs.existsSync(resolved)).toBe(true);
14-
});
15-
16-
it("includes podspec and config in published files", () => {
7+
it("ships the podspec in the published files", () => {
178
const pkg = require("../package.json");
189
expect(pkg.files).toEqual(
19-
expect.arrayContaining([
20-
"react-native-contacts-last-updated.podspec",
21-
"react-native.config.js",
22-
])
10+
expect.arrayContaining(["react-native-contacts-last-updated.podspec"])
11+
);
12+
expect(pkg.files).not.toEqual(
13+
expect.arrayContaining(["react-native.config.js"])
14+
);
15+
});
16+
17+
it("defines iOS sources in the podspec", () => {
18+
const podspec = fs.readFileSync(
19+
path.join(root, "react-native-contacts-last-updated.podspec"),
20+
"utf8"
21+
);
22+
expect(podspec).toMatch(/s\.source_files\s*=\s*"ios\/\*\*\/\*\.\{h,m,mm,swift}/);
23+
});
24+
25+
it("exposes an Android ReactPackage", () => {
26+
const pkgSource = fs.readFileSync(
27+
path.join(
28+
root,
29+
"android",
30+
"src",
31+
"main",
32+
"java",
33+
"com",
34+
"contactsupdated",
35+
"ContactsLastUpdatedPackage.kt"
36+
),
37+
"utf8"
2338
);
39+
expect(pkgSource).toContain("class ContactsLastUpdatedPackage : ReactPackage");
2440
});
2541
});

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"src",
2020
"android",
2121
"ios",
22-
"react-native.config.js",
2322
"react-native-contacts-last-updated.podspec"
2423
],
2524
"scripts": {

react-native.config.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)