Skip to content

Commit 8c8c8c8

Browse files
committed
feat: show the size of the bundle files
1 parent 2092f20 commit 8c8c8c8

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

packages/wrapped-keys-lit-actions/esbuild.config.js

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,40 @@ module.exports = {
4949

5050
(async () => {
5151
try {
52-
await esbuild.build({
53-
entryPoints: [
54-
'./src/lib/self-executing-actions/solana/signTransactionWithEncryptedSolanaKey.ts',
55-
'./src/lib/self-executing-actions/solana/signMessageWithEncryptedSolanaKey.ts',
56-
'./src/lib/self-executing-actions/solana/generateEncryptedSolanaPrivateKey.ts',
57-
'./src/lib/self-executing-actions/ethereum/signTransactionWithEncryptedEthereumKey.ts',
58-
'./src/lib/self-executing-actions/ethereum/signMessageWithEncryptedEthereumKey.ts',
59-
'./src/lib/self-executing-actions/ethereum/generateEncryptedEthereumPrivateKey.ts',
60-
'./src/lib/self-executing-actions/common/exportPrivateKey.ts',
61-
'./src/lib/self-executing-actions/common/batchGenerateEncryptedKeys.ts',
62-
],
63-
bundle: true,
64-
minify: true,
65-
sourcemap: false,
66-
treeShaking: true,
67-
outdir: './src/generated/',
68-
inject: ['./buffer.shim.js'],
69-
plugins: [wrapIIFEInStringPlugin],
70-
platform: 'browser',
71-
});
52+
await esbuild
53+
.build({
54+
entryPoints: [
55+
'./src/lib/self-executing-actions/solana/signTransactionWithEncryptedSolanaKey.ts',
56+
'./src/lib/self-executing-actions/solana/signMessageWithEncryptedSolanaKey.ts',
57+
'./src/lib/self-executing-actions/solana/generateEncryptedSolanaPrivateKey.ts',
58+
'./src/lib/self-executing-actions/ethereum/signTransactionWithEncryptedEthereumKey.ts',
59+
'./src/lib/self-executing-actions/ethereum/signMessageWithEncryptedEthereumKey.ts',
60+
'./src/lib/self-executing-actions/ethereum/generateEncryptedEthereumPrivateKey.ts',
61+
'./src/lib/self-executing-actions/common/exportPrivateKey.ts',
62+
'./src/lib/self-executing-actions/common/batchGenerateEncryptedKeys.ts',
63+
],
64+
bundle: true,
65+
minify: true,
66+
sourcemap: false,
67+
treeShaking: true,
68+
outdir: './src/generated/',
69+
inject: ['./buffer.shim.js'],
70+
plugins: [wrapIIFEInStringPlugin],
71+
platform: 'browser',
72+
})
73+
.then((result) => {
74+
result.outputFiles.forEach((file) => {
75+
const bytes = file.text.length;
76+
const mbInBinary = (bytes / (1024 * 1024)).toFixed(4);
77+
const mbInDecimal = (bytes / 1_000_000).toFixed(4);
78+
79+
console.log(
80+
`✅ ${file.path
81+
.split('/')
82+
.pop()}\n- ${mbInDecimal} MB (in decimal)\n- ${mbInBinary} MB (in binary)`
83+
);
84+
});
85+
});
7286
console.log('✅ Lit actions built successfully');
7387
} catch (e) {
7488
console.error('❌ Error building lit actions: ', e);

0 commit comments

Comments
 (0)