Skip to content

Commit

Permalink
Merge pull request #7 from mistlog/refactor/use-litscript
Browse files Browse the repository at this point in the history
add document for code
  • Loading branch information
mistlog committed Jun 4, 2020
2 parents 7ce3e59 + 7dc00bf commit e9a750f
Show file tree
Hide file tree
Showing 38 changed files with 8,312 additions and 8,096 deletions.
4 changes: 2 additions & 2 deletions cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ if (args.length === 0) {
throws: false,
}) || { devDependencies: {} };

const dsl_names = Object.keys(project_package.devDependencies).filter((key) =>
const dsl_names = Object.keys(project_package.devDependencies).filter(key =>
key.startsWith("draft-dsl")
);
const dsls = dsl_names.map((name) =>
const dsls = dsl_names.map(name =>
require(`${join(working_directory, "node_modules", name)}`)?.MakeDSL()
);
config.dsls = dsls;
Expand Down
6 changes: 3 additions & 3 deletions cli/literator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from "fs";
import { outputFileSync, removeSync } from "fs-extra";
import * as traverse from "filewalker";
import * as watch from "node-watch";
import { Transcriber } from "../src";
import { MakeDefaultTranscriber } from "../src";
import { config } from "./config";

function TraverseDirectory(path: string, callback: (name: string, path: string) => void) {
Expand Down Expand Up @@ -64,8 +64,8 @@ export function CrossoutDirectory(path: string) {

export function ComposeFile(source: string) {
const code = readFileSync(source, "utf8");
const transcriber = new Transcriber(code);
config.dsls.forEach((dsl) => transcriber.AddDSL(dsl.name, dsl.dsl));
const transcriber = MakeDefaultTranscriber(code);
config.dsls.forEach(dsl => transcriber.AddDSL(dsl.name, dsl.dsl));
const result = transcriber.Transcribe();
outputFileSync(source.replace(".tsx", ".ts"), result, "utf8");
}
32 changes: 31 additions & 1 deletion docs/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,35 @@
"page": "Introduction",
"file": "index.html",
"desc": "Introduction page"
},
{
"page": "Source Code",
"subs": [
{
"page": "Export Class",
"file": "src/code-object/export-class.html"
},
{
"page": "Class Method",
"file": "src/code-object/method.html"
},
{
"page": "Local Context",
"file": "src/code-object/local-context.html"
},
{
"page": "Module and Draft",
"file": "src/code-object/module.html"
},
{
"page": "Transcriber",
"file": "src/core/transcriber.html"
}
]
},
{
"page": "Unit Test",
"file": "coverage/lcov-report/index.html",
"desc": "Test Coverage"
}
]
]
4 changes: 1 addition & 3 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# TypeDraft

* [test coverage](./coverage/lcov-report/index.html)
# TypeDraft

0 comments on commit e9a750f

Please sign in to comment.