Skip to content

Commit

Permalink
support for parsing tsconfig.json with comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ryands17 authored and dolezel committed Apr 29, 2020
1 parent 809b8b0 commit f0d4848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bin/node-pg-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

'use strict'

const fs = require('fs')
const util = require('util')
const path = require('path')
const yargs = require('yargs')
Expand Down Expand Up @@ -217,8 +218,10 @@ if (tsconfigPath) {
let tsconfig
let tsnode
try {
// eslint-disable-next-line global-require,import/no-dynamic-require,security/detect-non-literal-require
tsconfig = require(path.resolve(process.cwd(), tsconfigPath))
// eslint-disable-next-line security/detect-non-literal-fs-filename
const config = fs.readFileSync(path.resolve(process.cwd(), tsconfigPath), { encoding: 'utf-8' })
// eslint-disable-next-line global-require,import/no-dynamic-require,security/detect-non-literal-require,import/no-extraneous-dependencies
tsconfig = require('json5').parse(config)
} catch (err) {
console.error(`Can't load tsconfig.json: ${err.stack}`)
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"eslint-plugin-prettier": "3.1.3",
"eslint-plugin-security": "1.4.0",
"husky": "4.2.5",
"json5": "2.1.3",
"lint-staged": "10.1.7",
"mocha": "7.1.2",
"pg": "8.0.3",
Expand Down

0 comments on commit f0d4848

Please sign in to comment.