diff --git a/docs/generated/api-js/executors/swc.md b/docs/generated/api-js/executors/swc.md index 9775d77ad8620..55d74347871b9 100644 --- a/docs/generated/api-js/executors/swc.md +++ b/docs/generated/api-js/executors/swc.md @@ -35,14 +35,6 @@ Type: `array` List of static assets. -### dts - -Default: `true` - -Type: `boolean` - -Whether to emit Type Declarations using tsc. - ### skipTypeCheck Default: `false` diff --git a/packages/js/src/executors/swc/schema.json b/packages/js/src/executors/swc/schema.json index b76dc703741f4..8914c39400f15 100644 --- a/packages/js/src/executors/swc/schema.json +++ b/packages/js/src/executors/swc/schema.json @@ -35,11 +35,6 @@ "description": "Whether to skip TypeScript type checking.", "default": false }, - "dts": { - "type": "boolean", - "description": "Whether to emit Type Declarations using tsc.", - "default": true - }, "swcExclude": { "type": "array", "description": "List of SWC Glob/Regex to be excluded from compilation (https://swc.rs/docs/configuration/compilation#exclude)", diff --git a/packages/js/src/executors/swc/swc.impl.ts b/packages/js/src/executors/swc/swc.impl.ts index 4ff0c6d02232a..b44f2b4582ba9 100644 --- a/packages/js/src/executors/swc/swc.impl.ts +++ b/packages/js/src/executors/swc/swc.impl.ts @@ -25,10 +25,6 @@ function normalizeOptions( ): NormalizedSwcExecutorOptions { const outputPath = join(contextRoot, options.outputPath); - if (options.dts == null) { - options.dts = true; - } - if (options.skipTypeCheck == null) { options.skipTypeCheck = false; } @@ -43,11 +39,23 @@ function normalizeOptions( outputPath ); + /** + * Reduce outputPath to root of layout dir (libsDir/appsDir) + * in desired build output dir (default is dist) + * + * dist/packages/lib-one -> dist/packages + * build/packages/lib-one -> build/packages + * dist/packages/lib-one/nested/nested-lib-one -> dist/packages + * dist/libs/lib-one -> dist/libs + * dist/apps/app-one -> dist/apps + */ + const swcDestPath = + options.outputPath.substring(0, options.outputPath.indexOf(layoutDir)) + + layoutDir; + const swcCliOptions = { srcPath: projectRoot, - destPath: - options.outputPath.substring(0, options.outputPath.indexOf(layoutDir)) + - layoutDir, + destPath: swcDestPath, swcrcPath: join(projectRoot, '.swcrc'), }; diff --git a/packages/js/src/utils/schema.d.ts b/packages/js/src/utils/schema.d.ts index 0e66e5340b2e4..a53af157b39d5 100644 --- a/packages/js/src/utils/schema.d.ts +++ b/packages/js/src/utils/schema.d.ts @@ -48,7 +48,6 @@ export interface NormalizedExecutorOptions extends ExecutorOptions { export interface SwcExecutorOptions extends ExecutorOptions { skipTypeCheck?: boolean; - dts?: boolean; swcExclude?: string[]; } @@ -62,7 +61,6 @@ export interface NormalizedSwcExecutorOptions extends NormalizedExecutorOptions { swcExclude: string[]; skipTypeCheck: boolean; - dts: boolean; swcCliOptions: SwcCliOptions; } diff --git a/packages/js/src/utils/swc/compile-swc.ts b/packages/js/src/utils/swc/compile-swc.ts index 2014366f45245..0b222577a10d8 100644 --- a/packages/js/src/utils/swc/compile-swc.ts +++ b/packages/js/src/utils/swc/compile-swc.ts @@ -15,11 +15,10 @@ function getSwcCmd( } function getTypeCheckOptions(normalizedOptions: NormalizedSwcExecutorOptions) { - const { projectRoot, watch, tsConfig, root, outputPath, dts } = - normalizedOptions; + const { projectRoot, watch, tsConfig, root, outputPath } = normalizedOptions; const typeCheckOptions: TypeCheckOptions = { - mode: dts ? 'emitDeclarationOnly' : 'noEmit', + mode: 'emitDeclarationOnly', tsConfigPath: tsConfig, outDir: outputPath.replace(`/${projectRoot}`, ''), workspaceRoot: root,