feat: add basic script to build techradar
This commit is contained in:
committed by
Mathias Schopmans
parent
535c9e8a8f
commit
2682ea4e46
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,6 +24,7 @@
|
|||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.pem
|
*.pem
|
||||||
|
*.tgz
|
||||||
|
|
||||||
# debug
|
# debug
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|||||||
46
bin/techradar.sh
Executable file
46
bin/techradar.sh
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CWD=$(pwd)
|
||||||
|
BUILDER_DIR="$CWD/.techradar"
|
||||||
|
SOURCE_DIR="$CWD/node_modules/aoe_technology_radar"
|
||||||
|
|
||||||
|
PARAMETER=$1 # "build" or "serve"
|
||||||
|
|
||||||
|
function info {
|
||||||
|
echo -e "\033[32m$1\033[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function error {
|
||||||
|
echo "Error: $1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# create builder dir by copying source dir if it does not exist
|
||||||
|
if [ ! -d "$BUILDER_DIR" ]; then
|
||||||
|
cp -R "$SOURCE_DIR" "$BUILDER_DIR" || error "Could not copy $SOURCE_DIR to $BUILDER_DIR"
|
||||||
|
cd "$BUILDER_DIR" || error "Could not change to $BUILDER_DIR"
|
||||||
|
info "Installing npm packages"
|
||||||
|
npm install || error "Could not install npm packages"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -R "$CWD/radar" "$BUILDER_DIR/data/radar" || error "Could not copy $CWD/radar to $BUILDER_DIR/data/radar"
|
||||||
|
cp -R $CWD/public/* "$BUILDER_DIR/public/" || error "Could not copy $CWD/public to $BUILDER_DIR/public"
|
||||||
|
cd "$BUILDER_DIR" || error "Could not change to $BUILDER_DIR"
|
||||||
|
|
||||||
|
info "Building data"
|
||||||
|
npm run build:data
|
||||||
|
|
||||||
|
if [ "$PARAMETER" == "serve" ]; then
|
||||||
|
info "Starting techradar"
|
||||||
|
npm run dev
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PARAMETER" == "build" ]; then
|
||||||
|
info "Building techradar"
|
||||||
|
npm run build
|
||||||
|
if [ -d "$CWD/build" ]; then
|
||||||
|
rm -rf "$CWD/build"
|
||||||
|
fi
|
||||||
|
info "Copying techradar to $CWD/build"
|
||||||
|
mv "$BUILDER_DIR/out" "$CWD/build"
|
||||||
|
fi
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
output: "export",
|
output: "export",
|
||||||
// basePath: '/techradar',
|
// basePath: "/techradar",
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
};
|
};
|
||||||
|
|||||||
1418
package-lock.json
generated
1418
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "aoe-next-techradar",
|
"name": "aoe_technology_radar",
|
||||||
"version": "0.1.0",
|
"version": "4.0.0-alpha.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"bin": {
|
||||||
|
"techradar": "./bin/techradar.sh"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbo",
|
"dev": "next dev --turbo",
|
||||||
"build:icons": "npx @svgr/cli --typescript --no-dimensions --no-prettier --out-dir src/components/Icons -- src/icons",
|
"build:icons": "npx @svgr/cli --typescript --no-dimensions --no-prettier --out-dir src/components/Icons -- src/icons",
|
||||||
@@ -13,33 +16,31 @@
|
|||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"postinstall": "npm run build:icons"
|
"postinstall": "npm run build:icons"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"devDependencies": {
|
||||||
|
"@commitlint/cli": "^19.0.3",
|
||||||
|
"@commitlint/config-conventional": "^19.0.3",
|
||||||
"@radix-ui/react-dialog": "^1.0.5",
|
"@radix-ui/react-dialog": "^1.0.5",
|
||||||
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||||
|
"@types/node": "^20",
|
||||||
|
"@types/react": "^18",
|
||||||
|
"@types/react-dom": "^18",
|
||||||
"clsx": "^2.1.0",
|
"clsx": "^2.1.0",
|
||||||
|
"eslint": "^8.57.0",
|
||||||
|
"eslint-config-next": "14.1.0",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.0.0",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"highlight.js": "^11.9.0",
|
"highlight.js": "^11.9.0",
|
||||||
|
"husky": "^9.0.11",
|
||||||
|
"lint-staged": "^15.2.2",
|
||||||
"marked": "^12.0.0",
|
"marked": "^12.0.0",
|
||||||
"marked-highlight": "^2.1.1",
|
"marked-highlight": "^2.1.1",
|
||||||
"next": "14.1.0",
|
"next": "14.1.0",
|
||||||
"postcss-nested": "^6.0.1",
|
"postcss-nested": "^6.0.1",
|
||||||
"postcss-preset-env": "^9.4.0",
|
"postcss-preset-env": "^9.4.0",
|
||||||
|
"prettier": "^3.2.5",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
"tsx": "^4.7.1"
|
"tsx": "^4.7.1",
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@commitlint/cli": "^18.6.1",
|
|
||||||
"@commitlint/config-conventional": "^18.6.2",
|
|
||||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
||||||
"@types/node": "^20",
|
|
||||||
"@types/react": "^18",
|
|
||||||
"@types/react-dom": "^18",
|
|
||||||
"eslint": "^8",
|
|
||||||
"eslint-config-next": "14.1.0",
|
|
||||||
"husky": "^9.0.11",
|
|
||||||
"lint-staged": "^15.2.2",
|
|
||||||
"prettier": "^3.2.5",
|
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|||||||
@@ -5,15 +5,17 @@ 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 "../next.config.mjs";
|
import config from "../data/config.json";
|
||||||
|
import nextConfig from "../next.config.mjs";
|
||||||
import Positioner from "./positioner";
|
import Positioner from "./positioner";
|
||||||
|
|
||||||
import { getChartConfig, getQuadrants, getRings } from "@/lib/data";
|
|
||||||
import { Flag, Item } from "@/lib/types";
|
import { Flag, Item } from "@/lib/types";
|
||||||
|
|
||||||
const rings = getRings();
|
const {
|
||||||
const quadrants = getQuadrants();
|
rings,
|
||||||
const { size } = getChartConfig();
|
quadrants,
|
||||||
|
chart: { size },
|
||||||
|
} = config;
|
||||||
const positioner = new Positioner(size, quadrants, rings);
|
const positioner = new Positioner(size, quadrants, rings);
|
||||||
|
|
||||||
const marked = new Marked(
|
const marked = new Marked(
|
||||||
@@ -31,8 +33,8 @@ function dataPath(...paths: string[]): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function convertToHtml(markdown: string): string {
|
function convertToHtml(markdown: string): string {
|
||||||
if (config.basePath) {
|
if (nextConfig.basePath) {
|
||||||
markdown = markdown.replace(/]\(\//g, `](${config.basePath}/`);
|
markdown = markdown.replace(/]\(\//g, `](${nextConfig.basePath}/`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let html = marked.parse(markdown.trim()) as string;
|
let html = marked.parse(markdown.trim()) as string;
|
||||||
|
|||||||
Reference in New Issue
Block a user