catalyst-core 0.2.0-beta.3 → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.native.config.cjs +8 -0
- package/bin/catalyst.js +49 -105
- package/changelog.md +8 -0
- package/dist/caching.js +1 -1
- package/dist/index.jsx +8 -0
- package/dist/logger.js +74 -3
- package/dist/native/androidSetup.js +300 -8
- package/dist/native/bridge/WebBridge.js +481 -59
- package/dist/native/bridge/constants/NativeInterfaces.js +290 -45
- package/dist/native/bridge/errors.js +250 -26
- package/dist/native/bridge/hooks/index.js +125 -1
- package/dist/native/bridge/hooks/useCamera.js +347 -9
- package/dist/native/bridge/hooks/useDataProtection.js +200 -2
- package/dist/native/bridge/hooks/useDeviceInfo.js +71 -2
- package/dist/native/bridge/hooks/useFilePicker.js +429 -2
- package/dist/native/bridge/hooks/useGoogleSignIn.js +81 -1
- package/dist/native/bridge/hooks/useHapticFeedback.js +196 -1
- package/dist/native/bridge/hooks/useIntent.js +95 -1
- package/dist/native/bridge/hooks/useNativeTransition.js +202 -27
- package/dist/native/bridge/hooks/useNetworkStatus.js +84 -3
- package/dist/native/bridge/hooks/useNotification.js +318 -2
- package/dist/native/bridge/hooks/useSafeArea.js +84 -2
- package/dist/native/bridge/hooks/useVideoStream.js +434 -6
- package/dist/native/bridge/hooks/utils.js +27 -1
- package/dist/native/bridge/hooks.js +16 -1
- package/dist/native/bridge/perf/collectors/ApiCollector.js +66 -3
- package/dist/native/bridge/perf/collectors/CacheCollector.js +186 -11
- package/dist/native/bridge/perf/collectors/HookCollector.js +141 -19
- package/dist/native/bridge/perf/collectors/InsightsCollector.js +481 -23
- package/dist/native/bridge/perf/collectors/InteractionCollector.js +245 -10
- package/dist/native/bridge/perf/collectors/KeyboardCollector.js +107 -8
- package/dist/native/bridge/perf/collectors/NavigationCollector.js +273 -32
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +178 -2
- package/dist/native/bridge/perf/collectors/RenderCollector.js +258 -14
- package/dist/native/bridge/perf/collectors/ScrollCollector.js +95 -9
- package/dist/native/bridge/perf/collectors/ThreadCollector.js +90 -6
- package/dist/native/bridge/perf/core/constants.js +103 -20
- package/dist/native/bridge/perf/core/measure.js +179 -30
- package/dist/native/bridge/perf/core/session.js +89 -23
- package/dist/native/bridge/perf/core/store.js +554 -1
- package/dist/native/bridge/perf/core/summary.js +174 -1
- package/dist/native/bridge/perf/core/traceExport.js +240 -1
- package/dist/native/bridge/perf/core/waterfalls.js +146 -1
- package/dist/native/bridge/perf/index.js +359 -38
- package/dist/native/bridge/safeArea.js +53 -5
- package/dist/native/bridge/standardizedHooks.js +595 -82
- package/dist/native/bridge/useBaseHook.js +274 -38
- package/dist/native/bridge/utils/CameraUtils.js +201 -56
- package/dist/native/bridge/utils/FileObjectConverter.js +129 -18
- package/dist/native/bridge/utils/NativeBridge.js +425 -141
- package/dist/native/buildAndroid/assets.js +510 -13
- package/dist/native/buildAndroid/build.js +296 -19
- package/dist/native/buildAndroid/config.js +87 -1
- package/dist/native/buildAndroid/index.js +374 -1
- package/dist/native/buildAppAndroid.js +34 -2
- package/dist/native/buildAppIos.js +62 -2
- package/dist/native/buildIos/assets.js +609 -8
- package/dist/native/buildIos/build.js +639 -20
- package/dist/native/buildIos/config.js +294 -12
- package/dist/native/buildIos/index.js +343 -6
- package/dist/native/buildIos/plugins.js +343 -16
- package/dist/native/internal-plugins/device-info-plugin/android/DeviceInfoPlugin.kt +43 -0
- package/dist/native/internal-plugins/device-info-plugin/ios/DeviceInfoPlugin.swift +28 -0
- package/dist/native/internal-plugins/device-info-plugin/manifest.json +19 -0
- package/dist/native/internalPluginUtils.js +232 -7
- package/dist/native/package.json +3 -0
- package/dist/native/plugin-bridge/PluginBridge.js +227 -1
- package/dist/native/pluginComposerAndroid.js +407 -23
- package/dist/native/pluginComposerIos.js +435 -11
- package/dist/native/renameAndroidProject.js +1094 -88
- package/dist/native/setupEmulatorIos.js +289 -22
- package/dist/native/setupServer.js +160 -19
- package/dist/native/terminalProgress.js +199 -11
- package/dist/native/utils.js +193 -15
- package/dist/offline/catalyst-sw.js +145 -1
- package/dist/offline/registerServiceWorker.js +33 -1
- package/dist/otel.js +375 -46
- package/dist/router/ClientRouter.js +14 -2
- package/dist/router/ServerRouter.js +9 -1
- package/dist/router.js +1 -1
- package/dist/scripts/build.js +112 -3
- package/dist/scripts/checkVersion.js +3 -1
- package/dist/scripts/cleanCache.js +30 -1
- package/dist/scripts/generateOfflineManifest.js +116 -1
- package/dist/scripts/loadEnvironmentVariables.js +32 -6
- package/dist/scripts/plugins.js +309 -1
- package/dist/scripts/preServerInit.js +13 -0
- package/dist/scripts/scriptUtils.js +54 -3
- package/dist/scripts/serve.js +51 -4
- package/dist/scripts/start.js +47 -10
- package/dist/scripts/validator.js +149 -1
- package/dist/sentry.cjs +127 -0
- package/dist/sentry.js +125 -5
- package/dist/server/expressServer.js +250 -5
- package/dist/server/manifestCache.js +36 -0
- package/dist/server/renderer/ChunkExtractor.js +144 -0
- package/dist/server/renderer/document/Body.jsx +59 -0
- package/dist/server/renderer/document/FastRefresh.jsx +20 -0
- package/dist/server/renderer/document/Head.jsx +60 -0
- package/dist/server/renderer/document/index.jsx +2 -0
- package/dist/server/renderer/extract.js +149 -31
- package/dist/server/renderer/handler.jsx +433 -0
- package/dist/server/renderer/index.js +8 -1
- package/dist/server/renderer/render.js +47 -0
- package/dist/server/utils/botDetectionMiddleware.js +29 -0
- package/dist/server/utils/cjsRequire.js +10 -0
- package/dist/server/utils/userAgentUtil.js +87 -9
- package/dist/server/utils/validator.js +164 -1
- package/dist/vite/FastRefresh.jsx +20 -0
- package/dist/vite/inject-cache-key-plugin.js +276 -0
- package/dist/vite/loadCustomViteConfig.js +22 -0
- package/dist/vite/manifest-categorization-plugin.js +455 -0
- package/dist/vite/node-loader.mjs +458 -0
- package/dist/vite/scssParams.js +21 -0
- package/dist/vite/vite.config.client.js +130 -0
- package/dist/vite/vite.config.js +422 -0
- package/dist/vite/vite.config.server.js +84 -0
- package/dist/web-router/components/MetaTag.jsx +34 -0
- package/dist/web-router/components/RouterDataProvider.jsx +332 -0
- package/dist/web-router/components/Split.jsx +200 -0
- package/dist/web-router/components/SplitInview.jsx +106 -0
- package/dist/web-router/components/SsrRequestContext.jsx +14 -0
- package/dist/web-router/context.jsx +12 -0
- package/dist/web-router/hooks.jsx +72 -0
- package/dist/web-router/types/components/MetaTag.d.ts +2 -0
- package/dist/web-router/types/components/RouterDataProvider.d.ts +95 -0
- package/dist/web-router/types/context.d.ts +14 -0
- package/dist/web-router/types/hooks.d.ts +1 -0
- package/dist/web-router/types/index.d.ts +3 -0
- package/dist/web-router/types/utils/metaDataUtils.d.ts +24 -0
- package/dist/web-router/utils/metaDataUtils.jsx +119 -0
- package/mcp_v2/conversion-tasks.json +35 -17
- package/mcp_v2/knowledge-base.json +124 -13
- package/mcp_v2/lib/helpers.js +10 -0
- package/mcp_v2/mcp.js +4 -4
- package/mcp_v2/package.json +1 -0
- package/mcp_v2/tools/build.js +116 -20
- package/mcp_v2/tools/conversion.js +106 -5
- package/mcp_v2/tools/tasks.js +18 -14
- package/package.json +35 -68
- package/babel.config.js +0 -32
- package/dist/index.js +0 -1
- package/dist/scripts/devBuild.js +0 -3
- package/dist/scripts/devServe.js +0 -3
- package/dist/scripts/loadScriptsBeforeServerStarts.js +0 -4
- package/dist/scripts/registerAliases.js +0 -6
- package/dist/server/renderer/document/Body.js +0 -11
- package/dist/server/renderer/document/Head.js +0 -9
- package/dist/server/renderer/document/index.js +0 -1
- package/dist/server/renderer/handler.js +0 -47
- package/dist/server/startServer.js +0 -57
- package/dist/webpack/babel-plugins/remove-client.plugin.js +0 -5
- package/dist/webpack/babel-plugins/remove-ssr.plugin.js +0 -5
- package/dist/webpack/babel.config.client.js +0 -1
- package/dist/webpack/babel.config.ssr.js +0 -1
- package/dist/webpack/base.babel.js +0 -7
- package/dist/webpack/development.client.babel.js +0 -10
- package/dist/webpack/production.client.babel.js +0 -4
- package/dist/webpack/production.ssr.babel.js +0 -8
- package/dist/webpack/scssParams.js +0 -9
|
@@ -1,6 +1,343 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
execFile,
|
|
5
|
+
execFileSync
|
|
6
|
+
} = require("child_process");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const TerminalProgress = require("../TerminalProgress.js").default;
|
|
10
|
+
const createConfigPhase = require("./config.js");
|
|
11
|
+
const createPluginsPhase = require("./plugins.js");
|
|
12
|
+
const createAssetsPhase = require("./assets.js");
|
|
13
|
+
const createBuildPhase = require("./build.js");
|
|
14
|
+
const catalystCorePath = path.dirname(require.resolve("catalyst-core/package.json"));
|
|
15
|
+
const pwd = path.join(catalystCorePath, "dist/native");
|
|
16
|
+
const MANAGED_BASELINE_SUFFIX = ".catalyst-base";
|
|
17
|
+
const shellCommand = process.platform === "win32" ? "cmd.exe" : "sh";
|
|
18
|
+
const shellArgs = command => process.platform === "win32" ? ["/d", "/s", "/c", command] : ["-c", command];
|
|
19
|
+
function createIosBuild(config) {
|
|
20
|
+
const {
|
|
21
|
+
WEBVIEW_CONFIG,
|
|
22
|
+
BUILD_OUTPUT_PATH
|
|
23
|
+
} = config;
|
|
24
|
+
const iosConfig = WEBVIEW_CONFIG.ios;
|
|
25
|
+
const isGoogleSignInEnabled = WEBVIEW_CONFIG.googleSignIn?.enabled ?? false;
|
|
26
|
+
const protocol = WEBVIEW_CONFIG.useHttps ? "https" : "http";
|
|
27
|
+
const ip = WEBVIEW_CONFIG.LOCAL_IP || "localhost";
|
|
28
|
+
const port = WEBVIEW_CONFIG.port ? WEBVIEW_CONFIG.useHttps ? 443 : WEBVIEW_CONFIG.port : null;
|
|
29
|
+
const url = port ? `${protocol}://${ip}:${port}` : `${protocol}://${ip}`;
|
|
30
|
+
const PUBLIC_PATH = `${process.cwd()}/public`;
|
|
31
|
+
const PROJECT_DIR = `${pwd}/iosnativeWebView`;
|
|
32
|
+
const SCHEME_NAME = iosConfig.scheme || "iosnativeWebView";
|
|
33
|
+
const APP_BUNDLE_ID = iosConfig.appBundleId || "com.debug.webview";
|
|
34
|
+
const PROJECT_NAME = path.basename(PROJECT_DIR);
|
|
35
|
+
const IPHONE_MODEL = iosConfig.simulatorName;
|
|
36
|
+
const steps = {
|
|
37
|
+
config: "Generating Required Configuration for build",
|
|
38
|
+
deviceDetection: "Detecting Physical Device",
|
|
39
|
+
launchSimulator: "Launch iOS Simulator",
|
|
40
|
+
clean: "Clean Build Artifacts",
|
|
41
|
+
assets: "Process Notification Assets",
|
|
42
|
+
build: "Build IOS Project",
|
|
43
|
+
findApp: "Locate Built Application",
|
|
44
|
+
install: "Install Application",
|
|
45
|
+
launch: "Launch Application"
|
|
46
|
+
};
|
|
47
|
+
const progressConfig = {
|
|
48
|
+
titlePaddingTop: 2,
|
|
49
|
+
titlePaddingBottom: 1,
|
|
50
|
+
stepPaddingLeft: 4,
|
|
51
|
+
stepSpacing: 1,
|
|
52
|
+
errorPaddingLeft: 6,
|
|
53
|
+
bottomMargin: 2
|
|
54
|
+
};
|
|
55
|
+
const progress = new TerminalProgress(steps, "Catalyst iOS Build", progressConfig);
|
|
56
|
+
|
|
57
|
+
// ─── Low-level helpers shared across modules ──────────────────────────────
|
|
58
|
+
|
|
59
|
+
function runCommand(command, options = {}) {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
execFile(shellCommand, shellArgs(command), {
|
|
62
|
+
maxBuffer: 1024 * 1024 * 10,
|
|
63
|
+
...options
|
|
64
|
+
}, (error, stdout, stderr) => {
|
|
65
|
+
if (error) {
|
|
66
|
+
console.error(`Command failed: ${command}`);
|
|
67
|
+
console.error(`Error: ${error.message}`);
|
|
68
|
+
console.error(`stderr: ${stderr}`);
|
|
69
|
+
reject(error);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (stderr) console.warn(`Warning: ${stderr}`);
|
|
73
|
+
resolve(stdout.trim());
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function getXcodeProjectFilePath() {
|
|
78
|
+
return path.join(PROJECT_DIR, `${PROJECT_NAME}.xcodeproj`, "project.pbxproj");
|
|
79
|
+
}
|
|
80
|
+
function ensureManagedBaseline(filePath) {
|
|
81
|
+
const baselinePath = `${filePath}${MANAGED_BASELINE_SUFFIX}`;
|
|
82
|
+
if (!fs.existsSync(baselinePath)) {
|
|
83
|
+
if (!fs.existsSync(filePath)) throw new Error(`Managed baseline source file not found: ${filePath}`);
|
|
84
|
+
fs.copyFileSync(filePath, baselinePath);
|
|
85
|
+
}
|
|
86
|
+
return baselinePath;
|
|
87
|
+
}
|
|
88
|
+
function restoreManagedFileFromBaseline(filePath) {
|
|
89
|
+
const baselinePath = ensureManagedBaseline(filePath);
|
|
90
|
+
fs.copyFileSync(baselinePath, filePath);
|
|
91
|
+
}
|
|
92
|
+
function readPlistObject(filePath) {
|
|
93
|
+
const output = execFileSync("plutil", ["-convert", "json", "-o", "-", filePath], {
|
|
94
|
+
encoding: "utf8"
|
|
95
|
+
});
|
|
96
|
+
return JSON.parse(output);
|
|
97
|
+
}
|
|
98
|
+
function writePlistObject(filePath, value) {
|
|
99
|
+
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal - The generated filename uses path.basename and stays under the fixed project directory.
|
|
100
|
+
const tempPath = path.join(PROJECT_DIR, `.catalyst-${path.basename(filePath)}-${process.pid}.json`);
|
|
101
|
+
fs.writeFileSync(tempPath, JSON.stringify(value, null, 2), "utf8");
|
|
102
|
+
try {
|
|
103
|
+
execFileSync("plutil", ["-convert", "xml1", "-o", filePath, tempPath]);
|
|
104
|
+
} finally {
|
|
105
|
+
fs.rmSync(tempPath, {
|
|
106
|
+
force: true
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ─── Shared context passed to all phase modules ───────────────────────────
|
|
112
|
+
|
|
113
|
+
const ctx = {
|
|
114
|
+
WEBVIEW_CONFIG,
|
|
115
|
+
BUILD_OUTPUT_PATH,
|
|
116
|
+
iosConfig,
|
|
117
|
+
isGoogleSignInEnabled,
|
|
118
|
+
PROJECT_DIR,
|
|
119
|
+
PROJECT_NAME,
|
|
120
|
+
SCHEME_NAME,
|
|
121
|
+
APP_BUNDLE_ID,
|
|
122
|
+
IPHONE_MODEL,
|
|
123
|
+
url,
|
|
124
|
+
PUBLIC_PATH,
|
|
125
|
+
progress,
|
|
126
|
+
runCommand,
|
|
127
|
+
getXcodeProjectFilePath,
|
|
128
|
+
ensureManagedBaseline,
|
|
129
|
+
restoreManagedFileFromBaseline,
|
|
130
|
+
readPlistObject,
|
|
131
|
+
writePlistObject
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// ─── Instantiate phase modules ────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
const {
|
|
137
|
+
generateConfigConstants,
|
|
138
|
+
generateXCConfig,
|
|
139
|
+
updateInfoPlist,
|
|
140
|
+
updateEntitlements
|
|
141
|
+
} = createConfigPhase(ctx);
|
|
142
|
+
const {
|
|
143
|
+
generatePackageSwift,
|
|
144
|
+
updateXcodeProjectPackageDependencies,
|
|
145
|
+
syncPluginResources
|
|
146
|
+
} = createPluginsPhase(ctx);
|
|
147
|
+
const {
|
|
148
|
+
processNotificationAssets,
|
|
149
|
+
copyOfflinePage,
|
|
150
|
+
copySplashscreenAssets,
|
|
151
|
+
copyAppIcon
|
|
152
|
+
} = createAssetsPhase(ctx);
|
|
153
|
+
const {
|
|
154
|
+
cleanBuildArtifacts,
|
|
155
|
+
buildXcodeProject,
|
|
156
|
+
buildProjectForTesting,
|
|
157
|
+
findAppPath,
|
|
158
|
+
moveAppToBuildOutput,
|
|
159
|
+
installAndLaunchApp,
|
|
160
|
+
detectPhysicalDevices,
|
|
161
|
+
buildProjectForPhysicalDevice,
|
|
162
|
+
findPhysicalDeviceAppPath,
|
|
163
|
+
installAndLaunchOnPhysicalDevice,
|
|
164
|
+
launchIOSSimulator,
|
|
165
|
+
getBootedSimulatorUUID
|
|
166
|
+
} = createBuildPhase(ctx);
|
|
167
|
+
|
|
168
|
+
// ─── Orchestrated build flows ─────────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
async function buildForIOS(pluginComposition = {}) {
|
|
171
|
+
const originalDir = process.cwd();
|
|
172
|
+
try {
|
|
173
|
+
await generatePackageSwift(pluginComposition.iosDependencies);
|
|
174
|
+
await updateXcodeProjectPackageDependencies();
|
|
175
|
+
progress.start("assets");
|
|
176
|
+
await processNotificationAssets(WEBVIEW_CONFIG);
|
|
177
|
+
await copyOfflinePage();
|
|
178
|
+
progress.complete("assets");
|
|
179
|
+
await generateXCConfig();
|
|
180
|
+
await copySplashscreenAssets();
|
|
181
|
+
await copyAppIcon();
|
|
182
|
+
progress.log("Changing directory to: " + PROJECT_DIR, "info");
|
|
183
|
+
process.chdir(PROJECT_DIR);
|
|
184
|
+
const physicalDevice = await detectPhysicalDevices();
|
|
185
|
+
let APP_PATH, targetInfo;
|
|
186
|
+
if (physicalDevice) {
|
|
187
|
+
progress.log("🔥 Building for physical device workflow", "success");
|
|
188
|
+
targetInfo = {
|
|
189
|
+
type: "physical",
|
|
190
|
+
name: physicalDevice.name,
|
|
191
|
+
udid: physicalDevice.udid
|
|
192
|
+
};
|
|
193
|
+
await cleanBuildArtifacts();
|
|
194
|
+
progress.start("build");
|
|
195
|
+
try {
|
|
196
|
+
await buildProjectForPhysicalDevice(SCHEME_NAME, APP_BUNDLE_ID, path.join(process.env.HOME, "Library/Developer/Xcode/DerivedData"), PROJECT_NAME, physicalDevice);
|
|
197
|
+
progress.complete("build");
|
|
198
|
+
} catch (error) {
|
|
199
|
+
progress.fail("build", error.message);
|
|
200
|
+
progress.printTreeContent("Physical Device Build Failed", ["Build failed. Please check:", {
|
|
201
|
+
text: "Code signing certificates are properly installed",
|
|
202
|
+
indent: 1,
|
|
203
|
+
prefix: "├─ ",
|
|
204
|
+
color: "yellow"
|
|
205
|
+
}, {
|
|
206
|
+
text: "Provisioning profile matches your bundle ID",
|
|
207
|
+
indent: 1,
|
|
208
|
+
prefix: "├─ ",
|
|
209
|
+
color: "yellow"
|
|
210
|
+
}, {
|
|
211
|
+
text: "Device is connected and trusted",
|
|
212
|
+
indent: 1,
|
|
213
|
+
prefix: "└─ ",
|
|
214
|
+
color: "yellow"
|
|
215
|
+
}]);
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
218
|
+
progress.start("findApp");
|
|
219
|
+
try {
|
|
220
|
+
APP_PATH = await findPhysicalDeviceAppPath();
|
|
221
|
+
progress.log("Found app at: " + APP_PATH, "success");
|
|
222
|
+
progress.complete("findApp");
|
|
223
|
+
} catch (error) {
|
|
224
|
+
progress.fail("findApp", error.message);
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
await installAndLaunchOnPhysicalDevice(APP_PATH, physicalDevice);
|
|
228
|
+
} else {
|
|
229
|
+
progress.log("📱 Building for simulator workflow", "info");
|
|
230
|
+
targetInfo = {
|
|
231
|
+
type: "simulator",
|
|
232
|
+
name: IPHONE_MODEL
|
|
233
|
+
};
|
|
234
|
+
await launchIOSSimulator(IPHONE_MODEL);
|
|
235
|
+
await cleanBuildArtifacts();
|
|
236
|
+
await buildXcodeProject();
|
|
237
|
+
APP_PATH = await findAppPath();
|
|
238
|
+
progress.log("Found app at: " + APP_PATH, "success");
|
|
239
|
+
await installAndLaunchApp(APP_PATH);
|
|
240
|
+
const MOVED_APP_PATH = await moveAppToBuildOutput(APP_PATH);
|
|
241
|
+
APP_PATH = MOVED_APP_PATH;
|
|
242
|
+
}
|
|
243
|
+
progress.printTreeContent("Build Summary", ["Build completed successfully:", {
|
|
244
|
+
text: `Target: ${targetInfo.type === "physical" ? "📱 Physical Device" : "📱 Simulator"}`,
|
|
245
|
+
indent: 1,
|
|
246
|
+
prefix: "├─ ",
|
|
247
|
+
color: "green"
|
|
248
|
+
}, {
|
|
249
|
+
text: `Device: ${targetInfo.name}`,
|
|
250
|
+
indent: 1,
|
|
251
|
+
prefix: "├─ ",
|
|
252
|
+
color: "gray"
|
|
253
|
+
}, {
|
|
254
|
+
text: `App Path: ${APP_PATH}`,
|
|
255
|
+
indent: 1,
|
|
256
|
+
prefix: "├─ ",
|
|
257
|
+
color: "gray"
|
|
258
|
+
}, {
|
|
259
|
+
text: `URL: ${url}`,
|
|
260
|
+
indent: 1,
|
|
261
|
+
prefix: "└─ ",
|
|
262
|
+
color: "gray"
|
|
263
|
+
}]);
|
|
264
|
+
return {
|
|
265
|
+
success: true,
|
|
266
|
+
targetInfo,
|
|
267
|
+
appPath: APP_PATH
|
|
268
|
+
};
|
|
269
|
+
} catch (error) {
|
|
270
|
+
progress.log("Build failed: " + error.message, "error");
|
|
271
|
+
throw error;
|
|
272
|
+
} finally {
|
|
273
|
+
process.chdir(originalDir);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async function buildIosForTesting(pluginComposition = {}) {
|
|
277
|
+
const originalDir = process.cwd();
|
|
278
|
+
try {
|
|
279
|
+
await generateConfigConstants();
|
|
280
|
+
await updateInfoPlist(pluginComposition);
|
|
281
|
+
await updateEntitlements(pluginComposition);
|
|
282
|
+
await syncPluginResources(pluginComposition);
|
|
283
|
+
await generatePackageSwift(pluginComposition.iosDependencies);
|
|
284
|
+
await updateXcodeProjectPackageDependencies();
|
|
285
|
+
await processNotificationAssets(WEBVIEW_CONFIG);
|
|
286
|
+
await copyOfflinePage();
|
|
287
|
+
await generateXCConfig();
|
|
288
|
+
await copySplashscreenAssets();
|
|
289
|
+
await copyAppIcon();
|
|
290
|
+
progress.log("Changing directory to: " + PROJECT_DIR, "info");
|
|
291
|
+
process.chdir(PROJECT_DIR);
|
|
292
|
+
await cleanBuildArtifacts();
|
|
293
|
+
const derivedDataPath = path.join(process.env.HOME, "Library/Developer/Xcode/DerivedData");
|
|
294
|
+
progress.start("build");
|
|
295
|
+
try {
|
|
296
|
+
await buildProjectForTesting(SCHEME_NAME, "iphonesimulator", `platform=iOS Simulator,name=${IPHONE_MODEL}`, APP_BUNDLE_ID, derivedDataPath, PROJECT_NAME);
|
|
297
|
+
progress.complete("build");
|
|
298
|
+
} catch (buildError) {
|
|
299
|
+
progress.log("build-for-testing failed, attempting fallback with booted simulator...", "warning");
|
|
300
|
+
const bootedUUID = await getBootedSimulatorUUID(IPHONE_MODEL);
|
|
301
|
+
if (bootedUUID) {
|
|
302
|
+
await buildProjectForTesting(SCHEME_NAME, "iphonesimulator", `platform=iOS Simulator,id=${bootedUUID}`, APP_BUNDLE_ID, derivedDataPath, PROJECT_NAME);
|
|
303
|
+
progress.complete("build");
|
|
304
|
+
} else {
|
|
305
|
+
progress.fail("build", buildError.message);
|
|
306
|
+
throw buildError;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
progress.log("✅ build-for-testing complete — test bundle ready for xctest runner", "success");
|
|
310
|
+
return {
|
|
311
|
+
success: true
|
|
312
|
+
};
|
|
313
|
+
} catch (error) {
|
|
314
|
+
progress.log("buildIosForTesting failed: " + error.message, "error");
|
|
315
|
+
throw error;
|
|
316
|
+
} finally {
|
|
317
|
+
process.chdir(originalDir);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
generateConfigConstants,
|
|
322
|
+
updateInfoPlist,
|
|
323
|
+
updateEntitlements,
|
|
324
|
+
syncPluginResources,
|
|
325
|
+
generatePackageSwift,
|
|
326
|
+
updateXcodeProjectPackageDependencies,
|
|
327
|
+
processNotificationAssets,
|
|
328
|
+
copyOfflinePage,
|
|
329
|
+
generateXCConfig,
|
|
330
|
+
copySplashscreenAssets,
|
|
331
|
+
copyAppIcon,
|
|
332
|
+
buildForIOS,
|
|
333
|
+
buildIosForTesting,
|
|
334
|
+
progress,
|
|
335
|
+
WEBVIEW_CONFIG,
|
|
336
|
+
PROJECT_DIR,
|
|
337
|
+
SCHEME_NAME
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
module.exports = {
|
|
341
|
+
createIosBuild,
|
|
342
|
+
pwd
|
|
343
|
+
};
|