forked from nicoespeon/gitgraph.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
27 lines (21 loc) · 827 Bytes
/
index.ts
File metadata and controls
27 lines (21 loc) · 827 Bytes
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
import { GitgraphCore } from "@gitgraph/core";
// Domain (rendering logic)
import computeGraphMap from "./compute-graph-map";
// Infrastructure (logger implementations)
import consoleGraphLogger from "./console-graph-logger";
import bufferGraphLogger, { bufferLength } from "./buffer-graph-logger";
class Gitgraph extends GitgraphCore {
// Limiting Gitgraph Core config options is intentional since most of them
// are not yet implemented in node.js.
// Templates options should be limited & customized for the console.
constructor() {
super();
}
}
function render(gitgraph: Gitgraph) {
const graphMap = computeGraphMap(gitgraph);
const useBuffer = graphMap.length > bufferLength();
const logger = useBuffer ? bufferGraphLogger : consoleGraphLogger;
logger(graphMap);
}
export { Gitgraph, render };