Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.

Commit

Permalink
properly read compilerOptions from cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Yosbel Marin authored and svi3c committed Mar 2, 2018
1 parent 11bf6ef commit e418358
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import * as fs from "fs";
import * as path from "path";
import { register } from "ts-node/dist";
import { register, parse } from "ts-node/dist";
import { argv } from "yargs";

const TS_NODE_OPTIONS = [
Expand All @@ -19,7 +19,14 @@ const TS_NODE_OPTIONS = [
"compilerOptions",
];

const tsNodeOptions = Object.assign({}, ...TS_NODE_OPTIONS.map((option) => argv[option] && {[option]: argv[option]}));
const tsNodeOptions = Object.assign({}, ...TS_NODE_OPTIONS.map((option) => {
if (argv[option]) {
return (option === "compilerOptions")
? {compilerOptions: parse(argv[option])}
: {[option]: argv[option]}
}
}));

register(tsNodeOptions);

const Jasmine = require("jasmine");
Expand Down

0 comments on commit e418358

Please sign in to comment.