Stricter npm field validation (#484)

* Add zod schemas for CI validation

* Require npm field for components.json

* Remove svelte-layout-resizable

* Stricter Zod validation

* Stricter repository field validation

* Implement requested changes

* Add back accidentally removed field

* Move SvelteStore to templates.json

* Update category and tags
This commit is contained in:
Lachlan Collins
2023-11-19 23:37:43 +11:00
committed by GitHub
parent eea6508809
commit f3c9859c18
5 changed files with 25 additions and 27 deletions

View File

@@ -1,12 +1,10 @@
import { z } from 'zod';
import packageNameRegex from 'package-name-regex';
export const componentsSchema = z.array(
z.object({
title: z.string(),
npm: z
.string()
.regex(/(@[\w-]+\/)?[\w-]+/)
.optional(),
npm: z.string().regex(packageNameRegex),
url: z.string().url().optional(),
repository: z.string().url(),
description: z.string(),
@@ -46,10 +44,7 @@ export const templatesSchema = z.array(
export const toolsSchema = z.array(
z.object({
title: z.string(),
npm: z
.string()
.regex(/(@[\w-]+\/)?[\w-]+/)
.optional(),
npm: z.string().regex(packageNameRegex).optional(),
url: z.string().url().optional(),
repository: z.string().url(),
description: z.string(),