add static generation

This commit is contained in:
dennis.ludwig
2021-06-11 11:48:05 +02:00
parent 02c81de12e
commit e2aec44ad7
8 changed files with 132 additions and 116 deletions

View File

@@ -1,42 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assetUrl = exports.isMobileViewport = exports.translate = exports.showEmptyRings = exports.getItemPageNames = exports.rings = exports.quadrants = exports.radarNameShort = exports.radarName = void 0;
exports.radarName = process.env.RADAR_NAME || 'AOE Technology Radar';
exports.radarName = process.env.RADAR_NAME || "AOE Technology Radar";
exports.radarNameShort = exports.radarName;
exports.quadrants = [
'languages-and-frameworks',
'methods-and-patterns',
'platforms-and-aoe-services',
'tools',
"languages-and-frameworks",
"methods-and-patterns",
"platforms-and-aoe-services",
"tools",
];
exports.rings = [
'all',
'adopt',
'trial',
'assess',
'hold'
];
var getItemPageNames = function (items) { return items.map(function (item) { return item.quadrant + "/" + item.name; }); };
exports.rings = ["all", "adopt", "trial", "assess", "hold"];
var getItemPageNames = function (items) {
return items.map(function (item) { return item.quadrant + "/" + item.name; });
};
exports.getItemPageNames = getItemPageNames;
exports.showEmptyRings = false;
var messages = {
'languages-and-frameworks': 'Languages & Frameworks',
'methods-and-patterns': 'Methods & Patterns',
'platforms-and-aoe-services': 'Platforms and Operations',
'tools': 'Tools',
"languages-and-frameworks": "Languages & Frameworks",
"methods-and-patterns": "Methods & Patterns",
"platforms-and-aoe-services": "Platforms and Operations",
tools: "Tools",
};
var translate = function (key) { return (messages[key] || '-'); };
var translate = function (key) { return messages[key] || "-"; };
exports.translate = translate;
function isMobileViewport() {
// return false for server side rendering
if (typeof window == 'undefined')
if (typeof window == "undefined")
return false;
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var width = window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;
return width < 1200;
}
exports.isMobileViewport = isMobileViewport;
function assetUrl(file) {
return process.env.PUBLIC_URL + '/' + file;
// return `/techradar/assets/${file}`
return process.env.PUBLIC_URL + "/" + file;
}
exports.assetUrl = assetUrl;

View File

@@ -46,24 +46,27 @@ var config_1 = require("../src/config");
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
console.log('starting static');
console.log("starting static");
return [4 /*yield*/, radar_1.createRadar()];
case 1:
radar = _a.sent();
fs_1.copyFileSync('build/index.html', 'build/overview.html');
fs_1.copyFileSync('build/index.html', 'build/help-and-about-tech-radar.html');
fs_1.copyFileSync("build/index.html", "build/overview.html");
fs_1.copyFileSync("build/index.html", "build/help-and-about-tech-radar.html");
config_1.quadrants.forEach(function (quadrant) {
fs_1.copyFileSync('build/index.html', 'build/' + quadrant + '.html');
fs_1.mkdirSync('build/' + quadrant);
var destFolder = "build/" + quadrant;
fs_1.copyFileSync("build/index.html", destFolder + ".html");
if (!fs_1.existsSync(destFolder)) {
fs_1.mkdirSync(destFolder);
}
});
radar.items.forEach(function (item) {
fs_1.copyFileSync('build/index.html', 'build/' + item.quadrant + '/' + item.name + '.html');
fs_1.copyFileSync("build/index.html", "build/" + item.quadrant + "/" + item.name + ".html");
});
console.log('created static');
console.log("created static");
return [3 /*break*/, 3];
case 2:
e_1 = _a.sent();
console.error('error:', e_1);
console.error("error:", e_1);
return [3 /*break*/, 3];
case 3: return [2 /*return*/];
}