Skip to content

Commit

Permalink
feat: improve config values by extending default config
Browse files Browse the repository at this point in the history
related to AOEpeople#113
  • Loading branch information
mathiasschopmans committed Mar 13, 2024
1 parent c518635 commit 04053c6
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 135 deletions.
4 changes: 2 additions & 2 deletions bin/techradar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
);
fs.copyFileSync(
path.join(BUILDER_DIR, "data", "config.json"),
path.join(BUILDER_DIR, "data", "config.default.json"),
path.join(CWD, "config.json"),
);
}
Expand All @@ -77,7 +77,7 @@ function calculateHash(file) {
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
let RECREATE_DIR = false;
Expand Down
129 changes: 129 additions & 0 deletions data/config.default.json
Original file line number Diff line number Diff line change
@@ -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?"
}
}
130 changes: 1 addition & 129 deletions data/config.json
Original file line number Diff line number Diff line change
@@ -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?"
}
}
{}
2 changes: 0 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

const config = require("./data/config.json");
const basePath =
config.basePath && config.basePath !== "/" ? config.basePath : "";
Expand Down
2 changes: 1 addition & 1 deletion scripts/buildData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Marked } from "marked";
import { markedHighlight } from "marked-highlight";
import path from "path";

import config from "../data/config.json";
import nextConfig from "../next.config.js";
import config from "../src/lib/config";
import Positioner from "./positioner";

import { Flag, Item } from "@/lib/types";
Expand Down
12 changes: 12 additions & 0 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion src/lib/data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import config from "../../data/config.json";
import data from "../../data/data.json";
import config from "./config";

import { format } from "@/lib/format";
import { Flag, Item, Quadrant, Ring } from "@/lib/types";
Expand Down

0 comments on commit 04053c6

Please sign in to comment.