From fad4615cf944b8f95f4ac19e00f5efe0671c499d Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Thu, 21 Jan 2021 03:22:01 +0000 Subject: [PATCH 1/4] chore(deps-dev): add downlevel-dts --- .../software/amazon/smithy/typescript/codegen/base-package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json index dea467427cb..dd7ef5012c2 100644 --- a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json +++ b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json @@ -29,6 +29,7 @@ "tslib": "^2.0.0" }, "devDependencies": { + "downlevel-dts": "0.7.0", "jest": "^26.1.0", "rimraf": "^3.0.0", "typedoc": "^0.19.2", From 3b3840291275c6016e64a3b19fe0538a6831e06a Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Thu, 21 Jan 2021 03:39:42 +0000 Subject: [PATCH 2/4] feat: add downlevel-dts script and typesVersions --- .../smithy/typescript/codegen/base-package.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json index dd7ef5012c2..eccf469fb8d 100644 --- a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json +++ b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json @@ -11,8 +11,10 @@ "remove-dist": "rimraf ./dist", "remove-documentation": "rimraf ./docs", "test": "yarn build && jest --coverage --passWithNoTests", - "build:cjs": "tsc -p tsconfig.json", - "build:es": "tsc -p tsconfig.es.json", + "downlevel-dts:cjs": "downlevel-dts dist/cjs dist/cjs/ts3.4", + "downlevel-dts:es": "downlevel-dts dist/es dist/es/ts3.4", + "build:cjs": "tsc -p tsconfig.json && yarn downlevel-dts:cjs", + "build:es": "tsc -p tsconfig.es.json && yarn downlevel-dts:es", "build": "yarn build:cjs && yarn build:es" }, "main": "./dist/cjs/index.js", @@ -37,5 +39,11 @@ }, "engines": { "node": ">=10.0.0" + }, + "typesVersions": { + "<3.9": { + "dist/cjs/*": ["dist/cjs/ts3.4/*"], + "dist/es/*": ["dist/es/ts3.4/*"] + } } } From db2c261b7f86c939ef4cdbf6f576c2fede73b578 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Thu, 21 Jan 2021 04:14:56 +0000 Subject: [PATCH 3/4] chore: update script name from downlevel-dts to postbuild --- .../amazon/smithy/typescript/codegen/base-package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json index eccf469fb8d..1e1ae451a7e 100644 --- a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json +++ b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json @@ -11,10 +11,10 @@ "remove-dist": "rimraf ./dist", "remove-documentation": "rimraf ./docs", "test": "yarn build && jest --coverage --passWithNoTests", - "downlevel-dts:cjs": "downlevel-dts dist/cjs dist/cjs/ts3.4", - "downlevel-dts:es": "downlevel-dts dist/es dist/es/ts3.4", - "build:cjs": "tsc -p tsconfig.json && yarn downlevel-dts:cjs", - "build:es": "tsc -p tsconfig.es.json && yarn downlevel-dts:es", + "postbuild:cjs": "downlevel-dts dist/cjs dist/cjs/ts3.4", + "postbuild:es": "downlevel-dts dist/es dist/es/ts3.4", + "build:cjs": "tsc -p tsconfig.json", + "build:es": "tsc -p tsconfig.es.json", "build": "yarn build:cjs && yarn build:es" }, "main": "./dist/cjs/index.js", From b047146f4babf83445e0184c5ba59b95672c39f0 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Thu, 21 Jan 2021 17:52:14 +0000 Subject: [PATCH 4/4] chore: run downlevel-dts on types folder --- .../amazon/smithy/typescript/codegen/base-package.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json index 1e1ae451a7e..7c27b6c20e5 100644 --- a/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json +++ b/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/base-package.json @@ -11,11 +11,10 @@ "remove-dist": "rimraf ./dist", "remove-documentation": "rimraf ./docs", "test": "yarn build && jest --coverage --passWithNoTests", - "postbuild:cjs": "downlevel-dts dist/cjs dist/cjs/ts3.4", - "postbuild:es": "downlevel-dts dist/es dist/es/ts3.4", "build:cjs": "tsc -p tsconfig.json", "build:es": "tsc -p tsconfig.es.json", - "build": "yarn build:cjs && yarn build:es" + "build": "yarn build:cjs && yarn build:es", + "postbuild": "downlevel-dts types types/ts3.4" }, "main": "./dist/cjs/index.js", "types": "./types/index.d.ts", @@ -42,8 +41,7 @@ }, "typesVersions": { "<3.9": { - "dist/cjs/*": ["dist/cjs/ts3.4/*"], - "dist/es/*": ["dist/es/ts3.4/*"] + "types/*": ["types/ts3.4/*"] } } }