Skip to content

Commit

Permalink
Rename appstract to abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
adairrr committed Oct 22, 2024
1 parent 1b112f4 commit 0ffaf10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
16 changes: 8 additions & 8 deletions packages/cli/src/plugins/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ const codegen = (_codegen as any).default as typeof _codegen

type ReactResult = RequiredBy<Plugin, 'run'>

const DISABLED_APPSTRACT_APP_FOR_NAMESPACES_LIST = ['cw-plus']
const DISABLED_ABSTRACT_APP_FOR_NAMESPACES_LIST = ['cw-plus']

type ReactOptions = {
disableAppstractAppFor?: string[]
disableAbstractAppFor?: string[]
}

export function react(options: ReactOptions = {}): ReactResult {
const disableAppstractAppFor = [
...(options.disableAppstractAppFor ?? []),
...DISABLED_APPSTRACT_APP_FOR_NAMESPACES_LIST,
const disableAbstractAppFor = [
...(options.disableAbstractAppFor ?? []),
...DISABLED_ABSTRACT_APP_FOR_NAMESPACES_LIST,
]

return {
Expand Down Expand Up @@ -58,15 +58,15 @@ export function react(options: ReactOptions = {}): ReactResult {

// Guard speicfic contracts to not have the abstract app generated
const contractsWithoutAbstractApp = contracts.filter(({ namespace }) =>
disableAppstractAppFor.includes(namespace),
disableAbstractAppFor.includes(namespace),
)

await codegen({
options: codegenOptions,
contracts: contracts
.filter(
({ namespace }) =>
!disableAppstractAppFor.includes(namespace) &&
!disableAbstractAppFor.includes(namespace) &&
contractsWithoutAbstractApp.every(
(guardedContract) => guardedContract.namespace !== namespace,
),
Expand All @@ -81,7 +81,7 @@ export function react(options: ReactOptions = {}): ReactResult {
contracts: [
...contractsWithoutAbstractApp,
...contracts.filter(({ namespace }) =>
disableAppstractAppFor.includes(namespace),
disableAbstractAppFor.includes(namespace),
),
].map(({ name, path }) => ({ name, dir: path })),
outPath: cosmwasmCodegenDirPath,
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/plugins/vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const codegen = (_codegen as any).default as typeof _codegen
type VanillaResult = RequiredBy<Plugin, 'run'>

type VanillaOptions = {
enableAppstractAppFor?: string[]
enableAbstractAppFor?: string[]
}

export function vanilla(options: VanillaOptions = {}): VanillaResult {
Expand All @@ -36,14 +36,14 @@ export function vanilla(options: VanillaOptions = {}): VanillaResult {
await codegen({
options: codegenOptions,
contracts: contracts
.filter(({ name }) => !options.enableAppstractAppFor?.includes(name))
.filter(({ name }) => !options.enableAbstractAppFor?.includes(name))
.map(({ name, path }) => ({ name, dir: path })),
outPath: cosmwasmCodegenDirPath,
})

if (options.enableAppstractAppFor?.length !== 0) {
if (options.enableAbstractAppFor?.length !== 0) {
const abstractContracts = contracts.filter(({ name }) =>
options.enableAppstractAppFor?.includes(name),
options.enableAbstractAppFor?.includes(name),
)

for (const abstractContract of abstractContracts) {
Expand Down Expand Up @@ -140,7 +140,7 @@ export function vanilla(options: VanillaOptions = {}): VanillaResult {
)

// TODO: Apps are duplicating the type imports
const isAppEnabled = options.enableAppstractAppFor?.includes(
const isAppEnabled = options.enableAbstractAppFor?.includes(
contract.name,
)
const importTypesLine = isAppEnabled
Expand Down
4 changes: 4 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"dependsOn": ["^build"],
"outputs": ["dist/**", "lib/**", "esm/**"]
},
"typecheck": {
"dependsOn": ["build"],
"outputs": []
},
"docgen": {
"dependsOn": ["build"],
"inputs": ["src/**/*.tsx", "src/**/*.ts"],
Expand Down

0 comments on commit 0ffaf10

Please sign in to comment.