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

@@ -31,6 +31,7 @@
"itemsjs": "^2.1.20",
"lint-staged": "^13.2.3",
"mdsvex": "^0.11.0",
"package-name-regex": "^3.0.0",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"rehype-slug": "^5.1.0",

8
pnpm-lock.yaml generated
View File

@@ -53,6 +53,9 @@ devDependencies:
mdsvex:
specifier: ^0.11.0
version: 0.11.0(svelte@4.0.5)
package-name-regex:
specifier: ^3.0.0
version: 3.0.0
prettier:
specifier: ^2.8.8
version: 2.8.8
@@ -2065,6 +2068,11 @@ packages:
aggregate-error: 3.1.0
dev: true
/package-name-regex@3.0.0:
resolution: {integrity: sha512-n4LexlsIvKpV8zfGWDxJIZDqDiZ9kN5JiXgx3K7oy8JbqRdrQvPG8BdJesqvGQMt/bPBG4U0gTf2w+pcNk6VWw==}
engines: {node: '>=14'}
dev: true
/parent-module@1.0.1:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'}

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(),

View File

@@ -12,7 +12,7 @@
"url": "https://svelte.dev/repl/d9616fce34c444d4bcac551cb5bdc0ee?version=3.55.1",
"repository": "https://github.com/dmvvilela/svelte-scrollactive",
"description": "This is a port of vue-scrollactive to Svelte, a lightweight and simple to use component that highlights menu items as you scroll the page, also scrolling to target section when clicked.",
"npm": "https://www.npmjs.com/package/svelte-scrollactive",
"npm": "svelte-scrollactive",
"category": "User Interaction",
"tags": [
"components and libraries",
@@ -213,7 +213,8 @@
},
{
"title": "SCR Svelte Client Router",
"repository": "https://arthurgermano.github.io/svelte-client-router/#/svelte-client-router",
"url": "https://arthurgermano.github.io/svelte-client-router/#/svelte-client-router",
"repository": "https://github.com/arthurgermano/svelte-client-router",
"npm": "svelte-client-router",
"description": "Svelte Client Router is everything you need and think when routing SPA's. This is The Svelte Router for SPA!",
"tags": ["routers"],
@@ -1002,13 +1003,6 @@
"title": "layercake",
"repository": "https://github.com/mhkeller/layercake"
},
{
"category": "CSS and Layout",
"description": "resizable layout component for svelte",
"tags": ["components and libraries", "layout and structure"],
"title": "svelte-layout-resizable",
"repository": "https://github.com/milahu/svelte-layout-resizable"
},
{
"category": "CSS and Layout",
"description": "Arrange infinite card elements according to various layout types like masonry",
@@ -1161,13 +1155,6 @@
"title": "storez",
"repository": "https://github.com/plrenaudin/svelte-storez"
},
{
"category": "Stores",
"description": "Template for client side svelte store",
"tags": ["components and libraries", "stores and state"],
"title": "SvelteStore",
"repository": "https://github.com/gitbreaker222/SvelteStore"
},
{
"category": "Integration",
"description": "Use Svelte components with Vue and React",
@@ -2168,7 +2155,7 @@
"title": "svelte-currency-input",
"repository": "https://github.com/fmaclen/svelte-currency-input",
"description": "A form input that converts numbers to localized currency formats as you type",
"npm": "svelte-currency-input",
"npm": "@canutin/svelte-currency-input",
"category": "Forms & User Input",
"tags": ["forms", "inputs and widgets", "internationalization", "typescript"]
},
@@ -2265,7 +2252,7 @@
"title": "svelte-form-builder",
"repository": "https://github.com/pragmatic-engineering/svelte-form-builder-community",
"description": "A No-Code Form Builder Library",
"npm": "svelte-form-builder-community",
"npm": "@pragmatic-engineering/svelte-form-builder-community",
"category": "Forms & User Input",
"tags": ["forms", "components and libraries"]
},
@@ -2415,7 +2402,7 @@
"title": "SvelteKit-Adapter-Versioned-Worker",
"repository": "https://github.com/hedgehog125/SvelteKit-Adapter-Versioned-Worker",
"description": "A SvelteKit adapter for generating service workers to make PWAs work offline",
"npm": "svelteKit-adapter-versioned-worker",
"npm": "sveltekit-adapter-versioned-worker",
"category": "SvelteKit Adapters"
},
{

View File

@@ -678,5 +678,12 @@
"description": "A Starter Kit with SurrealDB and SvelteKit, featuring Authentication and CRUD Operations + Realtime",
"category": "SvelteKit",
"tags": ["templates", "database", "integrations", "typescript", "ssr"]
},
{
"title": "SvelteStore",
"repository": "https://github.com/gitbreaker222/SvelteStore",
"description": "Template for client side svelte store",
"category": "Svelte",
"tags": ["templates", "stores and state"]
}
]