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

Create directory on output #4507

Merged
merged 4 commits into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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), { mode: 420 });
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