This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
attribute.ts | ||
mod.ts | ||
model/abstract.ts | ||
model/attributes_base.ts | ||
model/clusters.ts | ||
model/edges.ts | ||
model/nodes.ts | ||
model/root_clusters.ts | ||
render/renderer.ts | ||
usecase.ts | ||
render/to_dot.ts | ||
render/utils.ts | ||
render/renderer.ts | ||
types.ts | ||
usecase.ts | ||
model/nodes.ts | ||
model/edges.ts | ||
model/root_clusters.ts | ||
model/clusters.ts | ||
model/attributes_base.ts | ||
model/abstract.ts | ||
mod.ts | ||
attribute.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.PHONY: fmt test doc fetch_latest | ||
|
||
fmt: | ||
@deno fmt | ||
|
||
test: | ||
@deno test --unstable | ||
|
||
doc: | ||
@deno doc ./mod.ts | ||
|
||
fetch_latest: | ||
@deno run --unstable --allow-run --allow-read --allow-write scripts/fetch_latest.ts | ||
@deno fmt | ||
@deno fmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as path from "https://deno.land/std/path/mod.ts"; | ||
import { denolize } from "https://raw.githubusercontent.com/kamiazya/denolize/master/mod.ts"; | ||
|
||
const encoder = new TextEncoder(); | ||
const decoder = new TextDecoder(); | ||
|
||
const repository = "[email protected]:ts-graphviz/ts-graphviz.git"; | ||
const repositorySrcDir = "src"; | ||
const outDir = "."; | ||
const denolizedFilePath = `${outDir}/.denolized`; | ||
|
||
const workDir = await Deno.makeTempDir({ | ||
prefix: "tsgraphviz", | ||
}); | ||
const rootDir = path.join(workDir, repositorySrcDir); | ||
|
||
async function readDenolizedFiles() { | ||
const files = await Deno.readFile(denolizedFilePath).then((buf) => | ||
decoder.decode(buf).split("\n") | ||
); | ||
return files; | ||
} | ||
|
||
async function writeDenolizedFiles(files: string[]) { | ||
await Deno.writeFile(denolizedFilePath, encoder.encode(files.join("\n"))); | ||
} | ||
|
||
try { | ||
const denolizedFiles = await readDenolizedFiles(); | ||
for (const denolizedFile of denolizedFiles) { | ||
const info = await Deno.stat(denolizedFile); | ||
if (info.isFile) { | ||
await Deno.remove(denolizedFile); | ||
} | ||
} | ||
|
||
console.log("Clone start ts-graphviz/ts-graphviz"); | ||
const ps = Deno.run({ | ||
cmd: ["git", "clone", repository, workDir], | ||
}); | ||
const status = await ps.status(); | ||
if (status.success) { | ||
console.log("Clone Succeeded!"); | ||
const files = []; | ||
for await (const source of denolize(rootDir)) { | ||
const outputPath = path.join( | ||
outDir, | ||
path.relative(rootDir, source.fileName), | ||
); | ||
await Deno.mkdir(path.dirname(outputPath), { recursive: true }); | ||
await Deno.writeFile(outputPath, encoder.encode(source.text)); | ||
|
||
const resolvedOutputPath = path.relative(outDir, outputPath); | ||
files.push(resolvedOutputPath); | ||
console.log(`WRITE ${resolvedOutputPath}`); | ||
} | ||
await writeDenolizedFiles(files); | ||
} | ||
} finally { | ||
await Deno.remove(workDir, { recursive: true }); | ||
} |