Skip to content

Commit 26c4409

Browse files
committed
feat: disallow specific contract names
1 parent a191e38 commit 26c4409

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

.changeset/rude-coins-poke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@abstract-money/cli": patch
3+
---
4+
5+
Disallow `proxy` and `manager` from codegen.

packages/cli/src/plugins/react.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { camelCase, constantCase, pascalCase } from 'change-case'
55
import dedent from 'dedent'
66
import { default as fse } from 'fs-extra'
77
import { join, relative, resolve } from 'pathe'
8+
import { DISALLOWED_CONTRACT_NAMES } from 'src/utils/disallowed-contract-names'
89
import type { Plugin } from '../config'
910
import type { RequiredBy } from '../types'
1011

@@ -17,6 +18,15 @@ export function react(): ReactResult {
1718
return {
1819
name: 'React',
1920
async run({ contracts, out, isTypeScript }) {
21+
// Check for disallowed contract names
22+
23+
if (
24+
contracts.some(({ name }) => DISALLOWED_CONTRACT_NAMES.includes(name))
25+
)
26+
throw new Error(
27+
'`proxy` and `manager` contract generations are disallowed. Use `@abstract-money/core` methods or `@abstract-money/react` methods',
28+
)
29+
2030
// Prepare default config options
2131
const codegenOptions = {
2232
client: { enabled: true },
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DISALLOWED_CONTRACT_NAMES = ['proxy', 'manager']

0 commit comments

Comments
 (0)