Skip to content

Commit 189d5a9

Browse files
trivikrsrchase
authored andcommitted
feat: remove comments from transpiled JS files (smithy-lang#427)
* chore: create tsconfig.types.json as copy of tsconfig.es.json * chore: add tsconfig.types.json in static file copies * chore: generate types in tsconfig.types.json
1 parent 112c0c3 commit 189d5a9

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CodegenVisitor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ class CodegenVisitor extends ShapeVisitor.Default<Void> {
7070
*/
7171
private static final Map<String, String> STATIC_FILE_COPIES = MapUtils.of(
7272
"jest.config.js", "jest.config.js",
73+
"tsconfig.json", "tsconfig.json",
7374
"tsconfig.es.json", "tsconfig.es.json",
74-
"tsconfig.json", "tsconfig.json"
75+
"tsconfig.types.json", "tsconfig.types.json"
7576
);
7677
private static final ShapeId VALIDATION_EXCEPTION_SHAPE =
7778
ShapeId.fromParts("smithy.framework", "ValidationException");

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"test": "jest --coverage --passWithNoTests",
1313
"build:cjs": "tsc -p tsconfig.json",
1414
"build:es": "tsc -p tsconfig.es.json",
15-
"build": "yarn build:cjs && yarn build:es"
15+
"build:types": "tsc -p tsconfig.types.json",
16+
"build": "yarn build:cjs && yarn build:es && yarn build:types"
1617
},
1718
"main": "./dist/cjs/index.js",
1819
"types": "./dist/types/index.d.ts",

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/tsconfig.es.json

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"target": "es5",
55
"module": "esnext",
66
"moduleResolution": "node",
7-
"declaration": false,
8-
"declarationDir": null,
97
"lib": [
108
"dom",
119
"es5",

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/tsconfig.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"alwaysStrict": true,
44
"target": "ES2018",
55
"module": "commonjs",
6-
"declaration": true,
76
"strict": true,
87
"sourceMap": true,
98
"downlevelIteration": true,
@@ -12,8 +11,8 @@
1211
"incremental": true,
1312
"resolveJsonModule": true,
1413
"esModuleInterop": true,
15-
"declarationDir": "dist/types",
16-
"outDir": "dist/cjs"
14+
"outDir": "dist/cjs",
15+
"removeComments": true
1716
},
1817
"typedocOptions": {
1918
"exclude": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"removeComments": false,
5+
"declaration": true,
6+
"declarationDir": "dist/types"
7+
}
8+
}

0 commit comments

Comments
 (0)