mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-01 07:24:38 -07:00
feat(devtools): migrate devtools package into monorepo (#18936)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import esbuild from 'esbuild';
|
||||
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
|
||||
mkdirSync('dist/client', { recursive: true });
|
||||
|
||||
await esbuild.build({
|
||||
entryPoints: ['client/src/main.tsx'],
|
||||
bundle: true,
|
||||
minify: true,
|
||||
format: 'esm',
|
||||
target: 'es2020',
|
||||
jsx: 'automatic',
|
||||
outfile: 'dist/client/main.js',
|
||||
});
|
||||
|
||||
// Embed client assets as string constants so the devtools server can be
|
||||
// bundled into the CLI without needing readFileSync + __dirname at runtime.
|
||||
const indexHtml = readFileSync('client/index.html', 'utf-8');
|
||||
const clientJs = readFileSync('dist/client/main.js', 'utf-8');
|
||||
|
||||
writeFileSync(
|
||||
'src/_client-assets.ts',
|
||||
`/**\n * @license\n * Copyright 2025 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Auto-generated by esbuild.client.js — do not edit\nexport const INDEX_HTML = ${JSON.stringify(indexHtml)};\nexport const CLIENT_JS = ${JSON.stringify(clientJs)};\n`,
|
||||
);
|
||||
Reference in New Issue
Block a user