From 2c529bb66d8c8ed7a785cc4417e7a9f5f58f4979 Mon Sep 17 00:00:00 2001 From: Filip Sobol Date: Tue, 17 Dec 2024 16:59:38 +0100 Subject: [PATCH 1/2] Fix (build-tools): Always enable TypeScript plugin, even when `declarations` is set to `false`. --- packages/ckeditor5-dev-build-tools/src/config.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/ckeditor5-dev-build-tools/src/config.ts b/packages/ckeditor5-dev-build-tools/src/config.ts index cd20ccec8..d7c169ac5 100644 --- a/packages/ckeditor5-dev-build-tools/src/config.ts +++ b/packages/ckeditor5-dev-build-tools/src/config.ts @@ -202,10 +202,7 @@ export async function getRollupConfig( options: BuildOptions ) { /** * Does type checking and generates `.d.ts` files. */ - getOptionalPlugin( - declarations, - getTypeScriptPlugin( { tsconfig, output, sourceMap, declarations } ) - ), + getTypeScriptPlugin( { tsconfig, output, sourceMap, declarations } ), /** * Replaces parts of the source code with the provided values. @@ -309,7 +306,11 @@ function getTypeScriptPlugin( { declaration: declarations, declarationDir: declarations ? path.parse( output ).dir : undefined, compilerOptions: { - emitDeclarationOnly: true + // When `declarations` is set to `true`, we only want to emit declaration files. + emitDeclarationOnly: !!declarations, + + // Otherwise, we don't want to emit anything. + noEmit: !declarations } } ); } From abcc8c210bf1578c45da8c133e9e8598012f8ee7 Mon Sep 17 00:00:00 2001 From: Filip Sobol Date: Tue, 17 Dec 2024 17:08:53 +0100 Subject: [PATCH 2/2] Fix failing test --- packages/ckeditor5-dev-build-tools/tests/config/config.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-dev-build-tools/tests/config/config.test.ts b/packages/ckeditor5-dev-build-tools/tests/config/config.test.ts index 9f54d89d8..c560c5d76 100644 --- a/packages/ckeditor5-dev-build-tools/tests/config/config.test.ts +++ b/packages/ckeditor5-dev-build-tools/tests/config/config.test.ts @@ -53,7 +53,7 @@ test( '--tsconfig', async () => { expect( fileExists.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( true ); expect( fileDoesntExist.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( false ); - expect( declarationsFalse.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( false ); + expect( declarationsFalse.plugins.some( plugin => plugin?.name === 'typescript' ) ).toBe( true ); } ); test( '--external', async () => {