-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRun.js
More file actions
46 lines (43 loc) · 1.3 KB
/
Copy pathRun.js
File metadata and controls
46 lines (43 loc) · 1.3 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
const path = require("path");
const saveApiDocs = require(path.join(__dirname, "src", "SaveApiDocs"));
const convertYamlToMd = require(path.join(__dirname, "src", "ConvertYamlToMd"));
const extractSchema = require(path.join(__dirname, "src", "ExtractSchema"));
const parseMarkdownByTag = require(path.join(
__dirname,
"src",
"ParseMarkdownByTag"
));
const updateMarkdownStyles = require(path.join(
__dirname,
"src",
"UpdateMarkdownStyles"
));
const mdToNotionForDir = require(path.join(
__dirname,
"src",
"MdToNotionForDir"
));
const postTagOnPage = require(path.join(__dirname, "src", "PostTagOnPage"));
async function run({ isMarkdownOnly = false, pathInput = "", env = {} } = {}) {
const {
SERVER_HOST = process.env.SERVER_HOST,
NOTION_API_KEY = process.env.NOTION_API_KEY,
NOTION_PAGE_ID = process.env.NOTION_PAGE_ID,
} = env;
console.log(SERVER_HOST);
console.log(NOTION_API_KEY);
console.log(NOTION_PAGE_ID);
await saveApiDocs(SERVER_HOST, pathInput);
await convertYamlToMd();
if (isMarkdownOnly) {
return;
}
await extractSchema();
await parseMarkdownByTag();
await updateMarkdownStyles();
await mdToNotionForDir();
await postTagOnPage(NOTION_API_KEY, NOTION_PAGE_ID);
}
module.exports = {
run,
};