diff --git a/src/subsystems/nodejs/builders/granular/default.nix b/src/subsystems/nodejs/builders/granular/default.nix index c6bcaecaa6..068f37eef9 100644 --- a/src/subsystems/nodejs/builders/granular/default.nix +++ b/src/subsystems/nodejs/builders/granular/default.nix @@ -386,8 +386,6 @@ if [ -f ./tsconfig.json ] \ && node -e 'require("typescript")' &>/dev/null; then node ${./tsconfig-to-json.js} - ${pkgs.jq}/bin/jq ".compilerOptions.preserveSymlinks = true" tsconfig.json \ - | ${pkgs.moreutils}/bin/sponge tsconfig.json fi ''; diff --git a/src/subsystems/nodejs/builders/granular/tsconfig-to-json.js b/src/subsystems/nodejs/builders/granular/tsconfig-to-json.js index 1ccd3db042..c67956b245 100644 --- a/src/subsystems/nodejs/builders/granular/tsconfig-to-json.js +++ b/src/subsystems/nodejs/builders/granular/tsconfig-to-json.js @@ -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));