Skip to content

Commit

Permalink
feat: add additional info in debug logs, set noEmit to false
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemKlyuev committed Aug 18, 2022
1 parent 722078a commit 0268fe6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const dTSPathAliasPlugin = (pluginOptions?: PluginOptions): Plugin => {

const tsconfigPath = pluginOptions?.tsconfigPath ?? tsconfig ?? DEFAULT_TSCONFIG_LOCATION;

logger.info(`Used tsconfig: ${path.resolve(process.cwd(), tsconfigPath)}`);

const compilerOptions = getCompilerOptions(tsconfigPath);

const declarationDir = getDeclarationDir({
Expand All @@ -46,10 +48,15 @@ export const dTSPathAliasPlugin = (pluginOptions?: PluginOptions): Plugin => {
tsconfigOutDir: compilerOptions.outDir,
});

logger.info(
`Declaration files output directory: ${path.resolve(process.cwd(), declarationDir)}`,
);

const finalEntryPoints = isObject(entryPoints) ? Object.values(entryPoints) : entryPoints;

const finalCompilerOptions: ts.CompilerOptions = {
...compilerOptions,
noEmit: false,
declaration: true,
emitDeclarationOnly: true,
declarationDir,
Expand All @@ -59,11 +66,17 @@ export const dTSPathAliasPlugin = (pluginOptions?: PluginOptions): Plugin => {
const emitResult = compileDts(finalEntryPoints!, finalCompilerOptions);

if (emitResult.emitSkipped) {
logger.error('Typescript did not emit declaration files!');
logger.error('Typescript did not emit declaration files! Additional info:\n', {
entryPoints: finalEntryPoints,
initialCompilerOptions: compilerOptions,
finalCompilerOptions,
emitResult,
});

return;
}

logger.info('Successfully emitted declaration files!');
logger.success('Successfully emitted declaration files!');
});
},
};
Expand Down

0 comments on commit 0268fe6

Please sign in to comment.