Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run frontmatter validations on run #162

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ install-prerequisites:
install: ruby-version-check
npm ci
bundle install
cd tools/frontmatter-validator
npm ci

validate-frontmatters:
npm --prefix tools/frontmatter-validator run validate

# Using local dependencies, starts a doc site instance on http://localhost:4000.
run: ruby-version-check
run: ruby-version-check validate-frontmatters
netlify dev

run-debug: ruby-version-check
Expand All @@ -42,4 +47,5 @@ kill-ports:
@VITE_PROCESS=$$(lsof -ti:3036) && kill -9 $$VITE_PROCESS || true

vale:
-git diff --name-only --diff-filter=d HEAD | grep '\.md$$' | xargs vale
-git diff --name-only --diff-filter=d HEAD | grep '\.md$$' | xargs vale

2 changes: 1 addition & 1 deletion tools/frontmatter-validator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const YAML = require("yaml");
const Ajv = require("ajv");
const addFormats = require("ajv-formats");

const ajv = new Ajv({ allErrors: true });
const ajv = new Ajv({ allErrors: true, strict: false });
addFormats(ajv);

async function validateFrontmatters() {
Expand Down
3 changes: 2 additions & 1 deletion tools/frontmatter-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"validate": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
Expand Down