Skip to content

Commit

Permalink
Fixed some minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
remojansen committed Mar 27, 2018
1 parent 35ee6fe commit cffe0f0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsuml",
"version": "0.0.1-alpha.4",
"version": "0.0.1-alpha.5",
"description": "UML diagrams for TypeScript",
"main": "dist/lib/index.js",
"bin": {
Expand Down
6 changes: 3 additions & 3 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { render } from "../core/renderer";

try {

if (yargs.argv.h) {
console.log(chalk.yellowBright("ts-uml --glob ./src/**/*.ts"));
if (yargs.argv.help) {
console.log(chalk.yellowBright("tsuml --glob ./src/**/*.ts"));
}

const pattern = yargs.argv.glob;
Expand All @@ -19,7 +19,7 @@ import { render } from "../core/renderer";
console.log(chalk.redBright("Missing --glob"));
} else {
const yuml = await yUML("./tsconfig.json", pattern);
const path = await render(yuml);
const path = await render(yuml, process.cwd());
console.log(chalk.greenBright(`Saved UML diagram available at ${path}`));
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function yUML(tsConfigPath: string, pattern: string) {

console.log(
chalk.yellowBright(
"Matched files:\n" + sourceFilesPaths.map(s => `${s}\n`)
"Matched files:\n" + sourceFilesPaths.reduce((p, c) => `${p}${c}\n`, "")
)
);

Expand Down
4 changes: 2 additions & 2 deletions src/core/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import * as path from "path";
import { templates } from "./templates";
import { download } from "./io";

export function render(dsl: string) {
export function render(dsl: string, rootPath: string) {
return new Promise<string>((res, rej) => {
const url = templates.url(dsl);
const file = `uml_diagram_${new Date().getTime()}.png`;
const absolutePath = path.join(__dirname, file);
const absolutePath = path.join(rootPath, file);
download(url, file, () => res(absolutePath));
});
}
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { yUML } from "../core";
export { render } from "../core/renderer";

0 comments on commit cffe0f0

Please sign in to comment.