Skip to content

Commit

Permalink
fix: schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
rharkor committed Nov 12, 2024
1 parent 0b50811 commit be32400
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions packages/cli-helpers/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,37 @@ export const pluginConfigSchema = z.object({
),
})
),
scripts: z.object({
replaceByProjectName: z
.object({
search: z.string(),
root: z.string().refine(
(value) => {
if (!isPathInCurrentScope(value)) {
return false
}
return true
},
{ message: "The path should be relative and in the current directory" }
),
})
.or(
z.object({
scripts: z
.object({
replaceByProjectName: z
.object({
search: z.string(),
paths: z.array(
z.string().refine((value) => {
root: z.string().refine(
(value) => {
if (!isPathInCurrentScope(value)) {
return false
}
return true
})
},
{ message: "The path should be relative and in the current directory" }
),
})
),
}),
.or(
z.object({
search: z.string(),
paths: z.array(
z.string().refine((value) => {
if (!isPathInCurrentScope(value)) {
return false
}
return true
})
),
})
)
.optional(),
})
.optional(),
})

export type TPluginConfig = z.infer<typeof pluginConfigSchema>

0 comments on commit be32400

Please sign in to comment.