-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
50 lines (45 loc) · 1.06 KB
/
build.js
File metadata and controls
50 lines (45 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { build } from 'esbuild';
import fs from 'fs';
import path from 'path';
const copyFile = (src, dest) => {
const destDir = path.dirname(dest);
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
fs.copyFileSync(src, dest);
};
const copyAsciiArt = () => {
const srcPath = 'src/utils/ascii/ascii-art.txt';
const destPaths = [
'dist/utils/ascii/ascii-art.txt',
'dist/ascii-art.txt',
];
destPaths.forEach((dest) => {
copyFile(srcPath, dest);
});
};
// Copy ascii-art.txt to both dist/utils/ascii and dist
copyAsciiArt();
// Build with esbuild
build({
entryPoints: ['src/cli.ts'],
bundle: true,
minify: true,
platform: 'node',
target: 'node16', // Use node16 to ensure compatibility
format: 'esm', // Set the output format to ESM
outfile: 'dist/cli.js',
external: [
'@inquirer/prompts',
'@walletconnect/ethereum-provider',
'node-fetch',
'kleur',
'yargs',
'dotenv',
'execa',
'localtunnel',
'ora',
'qrcode-terminal',
'web3',
],
}).catch(() => process.exit(1));