Skip to content

Commit

Permalink
fix(js): remove dts option as diff in perf is negligible
Browse files Browse the repository at this point in the history
  • Loading branch information
Chau Tran authored and Chau Tran committed Feb 22, 2022
1 parent d071fad commit 7b40c3b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
8 changes: 0 additions & 8 deletions docs/generated/api-js/executors/swc.md
Expand Up @@ -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`
Expand Down
5 changes: 0 additions & 5 deletions packages/js/src/executors/swc/schema.json
Expand Up @@ -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)",
Expand Down
22 changes: 15 additions & 7 deletions packages/js/src/executors/swc/swc.impl.ts
Expand Up @@ -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;
}
Expand All @@ -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'),
};

Expand Down
2 changes: 0 additions & 2 deletions packages/js/src/utils/schema.d.ts
Expand Up @@ -48,7 +48,6 @@ export interface NormalizedExecutorOptions extends ExecutorOptions {

export interface SwcExecutorOptions extends ExecutorOptions {
skipTypeCheck?: boolean;
dts?: boolean;
swcExclude?: string[];
}

Expand All @@ -62,7 +61,6 @@ export interface NormalizedSwcExecutorOptions
extends NormalizedExecutorOptions {
swcExclude: string[];
skipTypeCheck: boolean;
dts: boolean;
swcCliOptions: SwcCliOptions;
}

Expand Down
5 changes: 2 additions & 3 deletions packages/js/src/utils/swc/compile-swc.ts
Expand Up @@ -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,
Expand Down

0 comments on commit 7b40c3b

Please sign in to comment.