feat(client): add qimingclaw digital adapter
This commit is contained in:
@@ -47,6 +47,24 @@ function stripTauriWindowImport() {
|
||||
fs.writeFileSync(shellPath, source);
|
||||
}
|
||||
|
||||
function injectQimingclawApiAdapter() {
|
||||
const apiPath = path.join(targetRoot, 'src/lib/api.ts');
|
||||
let source = fs.readFileSync(apiPath, 'utf8');
|
||||
if (!source.includes("import { handleQimingclawDigitalApi } from './qimingclawAdapter';")) {
|
||||
source = source.replace(
|
||||
"import { apiOrigin, apiBase } from './basePath';\n",
|
||||
"import { apiOrigin, apiBase } from './basePath';\nimport { handleQimingclawDigitalApi } from './qimingclawAdapter';\n",
|
||||
);
|
||||
}
|
||||
if (!source.includes('const adapterData = await handleQimingclawDigitalApi<T>(path, options);')) {
|
||||
source = source.replace(
|
||||
"): Promise<T> {\n const { timeoutMs = API_FETCH_TIMEOUT_MS, ...fetchOptions } = options;",
|
||||
"): Promise<T> {\n const adapterData = await handleQimingclawDigitalApi<T>(path, options);\n if (adapterData !== undefined) {\n return adapterData;\n }\n\n const { timeoutMs = API_FETCH_TIMEOUT_MS, ...fetchOptions } = options;",
|
||||
);
|
||||
}
|
||||
fs.writeFileSync(apiPath, source);
|
||||
}
|
||||
|
||||
function main() {
|
||||
assertExists(sourceRoot);
|
||||
assertExists(targetRoot);
|
||||
@@ -56,6 +74,7 @@ function main() {
|
||||
}
|
||||
|
||||
stripTauriWindowImport();
|
||||
injectQimingclawApiAdapter();
|
||||
|
||||
console.log(`Synced sgRobot digital UI from ${sourceRoot}`);
|
||||
console.log(`Target: ${targetRoot}`);
|
||||
|
||||
Reference in New Issue
Block a user