Skip to content

Commit 76a3a28

Browse files
committed
fixup! refactor(apple): port make_project! to JS
1 parent ef45eaf commit 76a3a28

File tree

6 files changed

+57
-32
lines changed

6 files changed

+57
-32
lines changed

ios/app.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ import {
2424
} from "./xcode.mjs";
2525

2626
/**
27-
* @import { ApplePlatform, JSONObject, JSONValue } from "../scripts/types.ts";
28-
* @import { ProjectConfiguration } from "./xcode.mjs";
27+
* @import {
28+
* ApplePlatform,
29+
* JSONObject,
30+
* JSONValue,
31+
* ProjectConfiguration,
32+
* } from "../scripts/types.ts";
2933
*/
3034

3135
const SUPPORTED_PLATFORMS = ["ios", "macos", "visionos"];

ios/privacyManifest.mjs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import * as path from "node:path";
44
import { isObject, plistFromJSON } from "./utils.mjs";
55

66
/**
7-
* @import { ApplePlatform, JSONObject, JSONValue } from "../scripts/types.js";
8-
*
9-
* @typedef {{
10-
* NSPrivacyTracking: boolean;
11-
* NSPrivacyTrackingDomains: JSONValue[];
12-
* NSPrivacyCollectedDataTypes: JSONValue[];
13-
* NSPrivacyAccessedAPITypes: JSONValue[];
14-
* }} PrivacyManifest;
7+
* @import {
8+
* ApplePlatform,
9+
* JSONObject,
10+
* PrivacyManifest
11+
* } from "../scripts/types.js";
1512
*/
1613

1714
// https://developer.apple.com/documentation/bundleresources/privacy_manifest_files

ios/xcode.mjs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,12 @@ import { findFile, readTextFile, v } from "../scripts/helpers.js";
66
import { isObject, isString } from "./utils.mjs";
77

88
/**
9-
* @import { XmlBuilderOptions } from "fast-xml-parser";
10-
* @import { ApplePlatform, JSONObject } from "../scripts/types.js";
11-
*
12-
* @typedef {{
13-
* xcodeprojPath: string;
14-
* reactNativePath: string;
15-
* reactNativeVersion: number;
16-
* singleApp?: string;
17-
* useNewArch: boolean;
18-
* useBridgeless: boolean;
19-
* buildSettings: Record<string, string | string[]>;
20-
* testsBuildSettings: Record<string, string>;
21-
* uitestsBuildSettings: Record<string, string>;
22-
* }} ProjectConfiguration
23-
*
24-
* @typedef {Pick<
25-
* Required<XmlBuilderOptions>,
26-
* "attributeNamePrefix" | "ignoreAttributes" | "format" | "indentBy"
27-
* >} XmlOptions;
9+
* @import {
10+
* ApplePlatform,
11+
* JSONObject,
12+
* ProjectConfiguration,
13+
* XmlOptions,
14+
* } from "../scripts/types.js";
2815
*/
2916

3017
export const IPHONEOS_DEPLOYMENT_TARGET = "IPHONEOS_DEPLOYMENT_TARGET";

scripts/types.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { XmlBuilderOptions } from "fast-xml-parser";
2+
13
export type JSONValue =
24
| string
35
| number
@@ -115,6 +117,38 @@ export type ProjectConfig = {
115117
windows?: Pick<ProjectParams["windows"], "sourceDir" | "solutionFile">;
116118
};
117119

120+
/***************************
121+
* ios/privacyManifest.mjs *
122+
***************************/
123+
124+
export type PrivacyManifest = {
125+
NSPrivacyTracking: boolean;
126+
NSPrivacyTrackingDomains: JSONValue[];
127+
NSPrivacyCollectedDataTypes: JSONValue[];
128+
NSPrivacyAccessedAPITypes: JSONValue[];
129+
};
130+
131+
/*****************
132+
* ios/xcode.mjs *
133+
*****************/
134+
135+
export type ProjectConfiguration = {
136+
xcodeprojPath: string;
137+
reactNativePath: string;
138+
reactNativeVersion: number;
139+
singleApp?: string;
140+
useNewArch: boolean;
141+
useBridgeless: boolean;
142+
buildSettings: Record<string, string | string[]>;
143+
testsBuildSettings: Record<string, string>;
144+
uitestsBuildSettings: Record<string, string>;
145+
};
146+
147+
export type XmlOptions = Pick<
148+
Required<XmlBuilderOptions>,
149+
"attributeNamePrefix" | "ignoreAttributes" | "format" | "indentBy"
150+
>;
151+
118152
/*****************
119153
* parseargs.mjs *
120154
*****************/

test/ios/newArch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe("isBridgelessEnabled()", () => {
4040
});
4141

4242
it("does not return true just because `RCT_NEW_ARCH_ENABLED` is set", () => {
43-
// `RCT_NEW_ARCH_ENABLED` does not enable bridgeless
43+
// `RCT_NEW_ARCH_ENABLED` does not enable bridgeless on older versions
4444
process.env["RCT_NEW_ARCH_ENABLED"] = "1";
4545

4646
ok(!isBridgelessEnabled({}, v(0, 72, 999)));

test/ios/xcode.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { deepEqual, equal, match, notEqual, throws } from "node:assert/strict";
22
import * as path from "node:path";
33
import { afterEach, beforeEach, describe, it } from "node:test";
4-
import type { ProjectConfiguration } from "../../ios/xcode.mjs";
54
import {
65
CODE_SIGN_ENTITLEMENTS,
76
CODE_SIGN_IDENTITY,
@@ -19,7 +18,11 @@ import {
1918
overrideBuildSettings,
2019
} from "../../ios/xcode.mjs";
2120
import { readTextFile, v } from "../../scripts/helpers.js";
22-
import type { ApplePlatform, JSONObject } from "../../scripts/types.ts";
21+
import type {
22+
ApplePlatform,
23+
JSONObject,
24+
ProjectConfiguration,
25+
} from "../../scripts/types.ts";
2326
import { fs, setMockFiles, toJSON } from "../fs.mock.ts";
2427

2528
const macosOnly = { skip: process.platform === "win32" };

0 commit comments

Comments
 (0)