MCPcopy Create free account
hub / github.com/outerbase/studio / build_dialect

Function build_dialect

build-dialect.js:6–31  ·  view source on GitHub ↗
(dialectName)

Source from the content-addressed store, hash-verified

4const showdown = require("showdown");
5
6function build_dialect(dialectName) {
7 const dialectFolder = path.join(__dirname, "src", "drivers", dialectName);
8 const functionFolder = path.join(dialectFolder, "functions");
9 const functionFiles = fs.readdirSync(functionFolder);
10
11 const functions = {};
12
13 const mdConverter = new showdown.Converter({ tables: true });
14 for (const functionFile of functionFiles) {
15 const mdContent = fs
16 .readFileSync(path.join(functionFolder, functionFile))
17 .toString();
18
19 const mdContentLines = mdContent.split("\n");
20
21 functions[path.parse(functionFile).name] = {
22 syntax: mdContentLines[0],
23 description: mdConverter.makeHtml(mdContentLines.slice(2).join("\n")),
24 };
25 }
26
27 fs.writeFileSync(
28 path.join(dialectFolder, "function-tooltip.json"),
29 JSON.stringify(functions, undefined, 2)
30 );
31}
32
33build_dialect("sqlite");

Callers 1

build-dialect.jsFile · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected