From c06c19eb1e320d97221037a575e392b029604ba8 Mon Sep 17 00:00:00 2001 From: aabidsofi19 Date: Wed, 20 Dec 2023 23:48:22 +0530 Subject: [PATCH] fix compiler options to export as esnext Signed-off-by: aabidsofi19 --- src/apiCompilerConfig.json | 19 ------------------- src/app.js | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 src/apiCompilerConfig.json diff --git a/src/apiCompilerConfig.json b/src/apiCompilerConfig.json deleted file mode 100644 index d483409..0000000 --- a/src/apiCompilerConfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": false, - "strict": false, - "noImplicitAny": false, - "skipLibCheck": true, - "module": "ESNext", - "declaration": false, - "sourceMap": false, - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "emitDeclarationOnly": false, - "allowJs": true, - "outDir": "./dist" - }, - "files": ["api.ts"] -} diff --git a/src/app.js b/src/app.js index a8e01e6..77c8071 100755 --- a/src/app.js +++ b/src/app.js @@ -1,11 +1,9 @@ #! /usr/bin/env node var { program } = require("commander"); var { exec } = require("child_process"); -var { renameSync, rmdirSync, unlinkSync } = require("fs"); -var { dirname, basename, join } = require("path"); +var { unlinkSync } = require("fs"); var fs = require("fs"); var ts = require("typescript"); -var compileConfig = require("./apiCompilerConfig.json"); program .option("-i, --input ", "Input YAML schema file path") @@ -19,7 +17,20 @@ program const compileApi = (tsPath, outputPath) => { // read ts file const tsFile = fs.readFileSync(tsPath, "utf8"); - const result = ts.transpile(tsFile, compileConfig); + const result = ts.transpile(tsFile, { + target: "ESNext", + esModuleInterop: true, + forceConsistentCasingInFileNames: false, + strict: false, + noImplicitAny: false, + skipLibCheck: true, + module: "ESNext", + declaration: false, + sourceMap: false, + moduleResolution: "node", + allowSyntheticDefaultImports: true, + emitDeclarationOnly: false, + }); console.log("Writing output to " + outputPath); fs.writeFileSync(outputPath, result); };