60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import esbuild from 'esbuild';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { createRequire } from 'module';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const require = createRequire(import.meta.url);
|
|
const pkg = require(path.resolve(__dirname, 'package.json'));
|
|
|
|
esbuild
|
|
.build({
|
|
entryPoints: ['packages/cli/index.ts'],
|
|
bundle: true,
|
|
outfile: 'bundle/gemini.js',
|
|
platform: 'node',
|
|
format: 'esm',
|
|
alias: {
|
|
'is-in-ci': path.resolve(
|
|
__dirname,
|
|
'packages/cli/src/patches/is-in-ci.ts',
|
|
),
|
|
},
|
|
define: {
|
|
'process.env.CLI_VERSION': JSON.stringify(pkg.version),
|
|
},
|
|
banner: {
|
|
js: `import { createRequire } from 'module'; const require = createRequire(import.meta.url); globalThis.__filename = require('url').fileURLToPath(import.meta.url); globalThis.__dirname = require('path').dirname(globalThis.__filename);`,
|
|
},
|
|
external: [
|
|
'es-toolkit/compat',
|
|
'ansi-escapes',
|
|
'auto-bind',
|
|
'command-exists',
|
|
'@babel/code-frame',
|
|
'cli-truncate',
|
|
'cli-cursor',
|
|
'@alcalzone/ansi-tokenize',
|
|
'cli-boxes',
|
|
'code-excerpt',
|
|
'chalk',
|
|
'cli-spinners',
|
|
'configstore',
|
|
'gradient-string',
|
|
'devlop',
|
|
'escape-goat',
|
|
'@iarna/toml',
|
|
'@pnpm/npm-conf',
|
|
'deep-extend',
|
|
'ansi-align',
|
|
],
|
|
})
|
|
.catch(() => process.exit(1));
|