chore(tsconfig): abort on invalid json content (#3578)
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
This commit is contained in:
parent
2a76d881e4
commit
2b59c2820c
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.es5.json",
|
"extends": "../../../tsconfig.base.es5.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"outDir": "build"
|
"outDir": "build"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.es5.json",
|
"extends": "../../../tsconfig.base.es5.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"outDir": "build"
|
"outDir": "build"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
|
"src/generated/*.js",
|
||||||
"test/**/*.ts"
|
"test/**/*.ts"
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
|
|
|
@ -247,12 +247,7 @@ function resolvePackageMeta(pkgDir) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function readAndMaybeMergeTsConfig(tsconfigPath, updates) {
|
function readAndMaybeMergeTsConfig(tsconfigPath, updates) {
|
||||||
let tsconfig;
|
const tsconfig = readJSON(tsconfigPath);
|
||||||
try {
|
|
||||||
tsconfig = readJSON(tsconfigPath);
|
|
||||||
} catch {
|
|
||||||
return updates;
|
|
||||||
}
|
|
||||||
updates = mergeTsConfig(tsconfig, updates);
|
updates = mergeTsConfig(tsconfig, updates);
|
||||||
return updates;
|
return updates;
|
||||||
}
|
}
|
||||||
|
@ -284,8 +279,11 @@ function hasEsTargets(pjson) {
|
||||||
|
|
||||||
function readJSON(filepath) {
|
function readJSON(filepath) {
|
||||||
const fileContent = fs.readFileSync(filepath, 'utf8');
|
const fileContent = fs.readFileSync(filepath, 'utf8');
|
||||||
const json = JSON.parse(fileContent);
|
try {
|
||||||
return json;
|
return JSON.parse(fileContent);
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(`Invalid JSON ${filepath}: ${e.message}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeJSON(filepath, content, dry) {
|
function writeJSON(filepath, content, dry) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig.es5.json",
|
"extends": "./tsconfig.base.es5.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "ES6",
|
"module": "ES6",
|
||||||
"moduleResolution": "node"
|
"moduleResolution": "node"
|
||||||
|
|
Loading…
Reference in New Issue