Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 41 additions & 21 deletions packages/wrapped-keys-lit-actions/esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const wrapIIFEInStringPlugin = {

result.outputFiles.forEach((outputFile) => {
let content = outputFile.text;

// Use JSON.stringify to safely encode the content
const wrappedContent = `/**
* DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD. RUN \`yarn generate-lit-actions\` IN THE ROOT DIRECTORY TO UPDATE THIS FILE.
Expand All @@ -48,24 +47,45 @@ module.exports = {
};

(async () => {
await esbuild.build({
entryPoints: [
'./src/lib/self-executing-actions/solana/signTransactionWithEncryptedSolanaKey.js',
'./src/lib/self-executing-actions/solana/signMessageWithEncryptedSolanaKey.js',
'./src/lib/self-executing-actions/solana/generateEncryptedSolanaPrivateKey.js',
'./src/lib/self-executing-actions/ethereum/signTransactionWithEncryptedEthereumKey.js',
'./src/lib/self-executing-actions/ethereum/signMessageWithEncryptedEthereumKey.js',
'./src/lib/self-executing-actions/ethereum/generateEncryptedEthereumPrivateKey.js',
'./src/lib/self-executing-actions/common/exportPrivateKey.js',
'./src/lib/self-executing-actions/common/batchGenerateEncryptedKeys.js',
],
bundle: true,
minify: true,
sourcemap: false,
treeShaking: true,
outdir: './src/generated/',
inject: ['./buffer.shim.js'],
plugins: [wrapIIFEInStringPlugin],
platform: 'browser',
});
try {
await esbuild
.build({
entryPoints: [
'./src/lib/self-executing-actions/solana/signTransactionWithEncryptedSolanaKey.ts',
'./src/lib/self-executing-actions/solana/signMessageWithEncryptedSolanaKey.ts',
'./src/lib/self-executing-actions/solana/generateEncryptedSolanaPrivateKey.ts',
'./src/lib/self-executing-actions/ethereum/signTransactionWithEncryptedEthereumKey.ts',
'./src/lib/self-executing-actions/ethereum/signMessageWithEncryptedEthereumKey.ts',
'./src/lib/self-executing-actions/ethereum/generateEncryptedEthereumPrivateKey.ts',
'./src/lib/self-executing-actions/common/exportPrivateKey.ts',
'./src/lib/self-executing-actions/common/batchGenerateEncryptedKeys.ts',
],
bundle: true,
minify: true,
sourcemap: false,
treeShaking: true,
outdir: './src/generated/',
inject: ['./buffer.shim.js'],
external: ['ethers'],
plugins: [wrapIIFEInStringPlugin],
platform: 'browser',
})
.then((result) => {
result.outputFiles.forEach((file) => {
const bytes = file.text.length;
const mbInBinary = (bytes / (1024 * 1024)).toFixed(4);
const mbInDecimal = (bytes / 1_000_000).toFixed(4);

console.log(
`✅ ${file.path
.split('/')
.pop()}\n- ${mbInDecimal} MB (in decimal)\n- ${mbInBinary} MB (in binary)`
);
});
});
console.log('✅ Lit actions built successfully');
} catch (e) {
console.error('❌ Error building lit actions: ', e);
process.exit(1);
}
})();
Loading
Loading