Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Create directory on output (#4507)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMobs authored and adidahiya committed Feb 6, 2019
1 parent a7c86fa commit 28ae0c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"glob": "^7.1.1",
"js-yaml": "^3.7.0",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
Expand All @@ -51,6 +52,7 @@
"@types/glob": "^5.0.30",
"@types/js-yaml": "^3.5.31",
"@types/minimatch": "^2.0.29",
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^2.2.35",
"@types/node": "^7.0.29",
"@types/resolve": "^0.0.4",
Expand Down
12 changes: 8 additions & 4 deletions src/tslintCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import commander = require("commander");
import * as fs from "fs";
import * as mkdirp from "mkdirp";
import * as path from "path";

import { Linter } from "./linter";
import { run } from "./runner";
Expand Down Expand Up @@ -275,10 +277,12 @@ if (argv.typeCheck) {
}
}

const outputStream: NodeJS.WritableStream =
argv.out === undefined
? process.stdout
: fs.createWriteStream(argv.out, { flags: "w+", mode: 420 });
let outputStream: NodeJS.WritableStream = process.stdout;

if (argv.out !== undefined) {
mkdirp.sync(path.dirname(argv.out));
outputStream = fs.createWriteStream(argv.out, { flags: "w+", mode: 420 });
}

run(
{
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
integrity sha1-UALhT3Xi1x5WQoHfBDHIwbSio2o=

"@types/mkdirp@^0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f"
integrity sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==
dependencies:
"@types/node" "*"

"@types/mocha@^2.2.35":
version "2.2.41"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608"
Expand Down

0 comments on commit 28ae0c1

Please sign in to comment.