forked from many-things/cw-hyperlane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
38 lines (33 loc) · 850 Bytes
/
codegen.ts
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
import codegen from '@cosmwasm/ts-codegen';
import * as fs from 'fs';
import path from 'path';
const SCHEMA_DIR = process.env.SCHEMA_DIR || path.join(process.cwd(), 'schema');
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const capitalize = (str: string): string =>
str.charAt(0).toUpperCase() + str.slice(1);
const contracts = fs
.readdirSync(SCHEMA_DIR, { withFileTypes: true })
.filter((c) => !c.isDirectory())
.map((c) => ({
name: c.name.replace('.json', ''),
dir: SCHEMA_DIR,
}));
codegen({
contracts,
outPath: './dist/',
// options are completely optional ;)
options: {
bundle: {
bundleFile: 'index.ts',
scope: 'contracts',
},
client: {
enabled: true,
},
messageComposer: {
enabled: true,
},
},
}).then(() => {
console.log('✨ all done!');
});