Full Radar grid with chart

This commit is contained in:
Jarosław Marek
2021-04-28 23:25:52 +12:00
parent ad4c8475f5
commit 13ba3120c3
27 changed files with 493 additions and 369 deletions

View File

@@ -1,9 +1,8 @@
#!/usr/bin/env node
import {createRadar} from "./radar";
import {save} from "./file";
import {copyFileSync, mkdir, mkdirSync} from "fs";
import {quadrants} from "../src/config";
import {copyFileSync, mkdirSync} from "fs";
import {quadrantsMap} from "../src/config";
(async () => {
@@ -14,7 +13,7 @@ import {quadrants} from "../src/config";
copyFileSync('build/index.html', 'build/overview.html')
copyFileSync('build/index.html', 'build/help-and-about-tech-radar.html')
quadrants.forEach(quadrant => {
Object.keys(quadrantsMap).forEach(quadrant => {
copyFileSync('build/index.html', 'build/' + quadrant + '.html')
mkdirSync('build/' + quadrant)
})

View File

@@ -3,7 +3,7 @@ import path from 'path';
import frontmatter from 'front-matter';
import marked from 'marked';
import hljs from 'highlight.js';
import { quadrants, rings, blipFlags } from '../src/config';
import { quadrantsMap, ringsMap, blipFlags } from '../src/config';
import { radarPath, getAllMarkdownFiles } from './file';
import { Item, Revision, ItemAttributes, Radar } from '../src/model';
@@ -27,12 +27,15 @@ export const createRadar = async (): Promise<Radar> => {
};
const checkAttributes = (fileName: string, attributes: FMAttributes) => {
if (attributes.ring && !rings.includes(attributes.ring)) {
throw new Error(`Error: ${fileName} has an illegal value for 'ring' - must be one of ${rings}`);
const validQuadrants = Object.keys(quadrantsMap);
const validRings = Object.keys(ringsMap);
if (attributes.ring && !validRings.includes(attributes.ring)) {
throw new Error(`Error: ${fileName} has an illegal value for 'ring' - must be one of ${validRings}`);
}
if (attributes.quadrant && !quadrants.includes(attributes.quadrant)) {
throw new Error(`Error: ${fileName} has an illegal value for 'quadrant' - must be one of ${quadrants}`);
if (attributes.quadrant && !validQuadrants.includes(attributes.quadrant)) {
throw new Error(`Error: ${fileName} has an illegal value for 'quadrant' - must be one of ${validQuadrants}`);
}
if (!attributes.quadrant || attributes.quadrant === '') {

View File

@@ -2,9 +2,6 @@
import {createRadar} from "./radar";
import {save} from "./file";
import {copyFileSync, mkdir, mkdirSync} from "fs";
import {quadrants} from "../src/config";
export const radarJsonGenerator = (async () => {
try {