Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

1.1 KB
Raw Blame
// Generate the WebView script before Hermes compiles the native JS bundle.
import { createRequire } from 'node:module';
import { readFile, writeFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
const require = createRequire(new URL('../apps/desktop/package.json', import.meta.url));
const { build } = require('esbuild');
const entry = fileURLToPath(new URL('../packages/device-link/src/filePeerRuntime.ts', import.meta.url));
const destination = new URL('../packages/device-link/src/filePeerRuntimeSource.ts', import.meta.url);
const output = await build({ entryPoints: [entry], bundle: true, write: false, format: 'iife', globalName: 'CindyFilePeerRuntime', target: 'es2020', minify: true });
const content = '// Generated by node scripts/file-peer-runtime.mjs. Do not edit.\n' +
  'export const FILE_PEER_RUNTIME_SOURCE = ' + JSON.stringify(output.outputFiles[0].text) + ';\n';
if (process.argv.includes('--check')) {
  if (await readFile(destination, 'utf8') !== content) throw new Error('Run node scripts/file-peer-runtime.mjs');
} else await writeFile(destination, content);