-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnetlify.sh
More file actions
executable file
·48 lines (41 loc) · 1.17 KB
/
netlify.sh
File metadata and controls
executable file
·48 lines (41 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/env node
const marked = require("marked");
const { join } = require("path");
const { readFileSync, writeFileSync, existsSync, mkdirSync } = require("fs");
const path = "dist";
const file = "index.html";
const readme = readFileSync("./README.md", { encoding: "utf8" });
const html = `
<html>
<head>
<title>UK Clear Addressing API Usage</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css" />
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
</style>
<meta charset="UTF-8">
</head>
<body>
<article class="markdown-body">
${marked(readme)}
</article>
</body>
</html>
`;
const outFile = join(__dirname, path, file);
// Create dist dir if it does not exist
existsSync(path) || mkdirSync(path);
// Write landing page to file
writeFileSync(outFile, html, { encoding: "utf8" });