From ed889bc3188dec5dab9efb2631cb4c8727cafe96 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 19 Jul 2023 10:27:31 +0200 Subject: [PATCH 1/9] chore(eslint): Add lint rules for disabled or focused tests (#8489) We sometimes forget to remove focused or disabled annotations after debugging tests. This of course isn't ideal and as brought up in #8485 we should add checks against this. Therefore, this patch: * Adds the [`eslint-plugin-jest` package ](https://github.com/jest-community/eslint-plugin-jest/tree/main)which contains a bunch of jest-syntax-specific rules * Enables the `no-focused-tests` rule to throw a lint error if a test is focused with `it.only`, `fit` or similar functions. * Enables the `no-disabled-tests` rule to throw a lint error if a test (suite) from a suite is disabled/skipped with `it.skip`, `xit` or similar functions. While we sometimes skip tests on purpose, I'd argue that we generally want to avoid this, as it can also happen accidentally. For the few exceptions of this rule, we can always ignore it. --- .../core/test/lib/transports/offline.test.ts | 1 + packages/eslint-config-sdk/package.json | 1 + packages/eslint-config-sdk/src/index.js | 20 +++++- .../node/test/integrations/undici.test.ts | 4 ++ yarn.lock | 62 +++++++++++++++++++ 5 files changed, 87 insertions(+), 1 deletion(-) diff --git a/packages/core/test/lib/transports/offline.test.ts b/packages/core/test/lib/transports/offline.test.ts index 6a6474d51ef9..e7174cb7c2e0 100644 --- a/packages/core/test/lib/transports/offline.test.ts +++ b/packages/core/test/lib/transports/offline.test.ts @@ -326,6 +326,7 @@ describe('makeOfflineTransport', () => { expect(getCalls()).toEqual([]); }); + // eslint-disable-next-line jest/no-disabled-tests it.skip( 'Follows the Retry-After header', async () => { diff --git a/packages/eslint-config-sdk/package.json b/packages/eslint-config-sdk/package.json index 630231b7dd39..6e570c6dff90 100644 --- a/packages/eslint-config-sdk/package.json +++ b/packages/eslint-config-sdk/package.json @@ -26,6 +26,7 @@ "eslint-config-prettier": "^6.11.0", "eslint-plugin-deprecation": "^1.1.0", "eslint-plugin-import": "^2.22.0", + "eslint-plugin-jest": "^27.2.2", "eslint-plugin-jsdoc": "^30.0.3", "eslint-plugin-simple-import-sort": "^5.0.3" }, diff --git a/packages/eslint-config-sdk/src/index.js b/packages/eslint-config-sdk/src/index.js index c070195ed083..ffdc8b8ba0af 100644 --- a/packages/eslint-config-sdk/src/index.js +++ b/packages/eslint-config-sdk/src/index.js @@ -167,7 +167,7 @@ module.exports = { }, }, { - // Configuration for test files + // Configuration for files in test directories env: { jest: true, }, @@ -186,6 +186,24 @@ module.exports = { '@sentry-internal/sdk/no-nullish-coalescing': 'off', }, }, + { + // Configuration only for test files (this won't apply to utils or other files in test directories) + plugins: ['jest'], + env: { + jest: true, + }, + files: ['test.ts', '*.test.ts', '*.test.tsx', '*.test.js', '*.test.jsx'], + rules: { + // Prevent permanent usage of `it.only`, `fit`, `test.only` etc + // We want to avoid debugging leftovers making their way into the codebase + 'jest/no-focused-tests': 'error', + + // Prevent permanent usage of `it.skip`, `xit`, `test.skip` etc + // We want to avoid debugging leftovers making their way into the codebase + // If there's a good reason to skip a test (e.g. bad flakiness), just add an ignore comment + 'jest/no-disabled-tests': 'error', + }, + }, { // Configuration for config files like webpack/rollup files: ['*.config.js'], diff --git a/packages/node/test/integrations/undici.test.ts b/packages/node/test/integrations/undici.test.ts index b30ac92c0695..e72f7ce70212 100644 --- a/packages/node/test/integrations/undici.test.ts +++ b/packages/node/test/integrations/undici.test.ts @@ -194,6 +194,7 @@ conditionalTest({ min: 16 })('Undici integration', () => { }); // This flakes on CI for some reason: https://github.com/getsentry/sentry-javascript/pull/8449 + // eslint-disable-next-line jest/no-disabled-tests it.skip('attaches the sentry trace and baggage headers if there is an active span', async () => { expect.assertions(3); @@ -214,6 +215,7 @@ conditionalTest({ min: 16 })('Undici integration', () => { }); // This flakes on CI for some reason: https://github.com/getsentry/sentry-javascript/pull/8449 + // eslint-disable-next-line jest/no-disabled-tests it.skip('attaches the sentry trace and baggage headers if there is no active span', async () => { const scope = hub.getScope(); @@ -228,6 +230,7 @@ conditionalTest({ min: 16 })('Undici integration', () => { }); // This flakes on CI for some reason: https://github.com/getsentry/sentry-javascript/pull/8449 + // eslint-disable-next-line jest/no-disabled-tests it.skip('attaches headers if `shouldCreateSpanForRequest` does not create a span using propagation context', async () => { const transaction = hub.startTransaction({ name: 'test-transaction' }) as Transaction; const scope = hub.getScope(); @@ -259,6 +262,7 @@ conditionalTest({ min: 16 })('Undici integration', () => { }); // This flakes on CI for some reason: https://github.com/getsentry/sentry-javascript/pull/8449 + // eslint-disable-next-line jest/no-disabled-tests it.skip('uses tracePropagationTargets', async () => { const transaction = hub.startTransaction({ name: 'test-transaction' }) as Transaction; hub.getScope().setSpan(transaction); diff --git a/yarn.lock b/yarn.lock index 8431c6928ee7..5dc640b26163 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2483,6 +2483,13 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.16.17.tgz#c5a1a4bfe1b57f0c3e61b29883525c6da3e5c091" integrity sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -5304,6 +5311,14 @@ "@typescript-eslint/types" "5.48.0" "@typescript-eslint/visitor-keys" "5.48.0" +"@typescript-eslint/scope-manager@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" + integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== + dependencies: + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" + "@typescript-eslint/type-utils@5.48.0": version "5.48.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.48.0.tgz#40496dccfdc2daa14a565f8be80ad1ae3882d6d6" @@ -5329,6 +5344,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.48.0.tgz#d725da8dfcff320aab2ac6f65c97b0df30058449" integrity sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw== +"@typescript-eslint/types@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" + integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== + "@typescript-eslint/typescript-estree@3.10.1": version "3.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853" @@ -5356,6 +5376,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" + integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== + dependencies: + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/typescript-estree@^4.8.2": version "4.23.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.23.0.tgz#0753b292097523852428a6f5a1aa8ccc1aae6cd9" @@ -5383,6 +5416,20 @@ eslint-utils "^3.0.0" semver "^7.3.7" +"@typescript-eslint/utils@^5.10.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" + integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.62.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/typescript-estree" "5.62.0" + eslint-scope "^5.1.1" + semver "^7.3.7" + "@typescript-eslint/visitor-keys@3.10.1": version "3.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" @@ -5406,6 +5453,14 @@ "@typescript-eslint/types" "5.48.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" + integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== + dependencies: + "@typescript-eslint/types" "5.62.0" + eslint-visitor-keys "^3.3.0" + "@vitest/coverage-c8@^0.29.2": version "0.29.2" resolved "https://registry.yarnpkg.com/@vitest/coverage-c8/-/coverage-c8-0.29.2.tgz#30b81e32ff11c20e2f3ab78c84e21b4c6c08190c" @@ -12491,6 +12546,13 @@ eslint-plugin-import@^2.22.0: resolve "^1.17.0" tsconfig-paths "^3.9.0" +eslint-plugin-jest@^27.2.2: + version "27.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.2.tgz#be4ded5f91905d9ec89aa8968d39c71f3b072c0c" + integrity sha512-euzbp06F934Z7UDl5ZUaRPLAc9MKjh0rMPERrHT7UhlCEwgb25kBj37TvMgWeHZVkR5I9CayswrpoaqZU1RImw== + dependencies: + "@typescript-eslint/utils" "^5.10.0" + eslint-plugin-jsdoc@^30.0.3: version "30.7.13" resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.13.tgz#52e5c74fb806d3bbeb51d04a0c829508c3c6b563" From 204d3e3d10c00b209a2ebeebf0d7c5789ae31d97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 08:30:29 +0000 Subject: [PATCH 2/9] build(deps): bump word-wrap from 1.2.3 to 1.2.4 (#8583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
Release notes

Sourced from word-wrap's releases.

1.2.4

What's Changed

New Contributors

Full Changelog: https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=word-wrap&package-manager=npm_and_yarn&previous-version=1.2.3&new-version=1.2.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/getsentry/sentry-javascript/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5dc640b26163..197a789d7ceb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28036,9 +28036,9 @@ winston@^3.8.2: winston-transport "^4.5.0" word-wrap@^1.2.3, word-wrap@~1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + version "1.2.4" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" + integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== wordwrap@^0.0.3: version "0.0.3" From 7c51b9e9b3c8f9156a9e42f1a83395a41e9456a2 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 19 Jul 2023 10:43:18 +0200 Subject: [PATCH 3/9] fix(nextjs): Ensure Webpack plugin is available after dynamic require (#8584) For some reason, dynamic requires of our webpack plugin don't work for some users. We still don't have a better fix for #8541 so let's just get this in to unblock folks. closes #8576 --- packages/nextjs/src/config/webpack.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index a923c57cfef1..786ce0dfaaed 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -2,6 +2,7 @@ /* eslint-disable max-lines */ import { getSentryRelease } from '@sentry/node'; import { arrayify, dropUndefinedKeys, escapeStringForRegex, loadModule, logger } from '@sentry/utils'; +import type SentryCliPlugin from '@sentry/webpack-plugin'; import * as chalk from 'chalk'; import * as fs from 'fs'; import * as path from 'path'; @@ -312,15 +313,16 @@ export function constructWebpackConfigFunction( // without, the option to use `hidden-source-map` only applies to the client-side build. newConfig.devtool = userSentryOptions.hideSourceMaps && !isServer ? 'hidden-source-map' : 'source-map'; - const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin'); - - newConfig.plugins = newConfig.plugins || []; - newConfig.plugins.push( - // @ts-expect-error - this exists, the dynamic import just doesn't know about it - new SentryWebpackPlugin( - getWebpackPluginOptions(buildContext, userSentryWebpackPluginOptions, userSentryOptions), - ), - ); + const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin'); + if (SentryWebpackPlugin) { + newConfig.plugins = newConfig.plugins || []; + newConfig.plugins.push( + // @ts-expect-error - this exists, the dynamic import just doesn't know about it + new SentryWebpackPlugin( + getWebpackPluginOptions(buildContext, userSentryWebpackPluginOptions, userSentryOptions), + ), + ); + } } } @@ -769,10 +771,10 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions // architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run // with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users // try to build their apps. - const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin'); + const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin'); // @ts-expect-error - this exists, the dynamic import just doesn't know it - if (!SentryWebpackPlugin.cliBinaryExists()) { + if (!SentryWebpackPlugin || !SentryWebpackPlugin.cliBinaryExists()) { // eslint-disable-next-line no-console console.error( `${chalk.red('error')} - ${chalk.bold('Sentry CLI binary not found.')} Source maps will not be uploaded.\n`, From f2bdd1f49b4682d100293b47d1a9981c28795d11 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 19 Jul 2023 10:45:34 +0200 Subject: [PATCH 4/9] chore(publish): Publish NPM packages in order of dependency tree (#8579) Following up on #inc-456, this patch splits the previously universal `npm` target that took care of publishing all packages at once into multiple targets (one for each package). This will ensure that packages are published in the correct order of their sentry dependency tree (e.g. core -> browser -> react, etc..) Furthermore, this theoretically also lets us disable the release of individual packages (which we might want to do if a package was already released). --- .craft.yml | 109 +++++++++++++++++++++++++++++- docs/new-sdk-release-checklist.md | 9 ++- 2 files changed, 115 insertions(+), 3 deletions(-) diff --git a/.craft.yml b/.craft.yml index 4f01a2319ce6..c06d90bc7689 100644 --- a/.craft.yml +++ b/.craft.yml @@ -2,6 +2,107 @@ minVersion: '0.23.1' changelogPolicy: simple preReleaseCommand: bash scripts/craft-pre-release.sh targets: + # NPM Targets + ## 1. Base Packages, node or browser SDKs depend on + ## 1.1 Types + - name: npm + id: "@sentry/types" + includeNames: /^sentry-types-\d.*\.tgz$/ + ## 1.2 Utils + - name: npm + id: "@sentry/utils" + includeNames: /^sentry-utils-\d.*\.tgz$/ + ## 1.3 Core SDK + - name: npm + id: "@sentry/core" + includeNames: /^sentry-core-\d.*\.tgz$/ + ## 1.4 Tracing package + - name: npm + id: "@sentry-internal/tracing" + includeNames: /^sentry-internal-tracing-\d.*\.tgz$/ + ## 1.5 Replay package (browser only) + - name: npm + id: "@sentry/replay" + includeNames: /^sentry-replay-\d.*\.tgz$/ + + ## 2. Browser & Node SDKs + - name: npm + id: "@sentry/browser" + includeNames: /^sentry-browser-\d.*\.tgz$/ + - name: npm + id: "@sentry/node" + includeNames: /^sentry-node-\d.*\.tgz$/ + + ## 3 Browser-based Packages + - name: npm + id: "@sentry/angular-ivy" + includeNames: /^sentry-angular-ivy-\d.*\.tgz$/ + - name: npm + id: "@sentry/angular" + includeNames: /^sentry-angular-\d.*\.tgz$/ + - name: npm + id: "@sentry/ember" + includeNames: /^sentry-ember-\d.*\.tgz$/ + - name: npm + id: "@sentry/react" + includeNames: /^sentry-react-\d.*\.tgz$/ + - name: npm + id: "@sentry/svelte" + includeNames: /^sentry-svelte-\d.*\.tgz$/ + - name: npm + id: "@sentry/vue" + includeNames: /^sentry-vue-\d.*\.tgz$/ + - name: npm + id: "@sentry/wasm" + includeNames: /^sentry-wasm-\d.*\.tgz$/ + - name: npm + id: "@sentry/integrations" + includeNames: /^sentry-integrations-\d.*\.tgz$/ + + ## 4. Node-based Packages + - name: npm + id: "@sentry/serverless" + includeNames: /^sentry-serverless-\d.*\.tgz$/ + - name: npm + id: "@sentry/opentelemetry-node" + includeNames: /^sentry-opentelemetry-node-\d.*\.tgz$/ + + ## 5. Fullstack/Meta Frameworks (depending on Node and Browser or Framework SDKs) + - name: npm + id: "@sentry/nextjs" + includeNames: /^sentry-nextjs-\d.*\.tgz$/ + - name: npm + id: "@sentry/remix" + includeNames: /^sentry-remix-\d.*\.tgz$/ + - name: npm + id: "@sentry/sveltekit" + includeNames: /^sentry-sveltekit-\d.*\.tgz$/ + - name: npm + id: "@sentry/gatsby" + includeNames: /^sentry-gatsby-\d.*\.tgz$/ + + ## 6. Other Packages + ## 6.1 + - name: npm + id: "@sentry-internal/typescript" + includeNames: /^sentry-internal-typescript-\d.*\.tgz$/ + - name: npm + id: "@sentry-internal/eslint-plugin-sdk" + includeNames: /^sentry-internal-eslint-plugin-sdk-\d.*\.tgz$/ + ## 6.2 + - name: npm + id: "@sentry-internal/eslint-config-sdk" + includeNames: /^sentry-internal-eslint-config-sdk-\d.*\.tgz$/ + + ## 7. Deprecated packages we still release (but no packages depend on them anymore) + - name: npm + id: "@sentry/hub" + includeNames: /^sentry-hub-\d.*\.tgz$/ + - name: npm + id: "@sentry/tracing" + includeNames: /^sentry-tracing-\d.*\.tgz$/ + + # AWS Lambda Layer target - name: aws-lambda-layer includeNames: /^sentry-node-serverless-\d+.\d+.\d+(-(beta|alpha)\.\d+)?\.zip$/ layerName: SentryNodeServerlessSDK @@ -14,16 +115,22 @@ targets: - nodejs16.x - nodejs18.x license: MIT + + # CDN Bundle Target - name: gcs + id: "browser-cdn-bundles" includeNames: /.*\.js.*$/ bucket: sentry-js-sdk paths: - path: /{{version}}/ metadata: cacheControl: 'public, max-age=31536000' + + # Github Release Target - name: github includeNames: /^sentry-.*$/ - - name: npm + + # Sentry Release Registry Target - name: registry sdks: 'npm:@sentry/browser': diff --git a/docs/new-sdk-release-checklist.md b/docs/new-sdk-release-checklist.md index 075068a68cc9..aca0f0f399c4 100644 --- a/docs/new-sdk-release-checklist.md +++ b/docs/new-sdk-release-checklist.md @@ -58,8 +58,13 @@ When you’re ready to make the first release, there are a couple of steps that - [ ] 1) If not yet done, be sure to remove the `private: true` property from your SDK’s `package.json`. Additionally, ensure that `"publishConfig": {"access": "public"}` is set. - [ ] 2) Make sure that the new SDK is **not added** in`[craft.yml](https://github.com/getsentry/sentry-javascript/blob/master/.craft.yml)` as a target for the **Sentry release registry**\ *Once this is added, craft will try to publish an entry in the next release which does not work and caused failed release runs in the past* -- [ ] 3) Make sure the new SDK is not excluded from the github & npm targets in `.craft.yml` -- [ ] 4) Cut a new release (as usual, via GH release action and Craft) +- [ ] 3) Add an `npm` target in `craft.yml` for the new package. Make sure to insert it in the right place, after all the Sentry dependencies of your package but before packages that depend on your new package (if applicable). + ```yml + - name: npm + id: npm:@sentry/[yourPackage] + includeNames: /^sentry-[yourPackage]-\d.*\.tgz$/ + ``` +- [ ] 4) Cut a new release (as usual, see [Publishing Release](https://github.com/getsentry/sentry-javascript/blob/develop/docs/publishing-a-release.md)) ### After the Release From 68c449182723348b81a3df4a4f873c8e68c6a47f Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 19 Jul 2023 04:50:29 -0400 Subject: [PATCH 5/9] fix(browser): 0 is a valid index (#8581) --- packages/browser/src/profiling/utils.ts | 6 +++--- packages/types/src/profiling.ts | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/browser/src/profiling/utils.ts b/packages/browser/src/profiling/utils.ts index 6c9b4d8ed6b9..4a9a9af1d658 100644 --- a/packages/browser/src/profiling/utils.ts +++ b/packages/browser/src/profiling/utils.ts @@ -249,9 +249,9 @@ export function convertJSSelfProfileToSampledFormat(input: JSSelfProfile): Profi if (profile.frames[stackTop.frameId] === undefined) { profile.frames[stackTop.frameId] = { function: frame.name, - file: frame.resourceId ? input.resources[frame.resourceId] : undefined, - line: frame.line, - column: frame.column, + abs_path: typeof frame.resourceId === 'number' ? input.resources[frame.resourceId] : undefined, + lineno: frame.line, + colno: frame.column, }; } diff --git a/packages/types/src/profiling.ts b/packages/types/src/profiling.ts index d99736df735e..84a5238e7ace 100644 --- a/packages/types/src/profiling.ts +++ b/packages/types/src/profiling.ts @@ -14,8 +14,9 @@ export type ThreadCpuStack = FrameId[]; export type ThreadCpuFrame = { function: string; file?: string; - line?: number; - column?: number; + lineno?: number; + colno?: number; + abs_path?: string; }; export interface ThreadCpuProfile { From 1ed3705797866b95a38369e6bfcae88028b1a25f Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 19 Jul 2023 09:22:07 -0400 Subject: [PATCH 6/9] types(browser): Add browser profiling client options (#8565) Adds the profilesSampleRate type to browser client options. --- packages/browser/src/client.ts | 5 ++++- packages/types/src/browseroptions.ts | 8 ++++++++ packages/types/src/index.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index ab877a782efa..fba5dfc008e6 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -1,6 +1,7 @@ import type { Scope } from '@sentry/core'; import { BaseClient, SDK_VERSION } from '@sentry/core'; import type { + BrowserClientProfilingOptions, BrowserClientReplayOptions, ClientOptions, Event, @@ -23,7 +24,9 @@ import { createUserFeedbackEnvelope } from './userfeedback'; * Configuration options for the Sentry Browser SDK. * @see @sentry/types Options for more information. */ -export type BrowserOptions = Options & BrowserClientReplayOptions; +export type BrowserOptions = Options & + BrowserClientReplayOptions & + BrowserClientProfilingOptions; /** * Configuration options for the Sentry Browser SDK Client class diff --git a/packages/types/src/browseroptions.ts b/packages/types/src/browseroptions.ts index 9eeea6350728..63341322ff56 100644 --- a/packages/types/src/browseroptions.ts +++ b/packages/types/src/browseroptions.ts @@ -16,3 +16,11 @@ export type BrowserClientReplayOptions = { */ replaysOnErrorSampleRate?: number; }; + +export type BrowserClientProfilingOptions = { + /** + * The sample rate for profiling + * 1.0 will profile all transactions and 0 will profile none. + */ + profilesSampleRate?: number; +}; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index d9b55aeef077..5ce2e1fe6ce5 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -115,5 +115,5 @@ export type { WrappedFunction } from './wrappedfunction'; export type { Instrumenter } from './instrumenter'; export type { HandlerDataFetch, HandlerDataXhr, SentryXhrData, SentryWrappedXMLHttpRequest } from './instrument'; -export type { BrowserClientReplayOptions } from './browseroptions'; +export type { BrowserClientReplayOptions, BrowserClientProfilingOptions } from './browseroptions'; export type { CheckIn, MonitorConfig, SerializedCheckIn } from './checkin'; From 48e97d3df7bab956adfa0f4b01688b8020d441dd Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 19 Jul 2023 15:37:02 +0200 Subject: [PATCH 7/9] meta: Update CHANGELOG for 7.59.3 (#8586) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8455c1efebb3..371111ddbadb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott +## 7.59.3 + +- fix(browser): 0 is a valid index (#8581) +- fix(nextjs): Ensure Webpack plugin is available after dynamic require (#8584) +- types(browser): Add browser profiling client options (#8565) + ## 7.59.2 No changes. This release was published to fix publishing issues with 7.59.0 and 7.59.1. From 1c286883b83d11a8866bab39d4a09dd741716a0a Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 19 Jul 2023 15:45:10 +0200 Subject: [PATCH 8/9] Revert "meta: Update CHANGELOG for 7.59.3 (#8586)" (#8587) --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 371111ddbadb..8455c1efebb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,6 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott -## 7.59.3 - -- fix(browser): 0 is a valid index (#8581) -- fix(nextjs): Ensure Webpack plugin is available after dynamic require (#8584) -- types(browser): Add browser profiling client options (#8565) - ## 7.59.2 No changes. This release was published to fix publishing issues with 7.59.0 and 7.59.1. From ac1e6db29043826a57029e3b7d953113a2dc7881 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 19 Jul 2023 15:43:06 +0200 Subject: [PATCH 9/9] meta: Update Changelog for 7.59.3 (again) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8455c1efebb3..371111ddbadb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott +## 7.59.3 + +- fix(browser): 0 is a valid index (#8581) +- fix(nextjs): Ensure Webpack plugin is available after dynamic require (#8584) +- types(browser): Add browser profiling client options (#8565) + ## 7.59.2 No changes. This release was published to fix publishing issues with 7.59.0 and 7.59.1.