Skip to content

Commit

Permalink
nodejs: improve tsconfig patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed Aug 11, 2022
1 parent 84cf3e3 commit 3223d29
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/subsystems/nodejs/builders/granular/tsconfig-to-json.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
try {
console.log(require.resolve("typescript"));
} catch(e) {
console.error("typescript is not found");
process.exit(e.code);
require.resolve("typescript");
} catch (e) {
process.exit(0);
}

const ts = require("typescript")
const fs = require('fs')
const ts = require("typescript");
const fs = require("fs");

try {
const data = fs.readFileSync('tsconfig.json', 'utf8')
const data = fs.readFileSync("tsconfig.json", "utf8");
} catch (err) {
console.error(err)
console.error(err);
}

config = ts.parseConfigFileTextToJson(data)
newdata = JSON.stringify(config)
fs.writeFileSync('tsconfig.json', newdata);
config = ts.parseConfigFileTextToJson(data);

// https://www.typescriptlang.org/tsconfig#preserveSymlinks
config.compilerOptions.preserveSymlinks = true;

fs.writeFileSync("tsconfig.json", JSON.stringify(config));

0 comments on commit 3223d29

Please sign in to comment.