catalyst-core 0.2.0-beta.3 → 0.3.0-beta.2
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/globals.d.ts +7 -0
- package/dist/index.jsx +8 -0
- package/dist/logger.js +74 -3
- package/dist/native/androidProject/app/build.gradle.kts +45 -4
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +86 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/BridgeUtils.kt +8 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +173 -13
- package/dist/native/androidProject/settings.gradle.kts +10 -0
- package/dist/native/androidSetup.js +300 -8
- package/dist/native/bridge/WebBridge.js +481 -59
- package/dist/native/bridge/constants/NativeInterfaces.js +304 -45
- package/dist/native/bridge/errors.js +250 -26
- package/dist/native/bridge/hooks/index.js +132 -1
- package/dist/native/bridge/hooks/useAI.js +94 -0
- 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 +406 -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 +296 -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 +450 -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 +498 -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 +176 -17
- package/mcp_v2/lib/helpers.js +10 -0
- package/mcp_v2/mcp.js +40 -8
- package/mcp_v2/package.json +1 -0
- package/mcp_v2/tools/build.js +161 -37
- 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 +1,406 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const {
|
|
6
|
+
runCommand,
|
|
7
|
+
runInteractiveCommand
|
|
8
|
+
} = require("../utils.js");
|
|
9
|
+
const TerminalProgress = require("../TerminalProgress.js").default;
|
|
10
|
+
const {
|
|
11
|
+
composeAndroidPlugins
|
|
12
|
+
} = require("../pluginComposerAndroid.js");
|
|
13
|
+
const {
|
|
14
|
+
resolvePluginConfig,
|
|
15
|
+
resolveInternalPluginsRoot
|
|
16
|
+
} = require("../internalPluginUtils.js");
|
|
17
|
+
const createConfigPhase = require("./config.js");
|
|
18
|
+
const createAssetsPhase = require("./assets.js");
|
|
19
|
+
const createBuildPhase = require("./build.js");
|
|
20
|
+
const catalystCorePath = path.dirname(require.resolve("catalyst-core/package.json"));
|
|
21
|
+
const pwd = path.join(catalystCorePath, "dist/native");
|
|
22
|
+
const ANDROID_PACKAGE = "io.yourname.androidproject";
|
|
23
|
+
const steps = {
|
|
24
|
+
config: "Initialize Configuration",
|
|
25
|
+
tools: "Validate Android Tools",
|
|
26
|
+
emulator: "Check and Start Emulator",
|
|
27
|
+
copyAssets: "Copy Build Assets",
|
|
28
|
+
build: "Build and Install Application",
|
|
29
|
+
aab: "Build Signed AAB"
|
|
30
|
+
};
|
|
31
|
+
const progressConfig = {
|
|
32
|
+
titlePaddingTop: 2,
|
|
33
|
+
titlePaddingBottom: 1,
|
|
34
|
+
stepPaddingLeft: 4,
|
|
35
|
+
stepSpacing: 1,
|
|
36
|
+
errorPaddingLeft: 6,
|
|
37
|
+
bottomMargin: 2
|
|
38
|
+
};
|
|
39
|
+
function createAndroidBuild(config) {
|
|
40
|
+
const {
|
|
41
|
+
WEBVIEW_CONFIG,
|
|
42
|
+
BUILD_OUTPUT_PATH
|
|
43
|
+
} = config;
|
|
44
|
+
const configPath = `${process.cwd()}/config/config.json`;
|
|
45
|
+
const publicPath = `${process.cwd()}/public`;
|
|
46
|
+
const progress = new TerminalProgress(steps, "Catalyst Android Build", progressConfig);
|
|
47
|
+
const ctx = {
|
|
48
|
+
WEBVIEW_CONFIG,
|
|
49
|
+
BUILD_OUTPUT_PATH,
|
|
50
|
+
configPath,
|
|
51
|
+
publicPath,
|
|
52
|
+
pwd,
|
|
53
|
+
progress,
|
|
54
|
+
ANDROID_PACKAGE,
|
|
55
|
+
runCommand,
|
|
56
|
+
runInteractiveCommand
|
|
57
|
+
};
|
|
58
|
+
const {
|
|
59
|
+
initializeConfig,
|
|
60
|
+
validateAndroidTools
|
|
61
|
+
} = createConfigPhase(ctx);
|
|
62
|
+
const {
|
|
63
|
+
copyBuildAssets,
|
|
64
|
+
copySplashscreenAssets,
|
|
65
|
+
copyOfflinePage,
|
|
66
|
+
copyIconAssets,
|
|
67
|
+
configureAppName,
|
|
68
|
+
processNotifications
|
|
69
|
+
} = createAssetsPhase(ctx);
|
|
70
|
+
const {
|
|
71
|
+
detectPhysicalDevice,
|
|
72
|
+
testPhysicalDeviceInstallation,
|
|
73
|
+
handleEmulatorSetup,
|
|
74
|
+
buildApp,
|
|
75
|
+
launchApp,
|
|
76
|
+
moveApkToOutputPath,
|
|
77
|
+
buildSignedAAB
|
|
78
|
+
} = createBuildPhase(ctx);
|
|
79
|
+
function syncAIPackageIfEnabled(wvConfig, progress) {
|
|
80
|
+
const aiEnabled = wvConfig?.ai?.enabled === true;
|
|
81
|
+
if (!aiEnabled) return;
|
|
82
|
+
const appNodeModules = path.join(process.cwd(), "node_modules");
|
|
83
|
+
const aiPackageSrc = path.join(appNodeModules, "catalyst-ai");
|
|
84
|
+
if (!fs.existsSync(aiPackageSrc)) {
|
|
85
|
+
progress.log("ai.enabled=true but catalyst-ai not found in node_modules — skipping native AI sync", "warning");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const destDir = path.join(pwd, "node_modules", "catalyst-ai");
|
|
89
|
+
fs.mkdirSync(destDir, {
|
|
90
|
+
recursive: true
|
|
91
|
+
});
|
|
92
|
+
copyDirSync(aiPackageSrc, destDir);
|
|
93
|
+
progress.log("catalyst-ai synced to dist/native/node_modules for Gradle", "success");
|
|
94
|
+
}
|
|
95
|
+
function copyDirSync(src, dest) {
|
|
96
|
+
fs.mkdirSync(dest, {
|
|
97
|
+
recursive: true
|
|
98
|
+
});
|
|
99
|
+
for (const entry of fs.readdirSync(src, {
|
|
100
|
+
withFileTypes: true
|
|
101
|
+
})) {
|
|
102
|
+
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
103
|
+
const s = path.join(src, entry.name); // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
|
|
104
|
+
const d = path.join(dest, entry.name); // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
|
|
105
|
+
entry.isDirectory() ? copyDirSync(s, d) : fs.copyFileSync(s, d);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function buildAndroidApp() {
|
|
109
|
+
let androidConfig = null;
|
|
110
|
+
let targetDevice = null;
|
|
111
|
+
try {
|
|
112
|
+
progress.start("config");
|
|
113
|
+
const {
|
|
114
|
+
WEBVIEW_CONFIG: wvConfig,
|
|
115
|
+
BUILD_OUTPUT_PATH: bop
|
|
116
|
+
} = await initializeConfig();
|
|
117
|
+
androidConfig = wvConfig.android;
|
|
118
|
+
const buildType = androidConfig.buildType || "debug";
|
|
119
|
+
const buildOptimisation = !!androidConfig.buildOptimisation || false;
|
|
120
|
+
progress.complete("config");
|
|
121
|
+
progress.start("tools");
|
|
122
|
+
const {
|
|
123
|
+
ADB_PATH,
|
|
124
|
+
EMULATOR_PATH
|
|
125
|
+
} = validateAndroidTools(androidConfig);
|
|
126
|
+
progress.complete("tools");
|
|
127
|
+
if (buildType !== "release") {
|
|
128
|
+
progress.start("emulator");
|
|
129
|
+
const physicalDevice = await detectPhysicalDevice(ADB_PATH);
|
|
130
|
+
if (physicalDevice) {
|
|
131
|
+
progress.log(`Found physical device: ${physicalDevice.model} (${physicalDevice.id})`, "success");
|
|
132
|
+
const canInstallOnPhysical = await testPhysicalDeviceInstallation(ADB_PATH, physicalDevice.id);
|
|
133
|
+
if (canInstallOnPhysical) {
|
|
134
|
+
targetDevice = {
|
|
135
|
+
type: "physical",
|
|
136
|
+
id: physicalDevice.id,
|
|
137
|
+
model: physicalDevice.model
|
|
138
|
+
};
|
|
139
|
+
progress.log(`Using physical device: ${physicalDevice.model}`, "success");
|
|
140
|
+
} else {
|
|
141
|
+
progress.log("Physical device installation test failed, falling back to emulator", "warning");
|
|
142
|
+
targetDevice = await handleEmulatorSetup(ADB_PATH, EMULATOR_PATH, androidConfig);
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
targetDevice = await handleEmulatorSetup(ADB_PATH, EMULATOR_PATH, androidConfig);
|
|
146
|
+
}
|
|
147
|
+
progress.complete("emulator");
|
|
148
|
+
} else {
|
|
149
|
+
progress.log("Skipping device setup for release build", "info");
|
|
150
|
+
}
|
|
151
|
+
progress.start("copyAssets");
|
|
152
|
+
await copyBuildAssets(androidConfig, buildOptimisation);
|
|
153
|
+
await copySplashscreenAssets();
|
|
154
|
+
await copyOfflinePage();
|
|
155
|
+
await copyIconAssets();
|
|
156
|
+
await configureAppName(androidConfig);
|
|
157
|
+
const pluginConfig = resolvePluginConfig(wvConfig);
|
|
158
|
+
composeAndroidPlugins({
|
|
159
|
+
corePluginsRoot: resolveInternalPluginsRoot(catalystCorePath),
|
|
160
|
+
androidProjectPath: `${pwd}/androidProject`,
|
|
161
|
+
pluginConfig,
|
|
162
|
+
log: (message, status = "info") => progress.log(message, status)
|
|
163
|
+
});
|
|
164
|
+
await processNotifications(wvConfig);
|
|
165
|
+
progress.log(`Build optimization: ${buildOptimisation ? "Enabled" : "Disabled"}`, "info");
|
|
166
|
+
syncAIPackageIfEnabled(wvConfig, progress);
|
|
167
|
+
progress.complete("copyAssets");
|
|
168
|
+
let movedApkPath = null;
|
|
169
|
+
if (buildType === "release") {
|
|
170
|
+
progress.start("aab");
|
|
171
|
+
await buildSignedAAB(androidConfig);
|
|
172
|
+
progress.complete("aab");
|
|
173
|
+
movedApkPath = await moveApkToOutputPath(buildType, bop, androidConfig.appName);
|
|
174
|
+
} else {
|
|
175
|
+
progress.start("build");
|
|
176
|
+
await buildApp(ADB_PATH, androidConfig, buildOptimisation, targetDevice);
|
|
177
|
+
await launchApp(ADB_PATH, buildType, targetDevice);
|
|
178
|
+
progress.complete("build");
|
|
179
|
+
movedApkPath = await moveApkToOutputPath(buildType, bop, androidConfig.appName);
|
|
180
|
+
}
|
|
181
|
+
const summaryItems = ["Build completed successfully:", {
|
|
182
|
+
text: `Build Type: ${buildType}`,
|
|
183
|
+
indent: 1,
|
|
184
|
+
prefix: "├─ ",
|
|
185
|
+
color: "gray"
|
|
186
|
+
}, {
|
|
187
|
+
text: `SDK Path: ${androidConfig.sdkPath}`,
|
|
188
|
+
indent: 1,
|
|
189
|
+
prefix: "├─ ",
|
|
190
|
+
color: "gray"
|
|
191
|
+
}, {
|
|
192
|
+
text: `Build Optimization: ${buildOptimisation ? "Enabled" : "Disabled"}`,
|
|
193
|
+
indent: 1,
|
|
194
|
+
prefix: "├─ ",
|
|
195
|
+
color: "gray"
|
|
196
|
+
}];
|
|
197
|
+
if (buildType === "release") {
|
|
198
|
+
if (movedApkPath) {
|
|
199
|
+
summaryItems.push({
|
|
200
|
+
text: `APK Build Location: ${movedApkPath}`,
|
|
201
|
+
indent: 1,
|
|
202
|
+
prefix: "├─ ",
|
|
203
|
+
color: "green"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
summaryItems.push({
|
|
207
|
+
text: `Output: Signed AAB generated in build-output/`,
|
|
208
|
+
indent: 1,
|
|
209
|
+
prefix: "└─ ",
|
|
210
|
+
color: "green"
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
if (movedApkPath) {
|
|
214
|
+
summaryItems.push({
|
|
215
|
+
text: `APK Build Location: ${movedApkPath}`,
|
|
216
|
+
indent: 1,
|
|
217
|
+
prefix: "├─ ",
|
|
218
|
+
color: "green"
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
if (targetDevice && targetDevice.type === "physical") {
|
|
222
|
+
summaryItems.push({
|
|
223
|
+
text: `Target Device: ${targetDevice.model} (Physical)`,
|
|
224
|
+
indent: 1,
|
|
225
|
+
prefix: "└─ ",
|
|
226
|
+
color: "green"
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
summaryItems.push({
|
|
230
|
+
text: `Target Device: ${androidConfig.emulatorName} (Emulator)`,
|
|
231
|
+
indent: 1,
|
|
232
|
+
prefix: "└─ ",
|
|
233
|
+
color: "gray"
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
progress.printTreeContent("Build Summary", summaryItems);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (progress.currentStep) {
|
|
240
|
+
progress.fail(progress.currentStep.id, error.message);
|
|
241
|
+
const troubleshootingItems = ["Build failed. Please try the following steps:", {
|
|
242
|
+
text: "Check if Android SDK is properly configured",
|
|
243
|
+
indent: 1,
|
|
244
|
+
prefix: "├─ ",
|
|
245
|
+
color: "yellow"
|
|
246
|
+
}, {
|
|
247
|
+
text: "Verify build assets exist in the source directory",
|
|
248
|
+
indent: 1,
|
|
249
|
+
prefix: "├─ ",
|
|
250
|
+
color: "yellow"
|
|
251
|
+
}];
|
|
252
|
+
const buildType = androidConfig?.buildType || "debug";
|
|
253
|
+
if (buildType !== "release") {
|
|
254
|
+
if (error.message.includes("physical device") || error.message.includes("installation test")) {
|
|
255
|
+
troubleshootingItems.push("\nPhysical Device Issues:", {
|
|
256
|
+
text: "Enable Developer Options on your device",
|
|
257
|
+
indent: 1,
|
|
258
|
+
prefix: "├─ ",
|
|
259
|
+
color: "yellow"
|
|
260
|
+
}, {
|
|
261
|
+
text: "Enable USB Debugging in Developer Options",
|
|
262
|
+
indent: 1,
|
|
263
|
+
prefix: "├─ ",
|
|
264
|
+
color: "yellow"
|
|
265
|
+
}, {
|
|
266
|
+
text: 'Accept the "Allow USB Debugging" prompt on your device',
|
|
267
|
+
indent: 1,
|
|
268
|
+
prefix: "├─ ",
|
|
269
|
+
color: "yellow"
|
|
270
|
+
}, {
|
|
271
|
+
text: "Try disconnecting and reconnecting your device",
|
|
272
|
+
indent: 1,
|
|
273
|
+
prefix: "├─ ",
|
|
274
|
+
color: "yellow"
|
|
275
|
+
}, {
|
|
276
|
+
text: 'Check if "adb devices" shows your device as authorized',
|
|
277
|
+
indent: 1,
|
|
278
|
+
prefix: "├─ ",
|
|
279
|
+
color: "yellow"
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
troubleshootingItems.push({
|
|
283
|
+
text: "Verify that the emulator exists and is working",
|
|
284
|
+
indent: 1,
|
|
285
|
+
prefix: "├─ ",
|
|
286
|
+
color: "yellow"
|
|
287
|
+
}, {
|
|
288
|
+
text: "If using physical device, ensure it stays connected",
|
|
289
|
+
indent: 1,
|
|
290
|
+
prefix: "├─ ",
|
|
291
|
+
color: "yellow"
|
|
292
|
+
});
|
|
293
|
+
} else {
|
|
294
|
+
troubleshootingItems.push({
|
|
295
|
+
text: "Verify keystore configuration for release builds",
|
|
296
|
+
indent: 1,
|
|
297
|
+
prefix: "├─ ",
|
|
298
|
+
color: "yellow"
|
|
299
|
+
}, {
|
|
300
|
+
text: "Check that keystore passwords are properly set",
|
|
301
|
+
indent: 1,
|
|
302
|
+
prefix: "├─ ",
|
|
303
|
+
color: "yellow"
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
troubleshootingItems.push({
|
|
307
|
+
text: 'Run "npm run setupEmulator:android" to reconfigure Android settings',
|
|
308
|
+
indent: 1,
|
|
309
|
+
prefix: "└─ ",
|
|
310
|
+
color: "yellow"
|
|
311
|
+
}, "\nVerify Configuration:");
|
|
312
|
+
if (androidConfig) {
|
|
313
|
+
troubleshootingItems.push({
|
|
314
|
+
text: `Build Type: ${buildType}`,
|
|
315
|
+
indent: 1,
|
|
316
|
+
prefix: "├─ ",
|
|
317
|
+
color: "gray"
|
|
318
|
+
}, {
|
|
319
|
+
text: `Android SDK Path: ${androidConfig.sdkPath || "Not configured"}`,
|
|
320
|
+
indent: 1,
|
|
321
|
+
prefix: "├─ ",
|
|
322
|
+
color: "gray"
|
|
323
|
+
});
|
|
324
|
+
if (buildType !== "release") {
|
|
325
|
+
if (targetDevice) {
|
|
326
|
+
troubleshootingItems.push({
|
|
327
|
+
text: `Target Device: ${targetDevice.type === "physical" ? `${targetDevice.model} (Physical)` : `${androidConfig.emulatorName} (Emulator)`}`,
|
|
328
|
+
indent: 1,
|
|
329
|
+
prefix: "└─ ",
|
|
330
|
+
color: "gray"
|
|
331
|
+
});
|
|
332
|
+
} else {
|
|
333
|
+
troubleshootingItems.push({
|
|
334
|
+
text: `Selected Emulator: ${androidConfig.emulatorName || "Not configured"}`,
|
|
335
|
+
indent: 1,
|
|
336
|
+
prefix: "└─ ",
|
|
337
|
+
color: "gray"
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
troubleshootingItems.push({
|
|
342
|
+
text: `Output Path: ${androidConfig.outputPath || "build-output/"}`,
|
|
343
|
+
indent: 1,
|
|
344
|
+
prefix: "└─ ",
|
|
345
|
+
color: "gray"
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
troubleshootingItems.push({
|
|
350
|
+
text: "Configuration could not be loaded",
|
|
351
|
+
indent: 1,
|
|
352
|
+
prefix: "├─ ",
|
|
353
|
+
color: "red"
|
|
354
|
+
}, {
|
|
355
|
+
text: "Check if config/config.json exists and has valid Android configuration",
|
|
356
|
+
indent: 1,
|
|
357
|
+
prefix: "└─ ",
|
|
358
|
+
color: "red"
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
progress.printTreeContent("Troubleshooting Guide", troubleshootingItems);
|
|
362
|
+
}
|
|
363
|
+
throw error;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
async function buildAndroidForTesting() {
|
|
367
|
+
try {
|
|
368
|
+
const {
|
|
369
|
+
WEBVIEW_CONFIG: wvConfig
|
|
370
|
+
} = await initializeConfig();
|
|
371
|
+
const androidConfig = wvConfig.android;
|
|
372
|
+
const buildOptimisation = !!androidConfig.buildOptimisation || false;
|
|
373
|
+
await copyBuildAssets(androidConfig, buildOptimisation);
|
|
374
|
+
await copySplashscreenAssets();
|
|
375
|
+
await copyOfflinePage();
|
|
376
|
+
await copyIconAssets();
|
|
377
|
+
await configureAppName(androidConfig);
|
|
378
|
+
const pluginConfig = resolvePluginConfig(wvConfig);
|
|
379
|
+
composeAndroidPlugins({
|
|
380
|
+
corePluginsRoot: resolveInternalPluginsRoot(catalystCorePath),
|
|
381
|
+
androidProjectPath: `${pwd}/androidProject`,
|
|
382
|
+
pluginConfig,
|
|
383
|
+
log: (message, status = "info") => progress.log(message, status)
|
|
384
|
+
});
|
|
385
|
+
await processNotifications(wvConfig);
|
|
386
|
+
syncAIPackageIfEnabled(wvConfig, progress);
|
|
387
|
+
progress.log("✅ buildAndroidForTesting complete — project ready for gradlew test", "success");
|
|
388
|
+
return {
|
|
389
|
+
success: true
|
|
390
|
+
};
|
|
391
|
+
} catch (error) {
|
|
392
|
+
progress.log("buildAndroidForTesting failed: " + error.message, "error");
|
|
393
|
+
throw error;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
buildAndroidApp,
|
|
398
|
+
buildAndroidForTesting,
|
|
399
|
+
progress,
|
|
400
|
+
WEBVIEW_CONFIG
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
module.exports = {
|
|
404
|
+
createAndroidBuild,
|
|
405
|
+
pwd
|
|
406
|
+
};
|
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
createAndroidBuild,
|
|
5
|
+
pwd
|
|
6
|
+
} = require("./buildAndroid/index.js");
|
|
7
|
+
const {
|
|
8
|
+
WEBVIEW_CONFIG,
|
|
9
|
+
BUILD_OUTPUT_PATH
|
|
10
|
+
} = require(`${process.cwd()}/config/config.json`);
|
|
11
|
+
async function main() {
|
|
12
|
+
const build = createAndroidBuild({
|
|
13
|
+
WEBVIEW_CONFIG,
|
|
14
|
+
BUILD_OUTPUT_PATH
|
|
15
|
+
});
|
|
16
|
+
const {
|
|
17
|
+
buildAndroidApp
|
|
18
|
+
} = build;
|
|
19
|
+
try {
|
|
20
|
+
await buildAndroidApp();
|
|
21
|
+
} catch (error) {
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
if (require.main === module) {
|
|
27
|
+
main();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Legacy re-exports for any tooling that imports from this file directly
|
|
31
|
+
module.exports = {
|
|
32
|
+
createAndroidBuild,
|
|
33
|
+
pwd
|
|
34
|
+
};
|
|
@@ -1,2 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const {
|
|
5
|
+
createIosBuild,
|
|
6
|
+
pwd
|
|
7
|
+
} = require("./buildIos/index.js");
|
|
8
|
+
const {
|
|
9
|
+
composeIosPlugins
|
|
10
|
+
} = require("./pluginComposerIos.js");
|
|
11
|
+
const {
|
|
12
|
+
resolveInternalPluginsRoot,
|
|
13
|
+
resolvePluginConfig
|
|
14
|
+
} = require("./internalPluginUtils.js");
|
|
15
|
+
const catalystCorePath = path.dirname(require.resolve("catalyst-core/package.json"));
|
|
16
|
+
const {
|
|
17
|
+
WEBVIEW_CONFIG,
|
|
18
|
+
BUILD_OUTPUT_PATH
|
|
19
|
+
} = require(`${process.cwd()}/config/config.json`);
|
|
20
|
+
async function main() {
|
|
21
|
+
const build = createIosBuild({
|
|
22
|
+
WEBVIEW_CONFIG,
|
|
23
|
+
BUILD_OUTPUT_PATH
|
|
24
|
+
});
|
|
25
|
+
const {
|
|
26
|
+
progress,
|
|
27
|
+
generateConfigConstants,
|
|
28
|
+
updateInfoPlist,
|
|
29
|
+
updateEntitlements,
|
|
30
|
+
syncPluginResources,
|
|
31
|
+
buildForIOS,
|
|
32
|
+
PROJECT_DIR
|
|
33
|
+
} = build;
|
|
34
|
+
try {
|
|
35
|
+
progress.log("Starting build process...", "info");
|
|
36
|
+
const pluginConfig = resolvePluginConfig(WEBVIEW_CONFIG);
|
|
37
|
+
const pluginComposition = composeIosPlugins({
|
|
38
|
+
corePluginsRoot: resolveInternalPluginsRoot(catalystCorePath),
|
|
39
|
+
iosProjectPath: PROJECT_DIR,
|
|
40
|
+
pluginConfig,
|
|
41
|
+
log: (message, status = "info") => progress.log(message, status)
|
|
42
|
+
});
|
|
43
|
+
await generateConfigConstants();
|
|
44
|
+
await updateInfoPlist(pluginComposition);
|
|
45
|
+
await updateEntitlements(pluginComposition);
|
|
46
|
+
await syncPluginResources(pluginComposition);
|
|
47
|
+
await buildForIOS(pluginComposition);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
progress.log("Build failed: " + error.message, "error");
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
if (require.main === module) {
|
|
55
|
+
main();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Legacy re-exports for any tooling that imports from this file directly
|
|
59
|
+
module.exports = {
|
|
60
|
+
createIosBuild,
|
|
61
|
+
pwd
|
|
62
|
+
};
|