-
Notifications
You must be signed in to change notification settings - Fork 56
feat(core): Add SENTRY_RELEASES variable during release injection
#102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/integration-tests/fixtures/releases-injection/input/entrypoint.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
| process.stdout.write(global.SENTRY_RELEASES["releasesProject@releasesOrg"].id.toString()); |
38 changes: 38 additions & 0 deletions
38
packages/integration-tests/fixtures/releases-injection/releases-injection.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import childProcess from "child_process"; | ||
| import path from "path"; | ||
|
|
||
| /** | ||
| * Runs a node file in a seprate process. | ||
| * | ||
| * @param bundlePath Path of node file to run | ||
| * @returns Stdout of the process | ||
| */ | ||
| function checkBundle(bundlePath: string): void { | ||
| const processOutput = childProcess.execSync(`node ${bundlePath}`, { encoding: "utf-8" }); | ||
| expect(processOutput).toBe("I AM A RELEASE!"); | ||
| } | ||
|
|
||
| test("esbuild bundle", () => { | ||
| expect.assertions(1); | ||
| checkBundle(path.join(__dirname, "./out/esbuild/index.js")); | ||
| }); | ||
|
|
||
| test("rollup bundle", () => { | ||
| expect.assertions(1); | ||
| checkBundle(path.join(__dirname, "./out/rollup/index.js")); | ||
| }); | ||
|
|
||
| test("vite bundle", () => { | ||
| expect.assertions(1); | ||
| checkBundle(path.join(__dirname, "./out/vite/index.js")); | ||
| }); | ||
|
|
||
| test("webpack 4 bundle", () => { | ||
| expect.assertions(1); | ||
| checkBundle(path.join(__dirname, "./out/webpack4/index.js")); | ||
| }); | ||
|
|
||
| test("webpack 5 bundle", () => { | ||
| expect.assertions(1); | ||
| checkBundle(path.join(__dirname, "./out/webpack5/index.js")); | ||
| }); |
15 changes: 15 additions & 0 deletions
15
packages/integration-tests/fixtures/releases-injection/setup.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Options } from "@sentry/bundler-plugin-core"; | ||
| import * as path from "path"; | ||
| import { createCjsBundles } from "../../utils/create-cjs-bundles"; | ||
|
|
||
| const entryPointPath = path.resolve(__dirname, "./input/entrypoint.js"); | ||
| const outputDir = path.resolve(__dirname, "./out"); | ||
|
|
||
| createCjsBundles({ index: entryPointPath }, outputDir, { | ||
| release: "I AM A RELEASE!", | ||
| project: "releasesProject", | ||
| org: "releasesOrg", | ||
| include: outputDir, | ||
| dryRun: true, | ||
| injectReleasesMap: true, | ||
| } as Options); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: can we make this hidden behind a flag? I'd rather not inject things unnecessarily. I recognize this is a breaking change, but given this is undocumented I'm fine making the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fair and it would not bloat the bundle unnecessarily for all 99% of users. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, is this something that people could have to opt-in to? If that's easy to do, I would say let people opt in (then, in a hypothetical world where we have a better understanding of which options are set by users, we can take better decisions in the future about this functionality). Seems like it is something pretty specific to want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a3ca32f