-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
25 lines (22 loc) · 1 KB
/
main.ts
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
import config from "./src_new/config";
import fetch_docs from "./src_new/fetcher";
import { Generator } from "./src_new/generator";
import { Parser } from "./src_new/parser";
import settings from "./src_new/settings";
import { Terminal } from "./src_new/terminal";
import Utils from "./src_new/utils";
// Parse .json files to namespace modules
// const modules = parser.parse_json(json_paths)
async function generate_documentation() {
const json_paths = await fetch_docs(settings.defold_version);
const api_path = config.api_folder + settings.folder_separator;
const modules = Parser.parse_json(json_paths);
const filtered = Parser.filter_json(modules);
Terminal.create_folder(api_path);
Utils.save_file(JSON.stringify(filtered), api_path + "raw_data.json");
const output = Generator.generate(filtered);
Utils.save_file(output.typedata, api_path + "index.d.ts");
Utils.save_file(output.messagedata, api_path + "dmsg.ts");
Utils.save_file(output.propertydata, api_path + "dprop.ts");
}
generate_documentation();