-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcodama.mjs
More file actions
33 lines (31 loc) · 876 Bytes
/
codama.mjs
File metadata and controls
33 lines (31 loc) · 876 Bytes
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
import { readFileSync } from 'node:fs';
import { parse as parseToml } from '@iarna/toml';
const cargo = parseToml(readFileSync('Cargo.toml', 'utf-8'));
const nightly = cargo?.workspace?.metadata?.toolchains?.format;
const prettierOptions = JSON.parse(readFileSync('clients/js/.prettierrc.json', 'utf-8'));
export default {
idl: 'idl.json',
before: [
{
from: 'codama#updateProgramsVisitor',
args: [{ solanaFeatureGateProgram: { name: 'featureGate' } }],
},
],
scripts: {
js: {
from: '@codama/renderers-js',
args: ['clients/js', { kitImportStrategy: 'rootOnly', prettierOptions }],
},
rust: {
from: '@codama/renderers-rust',
args: [
'clients/rust',
{
anchorTraits: false,
formatCode: true,
toolchain: nightly ? `+${nightly}` : '',
},
],
},
},
};