feat: improve config values by extending default config

related to #113
This commit is contained in:
Mathias Schopmans
2024-03-13 14:19:53 +01:00
parent c5186353a6
commit 04053c6700
7 changed files with 146 additions and 135 deletions

View File

@@ -53,7 +53,7 @@ function bootstrap() {
"Could not find a config.json. Created a bootstrap config.json in your current working directory. Customize it to your needs.", "Could not find a config.json. Created a bootstrap config.json in your current working directory. Customize it to your needs.",
); );
fs.copyFileSync( fs.copyFileSync(
path.join(BUILDER_DIR, "data", "config.json"), path.join(BUILDER_DIR, "data", "config.default.json"),
path.join(CWD, "config.json"), path.join(CWD, "config.json"),
); );
} }
@@ -77,7 +77,7 @@ function calculateHash(file) {
return hashSum.digest("hex"); return hashSum.digest("hex");
} }
const CURRENT_HASH = calculateHash(path.join(CWD, "package.json")); const CURRENT_HASH = calculateHash(path.join(CWD, "package-lock.json"));
// Check if builder dir needs to be recreated // Check if builder dir needs to be recreated
let RECREATE_DIR = false; let RECREATE_DIR = false;

129
data/config.default.json Normal file
View File

@@ -0,0 +1,129 @@
{
"basePath": "/techradar",
"editUrl": "https://github.dev/AOEpeople/techradar/blob/main/radar/{release}/{id}.md",
"colors": {
"foreground": "#fcf2e6",
"background": "#113521",
"highlight": "#d4a373",
"content": "#fff",
"text": "#575757",
"link": "#bc6c25",
"border": "rgba(255, 255, 255, 0.1)",
"tag": "rgba(255, 255, 255, 0.1)"
},
"quadrants": [
{
"id": "languages-and-frameworks",
"title": "Languages & Frameworks",
"description": "A selection of programming languages, alongside essential frameworks for building a variety of custom software.",
"color": "#a3b18a"
},
{
"id": "methods-and-patterns",
"title": "Methods & Patterns",
"description": "Key software development methods and design patterns, covering everything from continuous integration and testing to architecture.",
"color": "#588157"
},
{
"id": "platforms-and-operations",
"title": "Platforms & Operations",
"description": "Technologies and tools for software and infrastructure operations, including platforms and services for managing and scaling applications.",
"color": "#3f633e"
},
{
"id": "tools",
"title": "Tools",
"description": "A range of software tools, from simple productivity enhancers to comprehensive project solutions, catering to various project needs.",
"color": "#40713f"
}
],
"rings": [
{
"id": "adopt",
"title": "Adopt",
"description": "",
"color": "#588157",
"radius": 0.5,
"strokeWidth": 5
},
{
"id": "trial",
"title": "Trial",
"description": "",
"color": "#457b9d",
"radius": 0.69,
"strokeWidth": 3
},
{
"id": "assess",
"title": "Assess",
"description": "",
"color": "#bc6c25",
"radius": 0.85,
"strokeWidth": 2
},
{
"id": "hold",
"title": "Hold",
"description": "",
"color": "#d62828",
"radius": 1,
"strokeWidth": 0.75
}
],
"flags": {
"new": {
"color": "#f1235a",
"title": "New",
"titleShort": "N",
"description": "New in this version"
},
"changed": {
"color": "#40a7d1",
"title": "Changed",
"titleShort": "C",
"description": "Recently changed"
},
"default": {
"description": "Unchanged"
}
},
"chart": {
"size": 800,
"blipSize": 12
},
"social": [
{
"href": "https://twitter.com/aoepeople",
"icon": "x"
},
{
"href": "https://www.linkedin.com/company/aoe",
"icon": "linkedIn"
},
{
"href": "https://www.xing.com/company/aoe",
"icon": "xing"
},
{
"href": "https://github.com/aoepeople",
"icon": "github"
}
],
"imprint": "https://www.aoe.com/en/imprint.html",
"labels": {
"title": "Technology Radar",
"imprint": "Legal Information",
"quadrant": "Quadrant",
"quadrantOverview": "Quadrant Overview",
"zoomIn": "Zoom in",
"filterByTag": "Filter by Tag",
"footer": "The technology radar is a project by AOE GmbH. Feel free to build your own radar based on the open source project.",
"notUpdated": "This item was not updated in last three versions of the Radar. Should it have appeared in one of the more recent editions, there is a good chance it remains pertinent. However, if the item dates back further, its relevance may have diminished and our current evaluation could vary. Regrettably, our capacity to consistently revisit items from past Radar editions is limited.",
"notFound": "404 - Page not found",
"pageAbout": "How to use AOE Technology Radar?",
"pageOverview": "Technologies Overview",
"pageSearch": "Search",
"searchPlaceholder": "What are you looking for?"
}
}

View File

@@ -1,129 +1 @@
{ {}
"basePath": "/techradar",
"editUrl": "https://github.dev/AOEpeople/techradar/blob/main/radar/{release}/{id}.md",
"colors": {
"foreground": "#fcf2e6",
"background": "#113521",
"highlight": "#d4a373",
"content": "#fff",
"text": "#575757",
"link": "#bc6c25",
"border": "rgba(255, 255, 255, 0.1)",
"tag": "rgba(255, 255, 255, 0.1)"
},
"quadrants": [
{
"id": "languages-and-frameworks",
"title": "Languages & Frameworks",
"description": "A selection of programming languages, alongside essential frameworks for building a variety of custom software.",
"color": "#a3b18a"
},
{
"id": "methods-and-patterns",
"title": "Methods & Patterns",
"description": "Key software development methods and design patterns, covering everything from continuous integration and testing to architecture.",
"color": "#588157"
},
{
"id": "platforms-and-operations",
"title": "Platforms & Operations",
"description": "Technologies and tools for software and infrastructure operations, including platforms and services for managing and scaling applications.",
"color": "#3f633e"
},
{
"id": "tools",
"title": "Tools",
"description": "A range of software tools, from simple productivity enhancers to comprehensive project solutions, catering to various project needs.",
"color": "#40713f"
}
],
"rings": [
{
"id": "adopt",
"title": "Adopt",
"description": "",
"color": "#588157",
"radius": 0.5,
"strokeWidth": 5
},
{
"id": "trial",
"title": "Trial",
"description": "",
"color": "#457b9d",
"radius": 0.69,
"strokeWidth": 3
},
{
"id": "assess",
"title": "Assess",
"description": "",
"color": "#bc6c25",
"radius": 0.85,
"strokeWidth": 2
},
{
"id": "hold",
"title": "Hold",
"description": "",
"color": "#d62828",
"radius": 1,
"strokeWidth": 0.75
}
],
"flags": {
"new": {
"color": "#f1235a",
"title": "New",
"titleShort": "N",
"description": "New in this version"
},
"changed": {
"color": "#40a7d1",
"title": "Changed",
"titleShort": "C",
"description": "Recently changed"
},
"default": {
"description": "Unchanged"
}
},
"chart": {
"size": 800,
"blipSize": 12
},
"social": [
{
"href": "https://twitter.com/aoepeople",
"icon": "x"
},
{
"href": "https://www.linkedin.com/company/aoe",
"icon": "linkedIn"
},
{
"href": "https://www.xing.com/company/aoe",
"icon": "xing"
},
{
"href": "https://github.com/aoepeople",
"icon": "github"
}
],
"imprint": "https://www.aoe.com/en/imprint.html",
"labels": {
"title": "Technology Radar",
"imprint": "Legal Information",
"quadrant": "Quadrant",
"quadrantOverview": "Quadrant Overview",
"zoomIn": "Zoom in",
"filterByTag": "Filter by Tag",
"footer": "The technology radar is a project by AOE GmbH. Feel free to build your own radar based on the open source project.",
"notUpdated": "This item was not updated in last three versions of the Radar. Should it have appeared in one of the more recent editions, there is a good chance it remains pertinent. However, if the item dates back further, its relevance may have diminished and our current evaluation could vary. Regrettably, our capacity to consistently revisit items from past Radar editions is limited.",
"notFound": "404 - Page not found",
"pageAbout": "How to use AOE Technology Radar?",
"pageOverview": "Technologies Overview",
"pageSearch": "Search",
"searchPlaceholder": "What are you looking for?"
}
}

View File

@@ -1,5 +1,3 @@
// @ts-check
const config = require("./data/config.json"); const config = require("./data/config.json");
const basePath = const basePath =
config.basePath && config.basePath !== "/" ? config.basePath : ""; config.basePath && config.basePath !== "/" ? config.basePath : "";

View File

@@ -5,8 +5,8 @@ import { Marked } from "marked";
import { markedHighlight } from "marked-highlight"; import { markedHighlight } from "marked-highlight";
import path from "path"; import path from "path";
import config from "../data/config.json";
import nextConfig from "../next.config.js"; import nextConfig from "../next.config.js";
import config from "../src/lib/config";
import Positioner from "./positioner"; import Positioner from "./positioner";
import { Flag, Item } from "@/lib/types"; import { Flag, Item } from "@/lib/types";

12
src/lib/config.ts Normal file
View File

@@ -0,0 +1,12 @@
import defaultConfig from "../../data/config.default.json";
import _userConfig from "../../data/config.json";
const userConfig = _userConfig as typeof defaultConfig;
const config = { ...defaultConfig, ...userConfig };
if (userConfig.colors)
config.colors = { ...defaultConfig.colors, ...userConfig.colors };
if (userConfig.labels)
config.labels = { ...defaultConfig.labels, ...userConfig.labels };
export default config;

View File

@@ -1,5 +1,5 @@
import config from "../../data/config.json";
import data from "../../data/data.json"; import data from "../../data/data.json";
import config from "./config";
import { format } from "@/lib/format"; import { format } from "@/lib/format";
import { Flag, Item, Quadrant, Ring } from "@/lib/types"; import { Flag, Item, Quadrant, Ring } from "@/lib/types";