@vercel/frameworks
Advanced tools
Comparing version 0.0.17-canary.0 to 0.0.17-canary.1
@@ -8,3 +8,3 @@ [ | ||
"tagline": "Blitz.js: The Fullstack React Framework", | ||
"description": "A brand new Blitz.js app: the output of running `blitz new`", | ||
"description": "A Blitz.js app, created with the `blitz new` command.", | ||
"website": "https://blitzjs.com", | ||
@@ -36,5 +36,6 @@ "detectors": { | ||
"logo": "https://raw.githubusercontent.com/vercel/vercel/master/packages/frameworks/logos/next.svg", | ||
"tagline": "Next.js makes you productive with React instantly — whether you want to build static or dynamic sites. ", | ||
"tagline": "Next.js makes you productive with React instantly — whether you want to build static or dynamic sites.", | ||
"description": "A Next.js app and a Serverless Function API.", | ||
"website": "https://nextjs.org", | ||
"sort": 1, | ||
"detectors": { | ||
@@ -68,2 +69,3 @@ "every": [ | ||
"website": "https://gatsbyjs.org", | ||
"sort": 2, | ||
"detectors": { | ||
@@ -96,3 +98,4 @@ "every": [ | ||
"description": "A Hexo site, created with the Hexo CLI.", | ||
"website": "https://hexo.io/", | ||
"website": "https://hexo.io", | ||
"sort": 3, | ||
"detectors": { | ||
@@ -125,3 +128,4 @@ "every": [ | ||
"description": "An Eleventy site, created with npm init.", | ||
"website": "https://www.11ty.dev/", | ||
"website": "https://www.11ty.dev", | ||
"sort": 4, | ||
"detectors": { | ||
@@ -694,2 +698,3 @@ "every": [ | ||
"website": "https://gohugo.io", | ||
"sort": 5, | ||
"detectors": { | ||
@@ -696,0 +701,0 @@ "some": [ |
@@ -22,2 +22,3 @@ export interface FrameworkDetectionItem { | ||
description: string; | ||
sort?: number; | ||
detectors?: { | ||
@@ -24,0 +25,0 @@ every?: FrameworkDetectionItem[]; |
{ | ||
"name": "@vercel/frameworks", | ||
"version": "0.0.17-canary.0", | ||
"version": "0.0.17-canary.1", | ||
"main": "frameworks.json", | ||
@@ -17,3 +17,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "c68e83f9726e622c3366653aee2674e35ccf4bc9" | ||
"gitHead": "05ffc9ce2b1e78b0a9a0033f3fd4c4d629933d3a" | ||
} |
import Ajv from 'ajv'; | ||
import path from 'path'; | ||
import { join } from 'path'; | ||
import { existsSync } from 'fs'; | ||
import { isString } from 'util'; | ||
import { Framework } from '../'; | ||
const frameworkList = require('../frameworks.json') as Framework[]; | ||
function isString(arg: any): arg is string { | ||
return typeof arg === 'string'; | ||
} | ||
const SchemaFrameworkDetectionItem = { | ||
@@ -63,2 +61,3 @@ type: 'array', | ||
slug: { type: ['string', 'null'] }, | ||
sort: { type: 'number' }, | ||
logo: { type: 'string' }, | ||
@@ -93,8 +92,6 @@ demo: { type: 'string' }, | ||
it('ensure there is an example for every framework', async () => { | ||
const root = path.join(__dirname, '..', '..', '..'); | ||
const getExample = (name: string) => path.join(root, 'examples', name); | ||
const root = join(__dirname, '..', '..', '..'); | ||
const getExample = (name: string) => join(root, 'examples', name); | ||
const frameworks = require('../frameworks.json') as Framework[]; | ||
const result = frameworks | ||
const result = frameworkList | ||
.map(f => f.slug) | ||
@@ -108,6 +105,4 @@ .filter(isString) | ||
it('ensure schema', async () => { | ||
const frameworks = require('../frameworks.json') as Framework[]; | ||
const ajv = new Ajv(); | ||
const result = ajv.validate(Schema, frameworks); | ||
const result = ajv.validate(Schema, frameworkList); | ||
@@ -122,5 +117,3 @@ if (ajv.errors) { | ||
it('ensure logo', async () => { | ||
const frameworks = require('../frameworks.json') as Framework[]; | ||
const missing = frameworks | ||
const missing = frameworkList | ||
.map(f => f.logo) | ||
@@ -131,3 +124,3 @@ .filter(url => { | ||
const name = url.replace(prefix, ''); | ||
return existsSync(path.join(__dirname, '..', 'logos', name)) === false; | ||
return existsSync(join(__dirname, '..', 'logos', name)) === false; | ||
}); | ||
@@ -137,2 +130,13 @@ | ||
}); | ||
it('ensure unique sort number', async () => { | ||
const sortNumToSlug = new Map<number, string | null>(); | ||
frameworkList.forEach(f => { | ||
if (f.sort) { | ||
const duplicateSlug = sortNumToSlug.get(f.sort); | ||
expect(duplicateSlug).toStrictEqual(undefined); | ||
sortNumToSlug.set(f.sort, f.slug); | ||
} | ||
}); | ||
}); | ||
}); |
411517
996