add static creator
This commit is contained in:
34
bin/tasks/create-static.js
Normal file
34
bin/tasks/create-static.js
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const radar_1 = require("./radar");
|
||||
const fs_1 = require("fs");
|
||||
const config_1 = require("../src/config");
|
||||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
console.log('starting static');
|
||||
const radar = yield radar_1.createRadar();
|
||||
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(quadrant => {
|
||||
fs_1.copyFileSync('build/index.html', 'build/' + quadrant + '.html');
|
||||
fs_1.mkdirSync('build/' + quadrant);
|
||||
});
|
||||
radar.items.forEach(item => {
|
||||
fs_1.copyFileSync('build/index.html', 'build/' + item.quadrant + '/' + item.name + '.html');
|
||||
});
|
||||
console.log('created static');
|
||||
}
|
||||
catch (e) {
|
||||
console.error('error:', e);
|
||||
}
|
||||
}))();
|
||||
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.radarJsonGenerator = void 0;
|
||||
const radar_1 = require("./radar");
|
||||
const file_1 = require("./file");
|
||||
const fs_1 = require("fs");
|
||||
const config_1 = require("../src/config");
|
||||
exports.radarJsonGenerator = (() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
console.log('start');
|
||||
@@ -33,11 +35,15 @@ ReactDOM.render(
|
||||
document.getElementById('root')
|
||||
);
|
||||
`, 'index.tsx');
|
||||
// getPageNames(radar).map(pageName => {
|
||||
// // const pageHtml = renderPage(radar, pageName);
|
||||
// // save(pageHtml, `${pageName}.html`);
|
||||
// save([pageName, radar], `${pageName}.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(quadrant => {
|
||||
fs_1.copyFileSync('build/index.html', 'build/' + quadrant + '.html');
|
||||
fs_1.mkdirSync('build/' + quadrant);
|
||||
});
|
||||
radar.items.forEach(item => {
|
||||
fs_1.copyFileSync('build/index.html', 'build/' + item.quadrant + '/' + item.name + '.html');
|
||||
});
|
||||
console.log('Built radar');
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"build": "tsc"
|
||||
},
|
||||
"bin": {
|
||||
"aoe_technology_radar": "scripts/build.js"
|
||||
"aoe_technology_radar": "scripts/build.js",
|
||||
"aoe_technology_radar-static": "bin/tasks/create-static.js"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="%RADAR_NAME%" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />-->
|
||||
<meta property="og:title" content="%RADAR_NAME%" />
|
||||
<meta property="og:image" content="%PUBLIC_URL%/logo.svg" />
|
||||
<!-- <meta property="og:image" content="%PUBLIC_URL%/logo.svg" />-->
|
||||
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0, user-scalable=0" />
|
||||
|
||||
29
tasks/create-static.ts
Normal file
29
tasks/create-static.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import {createRadar} from "./radar";
|
||||
import {save} from "./file";
|
||||
import {copyFileSync, mkdir, mkdirSync} from "fs";
|
||||
import {quadrants} from "../src/config";
|
||||
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
console.log('starting static')
|
||||
const radar = await createRadar();
|
||||
|
||||
copyFileSync('build/index.html', 'build/overview.html')
|
||||
copyFileSync('build/index.html', 'build/help-and-about-tech-radar.html')
|
||||
|
||||
quadrants.forEach(quadrant => {
|
||||
copyFileSync('build/index.html', 'build/' + quadrant + '.html')
|
||||
mkdirSync('build/' + quadrant)
|
||||
})
|
||||
radar.items.forEach(item => {
|
||||
copyFileSync('build/index.html', 'build/' + item.quadrant + '/' + item.name + '.html')
|
||||
})
|
||||
|
||||
console.log('created static');
|
||||
} catch (e) {
|
||||
console.error('error:', e);
|
||||
}
|
||||
})()
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import {createRadar} from "./radar";
|
||||
import {save} from "./file";
|
||||
import {copyFileSync, mkdir, mkdirSync} from "fs";
|
||||
import {quadrants} from "../src/config";
|
||||
|
||||
|
||||
export const radarJsonGenerator = (async () => {
|
||||
@@ -27,11 +29,16 @@ ReactDOM.render(
|
||||
);
|
||||
`, 'index.tsx')
|
||||
|
||||
// getPageNames(radar).map(pageName => {
|
||||
// // const pageHtml = renderPage(radar, pageName);
|
||||
// // save(pageHtml, `${pageName}.html`);
|
||||
// save([pageName, radar], `${pageName}.html`)
|
||||
// });
|
||||
copyFileSync('build/index.html', 'build/overview.html')
|
||||
copyFileSync('build/index.html', 'build/help-and-about-tech-radar.html')
|
||||
|
||||
quadrants.forEach(quadrant => {
|
||||
copyFileSync('build/index.html', 'build/' + quadrant + '.html')
|
||||
mkdirSync('build/' + quadrant)
|
||||
})
|
||||
radar.items.forEach(item => {
|
||||
copyFileSync('build/index.html', 'build/' + item.quadrant + '/' + item.name + '.html')
|
||||
})
|
||||
|
||||
console.log('Built radar');
|
||||
} catch (e) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"files": [
|
||||
"tasks/radarjson.ts"
|
||||
"tasks/radarjson.ts",
|
||||
"tasks/create-static.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user