Skip to content

Commit 7cae5d8

Browse files
committed
feat: add back the CLI version of tinny to fix CI
1 parent 0453483 commit 7cae5d8

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

local-tests/build.mjs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,37 @@ import { fileURLToPath } from 'url';
55
import { dirname, resolve } from 'path';
66

77
/**
8-
* Builds the project using esbuild.
8+
* Build the CLI enabled version of Tinny.
99
* @returns {Promise<void>} A promise that resolves when the build is complete.
1010
*/
1111
export const build = async () => {
12+
await esbuild.build({
13+
entryPoints: [fileURLToPath(new URL('./test.ts', import.meta.url))],
14+
outfile: fileURLToPath(new URL('./build/test.mjs', import.meta.url)),
15+
bundle: true,
16+
plugins: [
17+
nodeExternalsPlugin({
18+
allowList: [
19+
'ethers',
20+
'@lit-protocol/accs-schemas',
21+
'@lit-protocol/contracts',
22+
'crypto',
23+
'secp256k1',
24+
],
25+
}),
26+
],
27+
platform: 'node',
28+
target: 'esnext',
29+
format: 'esm',
30+
inject: [fileURLToPath(new URL('./shim.mjs', import.meta.url))],
31+
mainFields: ['module', 'main'],
32+
});
33+
};
34+
35+
/**
36+
* Bundle Tinny to be a standalone package.
37+
*/
38+
export const bundle = async () => {
1239
await esbuild.build({
1340
entryPoints: [fileURLToPath(new URL('./index.ts', import.meta.url))],
1441
outfile: fileURLToPath(new URL('./index.js', import.meta.url)),
@@ -37,5 +64,6 @@ export const build = async () => {
3764
(async () => {
3865
const start = Date.now();
3966
await build();
67+
await bundle();
4068
console.log(`[build.mjs] 🚀 Build time: ${Date.now() - start}ms`);
4169
})();

0 commit comments

Comments
 (0)