@leonxin/meetgames 0.1.18 → 0.1.19
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/README.md +5 -4
- package/dist/cache.d.ts +16 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +21 -0
- package/dist/cache.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +20 -16
- package/dist/cli.js.map +1 -1
- package/dist/config/meetSdkDefaultConfig.d.ts +7 -11
- package/dist/config/meetSdkDefaultConfig.d.ts.map +1 -1
- package/dist/config/meetSdkDefaultConfig.js +216 -53
- package/dist/config/meetSdkDefaultConfig.js.map +1 -1
- package/dist/config/meetSdkIosConfig.d.ts +4 -5
- package/dist/config/meetSdkIosConfig.d.ts.map +1 -1
- package/dist/config/meetSdkIosConfig.js +19 -19
- package/dist/config/meetSdkIosConfig.js.map +1 -1
- package/dist/contracts/types.d.ts +4 -0
- package/dist/contracts/types.d.ts.map +1 -1
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +2 -0
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/previewPatches.d.ts +2 -2
- package/dist/core/previewPatches.d.ts.map +1 -1
- package/dist/core/previewPatches.js +3 -3
- package/dist/core/previewPatches.js.map +1 -1
- package/dist/core/workspace.d.ts.map +1 -1
- package/dist/core/workspace.js +1 -0
- package/dist/core/workspace.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp/service.d.ts +2 -0
- package/dist/mcp/service.d.ts.map +1 -1
- package/dist/mcp/service.js +8 -7
- package/dist/mcp/service.js.map +1 -1
- package/dist/ops/handlers.d.ts.map +1 -1
- package/dist/ops/handlers.js +4 -0
- package/dist/ops/handlers.js.map +1 -1
- package/dist/remote/sdkHomeDownload.d.ts +4 -5
- package/dist/remote/sdkHomeDownload.d.ts.map +1 -1
- package/dist/remote/sdkHomeDownload.js +38 -12
- package/dist/remote/sdkHomeDownload.js.map +1 -1
- package/docs/API.md +13 -13
- package/docs/CLI.md +27 -13
- package/docs/INTEGRATION.md +7 -6
- package/package.json +1 -1
- package/src/cache.ts +37 -0
- package/src/cli.ts +21 -14
- package/src/config/meetSdkDefaultConfig.ts +243 -59
- package/src/config/meetSdkIosConfig.ts +17 -21
- package/src/contracts/types.ts +4 -0
- package/src/core/doctor.ts +2 -0
- package/src/core/previewPatches.ts +3 -3
- package/src/core/workspace.ts +1 -0
- package/src/index.ts +5 -3
- package/src/mcp/service.ts +11 -7
- package/src/ops/handlers.ts +4 -0
- package/src/remote/sdkHomeDownload.ts +48 -16
- package/config/meetsdk-android.json +0 -171
- package/config/meetsdk-ios.json +0 -15
- package/tests/assemble.test.ts +0 -12
- package/tests/doctor.test.ts +0 -131
- package/tests/downloadGoogleServicesJson.test.ts +0 -47
- package/tests/fetch-remote.test.ts +0 -23
- package/tests/fetchConfigOverrides.test.ts +0 -28
- package/tests/fetchConfigWrite.test.ts +0 -54
- package/tests/fixtures-hosts.test.ts +0 -78
- package/tests/gradle.test.ts +0 -33
- package/tests/integration-json.test.ts +0 -29
- package/tests/ios.codeUtils.test.ts +0 -23
- package/tests/ios.sdkBundle.test.ts +0 -21
- package/tests/loadManifest.test.ts +0 -15
- package/tests/manifest-xml.test.ts +0 -30
- package/tests/mcp.e2e.ts +0 -214
- package/tests/mcp.service.test.ts +0 -53
- package/tests/meetSdkRemoteConfig.test.ts +0 -482
- package/tests/meetSdkRemoteGradle.test.ts +0 -414
- package/tests/pipeline.android.test.ts +0 -149
- package/tests/pipeline.integration-json.test.ts +0 -58
- package/tests/pipeline.ios.test.ts +0 -609
- package/tests/pipeline.preview.patch.test.ts +0 -85
- package/tests/platformSelection.test.ts +0 -77
- package/tests/sdkHomeDownload.test.ts +0 -275
- package/tests/sdkVersionConfig.test.ts +0 -131
- package/tests/topsdk.test.ts +0 -53
- package/tests/topsdkDownloadSdkConfig.test.ts +0 -81
- package/tests/topsdkFeatureModules.test.ts +0 -116
|
@@ -2,11 +2,15 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { syncMeetSdkIosVersionToConfig } from "../config/meetSdkIosConfig.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
MEETSDK_REMOTE_CONFIG_FILENAME,
|
|
7
|
+
hasSdkModuleKey,
|
|
8
|
+
tryParseAsMeetSdkRemoteConfig,
|
|
9
|
+
type MeetSdkRemoteConfig,
|
|
10
|
+
} from "../config/meetSdkRemoteConfig.js";
|
|
6
11
|
import { resolveIosSdkCacheLayout, withCacheLock, writeIosSdkCacheMetadata } from "../cache.js";
|
|
7
12
|
|
|
8
13
|
export const defaultSdkHomeApiBaseUrl = "https://business-api.meetgames.com";
|
|
9
|
-
export const DEFAULT_IOS_SDK_PLUGINS = ["guest", "facebook", "google", "apple", "apple_pay", "dataAppsFlyer"] as const;
|
|
10
14
|
export const DEFAULT_IOS_SDK_PACKAGE_TYPE = "native";
|
|
11
15
|
|
|
12
16
|
const IOS_SDK_DOWNLOAD_PLUGIN_BY_SUBKEY: Record<string, string> = {
|
|
@@ -47,14 +51,14 @@ export interface SdkHomeVersions {
|
|
|
47
51
|
export interface SdkHomeDownloadUrlRequest {
|
|
48
52
|
baseUrl: string;
|
|
49
53
|
version: string;
|
|
50
|
-
platform?: "ios";
|
|
51
|
-
plugins
|
|
54
|
+
platform?: "ios" | "android";
|
|
55
|
+
plugins: readonly string[] | string;
|
|
52
56
|
packageType?: string;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
export interface DownloadIosSdkOptions {
|
|
56
60
|
baseUrl?: string;
|
|
57
|
-
|
|
61
|
+
remoteConfigPath: string;
|
|
58
62
|
packageType?: string;
|
|
59
63
|
cacheRoot?: string;
|
|
60
64
|
signal?: AbortSignal;
|
|
@@ -83,16 +87,22 @@ function joinBaseAndPath(baseUrl: string, subPath: string): URL {
|
|
|
83
87
|
return new URL(subPath, base);
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
function normalizeDownloadPlugins(plugins: readonly string[] | string): string[] {
|
|
91
|
+
const list = (typeof plugins === "string" ? plugins.split(",") : plugins)
|
|
92
|
+
.map((s) => String(s).trim())
|
|
93
|
+
.filter(Boolean);
|
|
94
|
+
if (!list.length) {
|
|
95
|
+
throw new Error(`SDK download plugins must be resolved before requesting sdk-home`);
|
|
96
|
+
}
|
|
97
|
+
return list;
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
function
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
function pluginsToCsv(plugins: readonly string[] | string): string {
|
|
101
|
+
return normalizeDownloadPlugins(plugins).join(",");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function pluginsToList(plugins: readonly string[] | string): string[] {
|
|
105
|
+
return normalizeDownloadPlugins(plugins);
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
export function resolveIosSdkDownloadPluginsFromRemoteConfig(config: MeetSdkRemoteConfig): string[] {
|
|
@@ -109,6 +119,28 @@ export function resolveIosSdkDownloadPluginsFromRemoteConfig(config: MeetSdkRemo
|
|
|
109
119
|
return [...new Set(plugins)];
|
|
110
120
|
}
|
|
111
121
|
|
|
122
|
+
function readIosSdkDownloadPluginsFromRemoteConfigFile(configPath: string): string[] {
|
|
123
|
+
if (!configPath || !fs.existsSync(configPath)) {
|
|
124
|
+
throw new Error(`iOS ${MEETSDK_REMOTE_CONFIG_FILENAME} not found: ${configPath || MEETSDK_REMOTE_CONFIG_FILENAME}`);
|
|
125
|
+
}
|
|
126
|
+
let raw: unknown;
|
|
127
|
+
try {
|
|
128
|
+
raw = JSON.parse(fs.readFileSync(configPath, "utf8")) as unknown;
|
|
129
|
+
} catch {
|
|
130
|
+
throw new Error(`failed to parse iOS ${MEETSDK_REMOTE_CONFIG_FILENAME}: ${configPath}`);
|
|
131
|
+
}
|
|
132
|
+
const remote = tryParseAsMeetSdkRemoteConfig(raw);
|
|
133
|
+
if (!remote) throw new Error(`not a ${MEETSDK_REMOTE_CONFIG_FILENAME} document: ${configPath}`);
|
|
134
|
+
if (remote.devicePlatform !== "ios") {
|
|
135
|
+
throw new Error(`iOS SDK download requires an iOS ${MEETSDK_REMOTE_CONFIG_FILENAME}: ${configPath}`);
|
|
136
|
+
}
|
|
137
|
+
const plugins = resolveIosSdkDownloadPluginsFromRemoteConfig(remote);
|
|
138
|
+
if (!plugins.length) {
|
|
139
|
+
throw new Error(`iOS ${MEETSDK_REMOTE_CONFIG_FILENAME} does not enable any sdk-home iOS plugins: ${configPath}`);
|
|
140
|
+
}
|
|
141
|
+
return plugins;
|
|
142
|
+
}
|
|
143
|
+
|
|
112
144
|
export function buildSdkHomeVersionUrl(baseUrl: string): string {
|
|
113
145
|
return joinBaseAndPath(baseUrl, SDK_HOME_VERSION_PATH).toString();
|
|
114
146
|
}
|
|
@@ -329,11 +361,11 @@ export async function extractZip(zipPath: string, destDir: string): Promise<void
|
|
|
329
361
|
|
|
330
362
|
export async function downloadIosSdkToBundled(
|
|
331
363
|
packageRoot: string,
|
|
332
|
-
options: DownloadIosSdkOptions
|
|
364
|
+
options: DownloadIosSdkOptions
|
|
333
365
|
): Promise<DownloadIosSdkResult> {
|
|
334
366
|
const baseUrl = options.baseUrl || defaultSdkHomeApiBaseUrl;
|
|
335
367
|
const packageType = options.packageType || DEFAULT_IOS_SDK_PACKAGE_TYPE;
|
|
336
|
-
const plugins =
|
|
368
|
+
const plugins = readIosSdkDownloadPluginsFromRemoteConfigFile(options.remoteConfigPath);
|
|
337
369
|
const versionResult = await fetchSdkHomeIosVersion({ baseUrl, signal: options.signal });
|
|
338
370
|
const serverVersion = versionResult.ios.ver;
|
|
339
371
|
const reusableCache = findReusableCachedIosSdk({
|
|
@@ -370,7 +402,7 @@ export async function downloadIosSdkToBundled(
|
|
|
370
402
|
};
|
|
371
403
|
await withCacheLock(cacheLayout.lockDir, downloadAndExtract);
|
|
372
404
|
const iosConfigPath = syncMeetSdkIosVersionToConfig({
|
|
373
|
-
|
|
405
|
+
cacheRoot: options.cacheRoot,
|
|
374
406
|
version,
|
|
375
407
|
date: versionResult.ios.date,
|
|
376
408
|
packageType,
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"topsdk": {
|
|
3
|
-
"version": "1.6.1.3",
|
|
4
|
-
"date": "2026-05-25",
|
|
5
|
-
"groupId": "com.sino.topsdk",
|
|
6
|
-
"repositories": [
|
|
7
|
-
"https://storage-sdk-gameplus.meetsocial.com/repository/TopSdk/"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"sdkModules": {
|
|
11
|
-
"login": {
|
|
12
|
-
"guest": {
|
|
13
|
-
"dependencies": [
|
|
14
|
-
{
|
|
15
|
-
"implementation": "$groupId:guest:$topsdk_version"
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"email": {
|
|
20
|
-
"dependencies": [
|
|
21
|
-
{
|
|
22
|
-
"implementation": "$groupId:email:$topsdk_version"
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
"facebook": {
|
|
27
|
-
"dependencies": [
|
|
28
|
-
{
|
|
29
|
-
"implementation": "$groupId:facebook:$topsdk_version"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
"google": {
|
|
34
|
-
"dependencies": [
|
|
35
|
-
{
|
|
36
|
-
"implementation": "$groupId:google:$topsdk_version"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"twitter": {
|
|
41
|
-
"dependencies": [
|
|
42
|
-
{
|
|
43
|
-
"implementation": "$groupId:twitter:$topsdk_version"
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"snapchat": {
|
|
48
|
-
"dependencies": [
|
|
49
|
-
{
|
|
50
|
-
"implementation": "$groupId:snapchat:$topsdk_version"
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
"line": {
|
|
55
|
-
"dependencies": [
|
|
56
|
-
{
|
|
57
|
-
"implementation": "$groupId:line:$topsdk_version"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
"naver": {
|
|
62
|
-
"dependencies": [
|
|
63
|
-
{
|
|
64
|
-
"implementation": "$groupId:naver:$topsdk_version"
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"kakao": {
|
|
69
|
-
"repositories": [
|
|
70
|
-
"https://devrepo.kakao.com/nexus/content/groups/public/"
|
|
71
|
-
],
|
|
72
|
-
"dependencies": [
|
|
73
|
-
{
|
|
74
|
-
"implementation": "$groupId:kakao:$topsdk_version"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
"tiktok": {
|
|
79
|
-
"repositories": [
|
|
80
|
-
"https://artifact.bytedance.com/repository/AwemeOpenSDK"
|
|
81
|
-
],
|
|
82
|
-
"dependencies": [
|
|
83
|
-
{
|
|
84
|
-
"implementation": "$groupId:tiktok:$topsdk_version"
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
"discord": {
|
|
89
|
-
"dependencies": [
|
|
90
|
-
{
|
|
91
|
-
"implementation": "$groupId:discord:$topsdk_version"
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"payment": {
|
|
97
|
-
"googleIap": {
|
|
98
|
-
"dependencies": [
|
|
99
|
-
{
|
|
100
|
-
"implementation": "$groupId:google-iap:$topsdk_version"
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
"onestoreIap": {
|
|
105
|
-
"repositories": [
|
|
106
|
-
"https://repo.onestore.co.kr/repository/onestore-sdk-public/"
|
|
107
|
-
],
|
|
108
|
-
"dependencies": [
|
|
109
|
-
{
|
|
110
|
-
"implementation": "$groupId:onestore-iap:$topsdk_version"
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
"huaweiIap": {
|
|
115
|
-
"repositories": [
|
|
116
|
-
"https://developer.huawei.com/repo/"
|
|
117
|
-
],
|
|
118
|
-
"dependencies": [
|
|
119
|
-
{
|
|
120
|
-
"implementation": "$groupId:huawei-iap:$topsdk_version"
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
"xiaomiIap": {
|
|
125
|
-
"dependencies": [
|
|
126
|
-
{
|
|
127
|
-
"implementation": "$groupId:xiaomi-iap:$topsdk_version"
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"analytics": {
|
|
133
|
-
"appsflyer": {
|
|
134
|
-
"repositories": [
|
|
135
|
-
"mavenCentral"
|
|
136
|
-
],
|
|
137
|
-
"dependencies": [
|
|
138
|
-
{
|
|
139
|
-
"implementation": "$groupId:appsflyer:$topsdk_version"
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
},
|
|
143
|
-
"facebookdata": {
|
|
144
|
-
"dependencies": [
|
|
145
|
-
{
|
|
146
|
-
"implementation": "$groupId:facebook-data:$topsdk_version"
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
"firebase": {
|
|
151
|
-
"repositories": [
|
|
152
|
-
"google"
|
|
153
|
-
],
|
|
154
|
-
"classpath": "com.google.gms:google-services:4.4.4",
|
|
155
|
-
"applyplugin": "com.google.gms.google-services",
|
|
156
|
-
"dependencies": [
|
|
157
|
-
{
|
|
158
|
-
"implementation": "$groupId:firebase:$topsdk_version"
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
},
|
|
162
|
-
"adjust": {
|
|
163
|
-
"dependencies": [
|
|
164
|
-
{
|
|
165
|
-
"implementation": "$groupId:adjust:$topsdk_version"
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
package/config/meetsdk-ios.json
DELETED
package/tests/assemble.test.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { unwrapRemoteIntegrationPayload } from "../src/android/assembleIntegrationJson.js";
|
|
3
|
-
|
|
4
|
-
describe("assembleIntegrationJson", () => {
|
|
5
|
-
it("unwraps common envelopes", () => {
|
|
6
|
-
const inner = { version: 1, steps: [{ op: "gradle.insertRepositories", args: { urls: ["mavenCentral"] } }] };
|
|
7
|
-
expect(unwrapRemoteIntegrationPayload(inner)).toBe(inner);
|
|
8
|
-
expect(unwrapRemoteIntegrationPayload({ data: inner })).toEqual(inner);
|
|
9
|
-
expect(unwrapRemoteIntegrationPayload({ config: inner })).toEqual(inner);
|
|
10
|
-
expect(unwrapRemoteIntegrationPayload({ android: inner })).toEqual(inner);
|
|
11
|
-
});
|
|
12
|
-
});
|
package/tests/doctor.test.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import { loadManifestFile } from "../src/config/loadManifest.js";
|
|
6
|
-
import { runDoctor } from "../src/core/doctor.js";
|
|
7
|
-
import { detectSinglePlatform, platformContext } from "../src/core/platform.js";
|
|
8
|
-
import { runPipeline } from "../src/core/pipeline.js";
|
|
9
|
-
import { buildWorkspaceContext } from "../src/core/workspace.js";
|
|
10
|
-
import { resolveIosSdkRootFromDirectory } from "../src/remote/sdkHomeDownload.js";
|
|
11
|
-
|
|
12
|
-
const pkgRoot = path.resolve(__dirname, "..");
|
|
13
|
-
const androidLatestRoot = path.join(pkgRoot, "fixtures", "android-test-project", "android-latest-project");
|
|
14
|
-
const iosProjectRoot = path.join(pkgRoot, "fixtures", "ios-test-project", "native-sample");
|
|
15
|
-
const hasIosProjectFixture = fs.existsSync(iosProjectRoot);
|
|
16
|
-
const fixtureIosSdkRoot = resolveIosSdkRootFromDirectory(path.join(pkgRoot, "fixtures", "ios-sdk", "topSDK-ios--V1.6.0.5"));
|
|
17
|
-
|
|
18
|
-
function copyIosProjectToTemp(): string {
|
|
19
|
-
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "meet-ios-doctor-"));
|
|
20
|
-
fs.cpSync(iosProjectRoot, tmp, { recursive: true });
|
|
21
|
-
fs.writeFileSync(
|
|
22
|
-
path.join(tmp, "meetsdk-remote-config.json"),
|
|
23
|
-
JSON.stringify(
|
|
24
|
-
{
|
|
25
|
-
packageName: "com.meetgames.topsdk.demo",
|
|
26
|
-
channel: "APPLE",
|
|
27
|
-
devicePlatform: "ios",
|
|
28
|
-
topsdk: {
|
|
29
|
-
appId: "mock-ios-native-sample-app-id",
|
|
30
|
-
appSecret: "mock-ios-native-sample-app-secret-do-not-use-in-production",
|
|
31
|
-
},
|
|
32
|
-
sdkModules: {
|
|
33
|
-
login: {
|
|
34
|
-
guest: {},
|
|
35
|
-
facebook: {
|
|
36
|
-
clientId: "883695101201170",
|
|
37
|
-
scheme: "fb883695101201170",
|
|
38
|
-
secret: "f840b8663b1351ddcb8f6a640cee18c6",
|
|
39
|
-
name: "top-demo",
|
|
40
|
-
openMessenger: "0",
|
|
41
|
-
},
|
|
42
|
-
google: {
|
|
43
|
-
clientId: "396842465987-8sg3ngohnl5f2r8no5etu401ruv6snql.apps.googleusercontent.com",
|
|
44
|
-
scheme: "com.googleusercontent.apps.396842465987-8sg3ngohnl5f2r8no5etu401ruv6snql",
|
|
45
|
-
},
|
|
46
|
-
apple: {},
|
|
47
|
-
},
|
|
48
|
-
payment: { googleIap: {} },
|
|
49
|
-
analytics: {
|
|
50
|
-
appsflyer: {
|
|
51
|
-
devKey: "af-dev-key",
|
|
52
|
-
appleAppId: "123456789",
|
|
53
|
-
enableDebugLog: true,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
null,
|
|
59
|
-
2
|
|
60
|
-
),
|
|
61
|
-
"utf8"
|
|
62
|
-
);
|
|
63
|
-
return tmp;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function stubSdkHomeVersion(): void {
|
|
67
|
-
vi.stubGlobal(
|
|
68
|
-
"fetch",
|
|
69
|
-
vi.fn(async () => ({
|
|
70
|
-
ok: true,
|
|
71
|
-
status: 200,
|
|
72
|
-
text: async () =>
|
|
73
|
-
JSON.stringify({
|
|
74
|
-
code: 200,
|
|
75
|
-
data: {
|
|
76
|
-
result: {
|
|
77
|
-
android: { ver: "1.6.1.3", date: "2026-05-25" },
|
|
78
|
-
ios: { ver: "1.6.0.5", date: "2026-06-09" },
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
}),
|
|
82
|
-
})) as unknown as typeof fetch
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
describe("doctor", () => {
|
|
87
|
-
beforeEach(() => {
|
|
88
|
-
stubSdkHomeVersion();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
afterEach(() => {
|
|
92
|
-
vi.unstubAllGlobals();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("checks Android integration details from project-root config", async () => {
|
|
96
|
-
const ctx = buildWorkspaceContext(androidLatestRoot, pkgRoot);
|
|
97
|
-
const detected = detectSinglePlatform(ctx);
|
|
98
|
-
expect(detected.ok && detected.platform).toBe("android");
|
|
99
|
-
|
|
100
|
-
const report = await runDoctor(platformContext(ctx, "android"), "android");
|
|
101
|
-
|
|
102
|
-
expect(report.platform).toBe("android");
|
|
103
|
-
expect(report.checks.map((c) => c.name)).toContain("android.repositories");
|
|
104
|
-
expect(report.checks.map((c) => c.name)).toContain("android.dependencies");
|
|
105
|
-
expect(report.checks.map((c) => c.name)).toContain("android.resValues");
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it.skipIf(!hasIosProjectFixture)("checks iOS integration details from project-root config", async () => {
|
|
109
|
-
const tmp = copyIosProjectToTemp();
|
|
110
|
-
try {
|
|
111
|
-
const manifest = loadManifestFile(path.join(pkgRoot, "recipes", "ios-default.yaml"));
|
|
112
|
-
const applyCtx = buildWorkspaceContext(tmp, pkgRoot, { iosSdkRoot: fixtureIosSdkRoot });
|
|
113
|
-
const { report: applyReport } = await runPipeline(applyCtx, manifest, { dryRun: false });
|
|
114
|
-
expect(applyReport.errors).toEqual([]);
|
|
115
|
-
|
|
116
|
-
const ctx = buildWorkspaceContext(tmp, pkgRoot, { iosSdkRoot: fixtureIosSdkRoot });
|
|
117
|
-
const detected = detectSinglePlatform(ctx);
|
|
118
|
-
expect(detected.ok && detected.platform).toBe("ios");
|
|
119
|
-
|
|
120
|
-
const report = await runDoctor(platformContext(ctx, "ios"), "ios");
|
|
121
|
-
|
|
122
|
-
expect(report.platform).toBe("ios");
|
|
123
|
-
expect(report.checks.map((c) => c.name)).toContain("ios.frameworkFiles");
|
|
124
|
-
expect(report.checks.map((c) => c.name)).toContain("ios.urlSchemes.present");
|
|
125
|
-
expect(report.checks.map((c) => c.name)).toContain("ios.appDelegateInjection");
|
|
126
|
-
expect(report.errors).toEqual([]);
|
|
127
|
-
} finally {
|
|
128
|
-
fs.rmSync(tmp, { recursive: true, force: true });
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { resolveGoogleServicesJsonTarget } from "../src/android/downloadGoogleServicesJson.js";
|
|
3
|
-
|
|
4
|
-
describe("resolveGoogleServicesJsonTarget", () => {
|
|
5
|
-
const root = "/proj";
|
|
6
|
-
|
|
7
|
-
it("places file under detected application module with configured name", () => {
|
|
8
|
-
const abs = resolveGoogleServicesJsonTarget(
|
|
9
|
-
root,
|
|
10
|
-
{
|
|
11
|
-
firebase_file_url: "https://x/y.json",
|
|
12
|
-
firebase_file_name: "google-services.json",
|
|
13
|
-
},
|
|
14
|
-
"app"
|
|
15
|
-
);
|
|
16
|
-
expect(abs).toBe("/proj/app/google-services.json");
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("uses non-default module directory", () => {
|
|
20
|
-
const abs = resolveGoogleServicesJsonTarget(
|
|
21
|
-
root,
|
|
22
|
-
{ firebase_file_url: "https://x/y.json", firebase_file_name: "google-services.json" },
|
|
23
|
-
"launcher"
|
|
24
|
-
);
|
|
25
|
-
expect(abs).toBe("/proj/launcher/google-services.json");
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("preserves upload file name with extension", () => {
|
|
29
|
-
const abs = resolveGoogleServicesJsonTarget(
|
|
30
|
-
root,
|
|
31
|
-
{
|
|
32
|
-
firebase_file_url: "https://x/y.json",
|
|
33
|
-
firebase_file_name: "google-services.json",
|
|
34
|
-
},
|
|
35
|
-
"app"
|
|
36
|
-
);
|
|
37
|
-
expect(abs.endsWith("google-services.json")).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("falls back to project root when application module unknown", () => {
|
|
41
|
-
const abs = resolveGoogleServicesJsonTarget(root, {
|
|
42
|
-
firebase_file_url: "https://x/y.json",
|
|
43
|
-
firebase_file_name: "google-services.json",
|
|
44
|
-
});
|
|
45
|
-
expect(abs).toBe("/proj/google-services.json");
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { fetchJsonGet } from "../src/remote/fetchJson.js";
|
|
3
|
-
|
|
4
|
-
describe("fetchJsonGet", () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
vi.unstubAllGlobals();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("parses JSON bodies", async () => {
|
|
10
|
-
vi.stubGlobal(
|
|
11
|
-
"fetch",
|
|
12
|
-
vi.fn(async () => ({
|
|
13
|
-
ok: true,
|
|
14
|
-
status: 200,
|
|
15
|
-
headers: { get: () => "application/json" },
|
|
16
|
-
text: async () => JSON.stringify({ hello: "world" }),
|
|
17
|
-
})) as unknown as typeof fetch
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const body = await fetchJsonGet("https://example.com/cfg.json");
|
|
21
|
-
expect(body).toEqual({ hello: "world" });
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { applyFetchConfigCliOverrides, defaultSdkModules } from "../src/config/meetSdkRemoteConfig.js";
|
|
3
|
-
|
|
4
|
-
describe("applyFetchConfigCliOverrides", () => {
|
|
5
|
-
const base = {
|
|
6
|
-
packageName: "com.from.server",
|
|
7
|
-
channel: "google",
|
|
8
|
-
topsdk: {
|
|
9
|
-
appId: "111",
|
|
10
|
-
appSecret: "server-secret",
|
|
11
|
-
version: "",
|
|
12
|
-
groupId: "",
|
|
13
|
-
repositories: [],
|
|
14
|
-
},
|
|
15
|
-
sdkModules: defaultSdkModules(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
it("overrides topsdk appId and root channel only", () => {
|
|
19
|
-
const out = applyFetchConfigCliOverrides(base, {
|
|
20
|
-
appId: "222",
|
|
21
|
-
channelType: "google",
|
|
22
|
-
});
|
|
23
|
-
expect(out.topsdk.appId).toBe("222");
|
|
24
|
-
expect(out.channel).toBe("GOOGLE");
|
|
25
|
-
expect(out.topsdk.appSecret).toBe("server-secret");
|
|
26
|
-
expect(out.packageName).toBe("com.from.server");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
-
import {
|
|
6
|
-
validateDownloadSdkConfigForWrite,
|
|
7
|
-
writeDownloadSdkConfigRaw,
|
|
8
|
-
} from "../src/config/fetchConfigWrite.js";
|
|
9
|
-
|
|
10
|
-
describe("fetchConfigWrite", () => {
|
|
11
|
-
const tmpDirs: string[] = [];
|
|
12
|
-
|
|
13
|
-
afterEach(() => {
|
|
14
|
-
for (const dir of tmpDirs) {
|
|
15
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
16
|
-
}
|
|
17
|
-
tmpDirs.length = 0;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("writeDownloadSdkConfigRaw preserves response bytes (no JSON re-serialize)", () => {
|
|
21
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "meet-fetch-"));
|
|
22
|
-
tmpDirs.push(dir);
|
|
23
|
-
const out = path.join(dir, "meetsdk-remote-config.json");
|
|
24
|
-
const raw = `{
|
|
25
|
-
"packageName": "com.example.game",
|
|
26
|
-
"channel": "GOOGLE",
|
|
27
|
-
"devicePlatform": "android",
|
|
28
|
-
"topsdk": { "appId": "1", "appSecret": "sec" },
|
|
29
|
-
"sdkModules": { "login": {}, "payment": {}, "analytics": {} }
|
|
30
|
-
}`;
|
|
31
|
-
|
|
32
|
-
writeDownloadSdkConfigRaw(out, raw);
|
|
33
|
-
expect(fs.readFileSync(out, "utf8")).toBe(raw);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("validateDownloadSdkConfigForWrite accepts valid remote config without meetsdk-android fields", () => {
|
|
37
|
-
const body = {
|
|
38
|
-
packageName: "com.example.game",
|
|
39
|
-
channel: "GOOGLE",
|
|
40
|
-
devicePlatform: "android",
|
|
41
|
-
topsdk: { appId: "1", appSecret: "sec" },
|
|
42
|
-
sdkModules: { login: {}, payment: {}, analytics: {} },
|
|
43
|
-
};
|
|
44
|
-
const result = validateDownloadSdkConfigForWrite(body);
|
|
45
|
-
expect(result?.parsed.packageName).toBe("com.example.game");
|
|
46
|
-
expect(result?.parsed.topsdk.version).toBe("");
|
|
47
|
-
expect((result?.parsed as { dependencies?: unknown }).dependencies).toBeUndefined();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("validateDownloadSdkConfigForWrite rejects invalid documents", () => {
|
|
51
|
-
expect(validateDownloadSdkConfigForWrite(null)).toBeNull();
|
|
52
|
-
expect(validateDownloadSdkConfigForWrite({ topsdk: {} })).toBeNull();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { describe, expect, it } from "vitest";
|
|
6
|
-
import { buildWorkspaceContext } from "../src/core/workspace.js";
|
|
7
|
-
|
|
8
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const pkgRoot = path.resolve(here, "..");
|
|
10
|
-
const androidFixtureRoot = path.join(pkgRoot, "fixtures", "android-test-project");
|
|
11
|
-
|
|
12
|
-
function fixtureProjectRoot(...names: string[]): string {
|
|
13
|
-
for (const name of names) {
|
|
14
|
-
const candidate = path.join(androidFixtureRoot, name);
|
|
15
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
16
|
-
}
|
|
17
|
-
return path.join(androidFixtureRoot, names[0] ?? "");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function createAndroidAppModule(root: string, name: string, applicationId: string): void {
|
|
21
|
-
const moduleDir = path.join(root, name);
|
|
22
|
-
fs.mkdirSync(path.join(moduleDir, "src", "main"), { recursive: true });
|
|
23
|
-
fs.writeFileSync(
|
|
24
|
-
path.join(moduleDir, "build.gradle"),
|
|
25
|
-
[
|
|
26
|
-
"plugins {",
|
|
27
|
-
" id 'com.android.application'",
|
|
28
|
-
"}",
|
|
29
|
-
"android {",
|
|
30
|
-
" defaultConfig {",
|
|
31
|
-
` applicationId '${applicationId}'`,
|
|
32
|
-
" }",
|
|
33
|
-
"}",
|
|
34
|
-
"",
|
|
35
|
-
].join("\n"),
|
|
36
|
-
"utf8"
|
|
37
|
-
);
|
|
38
|
-
fs.writeFileSync(path.join(moduleDir, "src", "main", "AndroidManifest.xml"), "<manifest />\n", "utf8");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
describe("fixture host trees", () => {
|
|
42
|
-
const powerRaidRoot = fixtureProjectRoot("power-raid");
|
|
43
|
-
|
|
44
|
-
it("android-latest-project (plugins DSL) resolves application module :app", () => {
|
|
45
|
-
const root = path.join(androidFixtureRoot, "android-latest-project");
|
|
46
|
-
const ctx = buildWorkspaceContext(root, pkgRoot);
|
|
47
|
-
expect(ctx.android?.ok).toBe(true);
|
|
48
|
-
expect(ctx.android?.ok && ctx.android.moduleName).toBe(":app");
|
|
49
|
-
expect(ctx.android?.ok && ctx.android.moduleDir.endsWith(`${path.sep}app`)).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it.skipIf(!fs.existsSync(powerRaidRoot))("power-raid resolves launcher application module", () => {
|
|
53
|
-
const ctx = buildWorkspaceContext(powerRaidRoot, pkgRoot);
|
|
54
|
-
expect(ctx.android?.ok).toBe(true);
|
|
55
|
-
expect(ctx.android?.ok && ctx.android.moduleName).toBe(":launcher");
|
|
56
|
-
expect(ctx.android?.ok && ctx.android.moduleDir.endsWith(`${path.sep}launcher`)).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("requires an Android app module selector when multiple application modules exist", () => {
|
|
60
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), "meet-android-multi-app-"));
|
|
61
|
-
fs.writeFileSync(path.join(root, "settings.gradle"), "include ':app'\ninclude ':demo'\n", "utf8");
|
|
62
|
-
createAndroidAppModule(root, "app", "com.example.app");
|
|
63
|
-
createAndroidAppModule(root, "demo", "com.example.demo");
|
|
64
|
-
|
|
65
|
-
const ambiguous = buildWorkspaceContext(root, pkgRoot);
|
|
66
|
-
expect(ambiguous.android?.ok).toBe(false);
|
|
67
|
-
expect(ambiguous.android?.ok ? "" : ambiguous.android?.error).toContain("MULTIPLE_APPLICATION_MODULES_FOUND: :app, :demo");
|
|
68
|
-
|
|
69
|
-
const selected = buildWorkspaceContext(root, pkgRoot, { appTarget: "demo" });
|
|
70
|
-
expect(selected.android?.ok).toBe(true);
|
|
71
|
-
expect(selected.android?.ok && selected.android.moduleName).toBe(":demo");
|
|
72
|
-
expect(selected.android?.ok && selected.android.moduleDir.endsWith(`${path.sep}demo`)).toBe(true);
|
|
73
|
-
|
|
74
|
-
const missing = buildWorkspaceContext(root, pkgRoot, { appTarget: "missing" });
|
|
75
|
-
expect(missing.android?.ok).toBe(false);
|
|
76
|
-
expect(missing.android?.ok ? "" : missing.android?.error).toContain("ANDROID_APPLICATION_MODULE_NOT_FOUND: :missing");
|
|
77
|
-
});
|
|
78
|
-
});
|