Skip to content

Commit

Permalink
fix: versions key in init script should be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Nov 20, 2024
1 parent 35b9b70 commit 985da14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/utils/create-app-task-run-init-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ async function initRename(args: GetArgsResult, init: InitScript) {
}

async function initCheckVersion(init: InitScript) {
if (init?.versions.anchor) {
await initCheckVersionAnchor(init?.versions.anchor)
if (init?.versions?.anchor) {
await initCheckVersionAnchor(init.versions.anchor)
}
if (init?.versions.solana) {
await initCheckVersionSolana(init?.versions.solana)
if (init?.versions?.solana) {
await initCheckVersionSolana(init.versions.solana)
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/utils/get-init-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ const InitScriptSchema = z
}),
)
.optional(),
versions: z.object({
anchor: z.string().optional(),
solana: z.string().optional(),
}),
versions: z
.object({
anchor: z.string().optional(),
solana: z.string().optional(),
})
.optional(),
})
.optional()

Expand Down

0 comments on commit 985da14

Please sign in to comment.