From 28d6f8566d550e62fa3fc14f082fb62d6408d050 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 6 Sep 2023 07:32:38 +0200 Subject: [PATCH 1/4] fix(ts): Publish downleveled TS3.8 types, fix types path --- .npmignore | 1 + scripts/prepack.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.npmignore b/.npmignore index cb864514088e..6cf3cd53d7e6 100644 --- a/.npmignore +++ b/.npmignore @@ -6,3 +6,4 @@ !/cjs/**/* !/esm/**/* !/types/**/* +!/types-ts3.8/**/* diff --git a/scripts/prepack.ts b/scripts/prepack.ts index bcad9dee0ef8..0c810f3e9030 100644 --- a/scripts/prepack.ts +++ b/scripts/prepack.ts @@ -23,6 +23,12 @@ const buildDir = packageWithBundles ? NPM_BUILD_DIR : BUILD_DIR; type PackageJsonEntryPoints = Record; +interface TypeVersions { + [key: string]: { + [key: string]: string[]; + }; +}; + interface PackageJson extends Record, PackageJsonEntryPoints { [EXPORT_MAP_ENTRY_POINT]: { [key: string]: { @@ -31,11 +37,7 @@ interface PackageJson extends Record, PackageJsonEntryPoints { types: string; }; }; - [TYPES_VERSIONS_ENTRY_POINT]: { - [key: string]: { - [key: string]: string[]; - }; - }; + [TYPES_VERSIONS_ENTRY_POINT]: TypeVersions; } // eslint-disable-next-line @typescript-eslint/no-var-requires @@ -81,7 +83,8 @@ if (newPkgJson[EXPORT_MAP_ENTRY_POINT]) { if (newPkgJson[TYPES_VERSIONS_ENTRY_POINT]) { Object.entries(newPkgJson[TYPES_VERSIONS_ENTRY_POINT]).forEach(([key, val]) => { newPkgJson[TYPES_VERSIONS_ENTRY_POINT][key] = Object.entries(val).reduce((acc, [key, val]) => { - return { ...acc, [key]: val.map(v => v.replace(`${buildDir}/`, '')) }; + const newKey = key.replace(`${buildDir}/`, ''); + return { ...acc, [newKey]: val.map(v => v.replace(`${buildDir}/`, '')) }; }, {}); }); } From d721e2a9fdbc033c36235630957a8ac662a49145 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 6 Sep 2023 11:02:08 +0200 Subject: [PATCH 2/4] Fix gatsby npmignore --- packages/gatsby/.npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/gatsby/.npmignore b/packages/gatsby/.npmignore index 35348e6a718d..05a81b2542dd 100644 --- a/packages/gatsby/.npmignore +++ b/packages/gatsby/.npmignore @@ -6,6 +6,7 @@ !/cjs/**/* !/esm/**/* !/types/**/* +!/types-ts3.8/**/* # Gatsby specific !gatsby-browser.js From b92cd62a3a948b3be995ff374ee29093ea018caa Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 6 Sep 2023 11:02:33 +0200 Subject: [PATCH 3/4] Add test project to compile with ts 3.8 --- package.json | 1 + packages/ts3.8-test/index.ts | 13 +++++++++++++ packages/ts3.8-test/package.json | 27 +++++++++++++++++++++++++++ packages/ts3.8-test/tsconfig.json | 13 +++++++++++++ yarn.lock | 5 +++++ 5 files changed, 59 insertions(+) create mode 100644 packages/ts3.8-test/index.ts create mode 100644 packages/ts3.8-test/package.json create mode 100644 packages/ts3.8-test/tsconfig.json diff --git a/package.json b/package.json index 849d79b3628a..33482e4adfc5 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "packages/sveltekit", "packages/tracing", "packages/tracing-internal", + "packages/ts3.8-test", "packages/types", "packages/typescript", "packages/utils", diff --git a/packages/ts3.8-test/index.ts b/packages/ts3.8-test/index.ts new file mode 100644 index 000000000000..823bd62fe09c --- /dev/null +++ b/packages/ts3.8-test/index.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +// we need to import the SDK to ensure tsc check the types +import * as _SentryBrowser from '@sentry/browser'; +import * as _SentryCore from '@sentry/core'; +import * as _SentryHub from '@sentry/hub'; +import * as _SentryIntegrations from '@sentry/integrations'; +import * as _SentryNode from '@sentry/node'; +import * as _SentryOpentelemetry from '@sentry/opentelemetry-node'; +import * as _SentryReplay from '@sentry/replay'; +import * as _SentryTracing from '@sentry/tracing'; +import * as _SentryTypes from '@sentry/types'; +import * as _SentryUtils from '@sentry/utils'; +import * as _SentryWasm from '@sentry/wasm'; diff --git a/packages/ts3.8-test/package.json b/packages/ts3.8-test/package.json new file mode 100644 index 000000000000..c08bd933a79c --- /dev/null +++ b/packages/ts3.8-test/package.json @@ -0,0 +1,27 @@ +{ + "name": "@sentry-internal/ts3.8-test", + "version": "7.67.0", + "private": true, + "license": "MIT", + "scripts": { + "build:types": "run-s ts-version type-check", + "ts-version": "tsc --version", + "type-check": "tsc --project tsconfig.json" + }, + "devDependencies": { + "typescript": "3.8.3" + }, + "dependencies": { + "@sentry/browser": "7.67.0", + "@sentry/core": "7.67.0", + "@sentry/hub": "7.67.0", + "@sentry/integrations": "7.67.0", + "@sentry/node": "7.67.0", + "@sentry/opentelemetry-node": "7.67.0", + "@sentry/replay": "7.67.0", + "@sentry/tracing": "7.67.0", + "@sentry/types": "7.67.0", + "@sentry/utils": "7.67.0", + "@sentry/wasm": "7.67.0" + } +} diff --git a/packages/ts3.8-test/tsconfig.json b/packages/ts3.8-test/tsconfig.json new file mode 100644 index 000000000000..9c3ae0629ef1 --- /dev/null +++ b/packages/ts3.8-test/tsconfig.json @@ -0,0 +1,13 @@ +{ + "include": [ + "index.ts", + ], + "compilerOptions": { + "skipLibCheck": false, + "noEmit": true, + "types": [], + "jsx": "react", + "target": "es6", + "moduleResolution": "node", + }, +} diff --git a/yarn.lock b/yarn.lock index ec2d72d684e8..f0279727df36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27298,6 +27298,11 @@ typescript-memoize@^1.0.0-alpha.3, typescript-memoize@^1.0.1: resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.0.1.tgz#0a8199aa28f6fe18517f6e9308ef7bfbe9a98d59" integrity sha512-oJNge1qUrOK37d5Y6Ly2txKeuelYVsFtNF6U9kXIN7juudcQaHJQg2MxLOy0CqtkW65rVDYuTCOjnSIVPd8z3w== +typescript@3.8.3: + version "3.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" + integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== + typescript@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2" From ea7819da731ac4cb27164b289f22dc0f5cc5b1db Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 6 Sep 2023 11:04:59 +0200 Subject: [PATCH 4/4] Revert "Add test project to compile with ts 3.8" This reverts commit b92cd62a3a948b3be995ff374ee29093ea018caa. --- package.json | 1 - packages/ts3.8-test/index.ts | 13 ------------- packages/ts3.8-test/package.json | 27 --------------------------- packages/ts3.8-test/tsconfig.json | 13 ------------- yarn.lock | 5 ----- 5 files changed, 59 deletions(-) delete mode 100644 packages/ts3.8-test/index.ts delete mode 100644 packages/ts3.8-test/package.json delete mode 100644 packages/ts3.8-test/tsconfig.json diff --git a/package.json b/package.json index 33482e4adfc5..849d79b3628a 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,6 @@ "packages/sveltekit", "packages/tracing", "packages/tracing-internal", - "packages/ts3.8-test", "packages/types", "packages/typescript", "packages/utils", diff --git a/packages/ts3.8-test/index.ts b/packages/ts3.8-test/index.ts deleted file mode 100644 index 823bd62fe09c..000000000000 --- a/packages/ts3.8-test/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -// we need to import the SDK to ensure tsc check the types -import * as _SentryBrowser from '@sentry/browser'; -import * as _SentryCore from '@sentry/core'; -import * as _SentryHub from '@sentry/hub'; -import * as _SentryIntegrations from '@sentry/integrations'; -import * as _SentryNode from '@sentry/node'; -import * as _SentryOpentelemetry from '@sentry/opentelemetry-node'; -import * as _SentryReplay from '@sentry/replay'; -import * as _SentryTracing from '@sentry/tracing'; -import * as _SentryTypes from '@sentry/types'; -import * as _SentryUtils from '@sentry/utils'; -import * as _SentryWasm from '@sentry/wasm'; diff --git a/packages/ts3.8-test/package.json b/packages/ts3.8-test/package.json deleted file mode 100644 index c08bd933a79c..000000000000 --- a/packages/ts3.8-test/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@sentry-internal/ts3.8-test", - "version": "7.67.0", - "private": true, - "license": "MIT", - "scripts": { - "build:types": "run-s ts-version type-check", - "ts-version": "tsc --version", - "type-check": "tsc --project tsconfig.json" - }, - "devDependencies": { - "typescript": "3.8.3" - }, - "dependencies": { - "@sentry/browser": "7.67.0", - "@sentry/core": "7.67.0", - "@sentry/hub": "7.67.0", - "@sentry/integrations": "7.67.0", - "@sentry/node": "7.67.0", - "@sentry/opentelemetry-node": "7.67.0", - "@sentry/replay": "7.67.0", - "@sentry/tracing": "7.67.0", - "@sentry/types": "7.67.0", - "@sentry/utils": "7.67.0", - "@sentry/wasm": "7.67.0" - } -} diff --git a/packages/ts3.8-test/tsconfig.json b/packages/ts3.8-test/tsconfig.json deleted file mode 100644 index 9c3ae0629ef1..000000000000 --- a/packages/ts3.8-test/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "include": [ - "index.ts", - ], - "compilerOptions": { - "skipLibCheck": false, - "noEmit": true, - "types": [], - "jsx": "react", - "target": "es6", - "moduleResolution": "node", - }, -} diff --git a/yarn.lock b/yarn.lock index f0279727df36..ec2d72d684e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27298,11 +27298,6 @@ typescript-memoize@^1.0.0-alpha.3, typescript-memoize@^1.0.1: resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.0.1.tgz#0a8199aa28f6fe18517f6e9308ef7bfbe9a98d59" integrity sha512-oJNge1qUrOK37d5Y6Ly2txKeuelYVsFtNF6U9kXIN7juudcQaHJQg2MxLOy0CqtkW65rVDYuTCOjnSIVPd8z3w== -typescript@3.8.3: - version "3.8.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" - integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== - typescript@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2"