From 7f3591069ee2b710ecce15f85f8d4b0aa2b288f5 Mon Sep 17 00:00:00 2001 From: Andy Richardson Date: Thu, 25 Nov 2021 17:32:43 +0000 Subject: [PATCH] Remove declaration dir warning when declarations are disabled --- src/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.js b/src/index.js index b83c007f..ba5d10d0 100644 --- a/src/index.js +++ b/src/index.js @@ -227,6 +227,14 @@ async function getOutput({ cwd, output, pkgMain, pkgName }) { } function getDeclarationDir({ options, pkg }) { + try { + const tsconfig = JSON.parse(fs.readFileSync(options.tsconfig || "tsconfig.json", 'utf-8')) + + if (tsconfig && tsconfig.compilerOptions && tsconfig.compilerOptions.declaration === false) { + return undefined; + } + } catch(err) {} + const { cwd, output } = options; let result = output;