Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ Also, check the [example](example) directory.
| Option | Type | Required | Description |
| ------------------ | ----------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| include | `string`/`array`/`object` | required | One or more paths that Sentry CLI should scan recursively for sources. It will upload all `.map` files and match associated `.js` files. Each path can be given as an object with path-specific options. See [table below](#include) for details. |
| org | `string` | optional | The slug of the Sentry organization associated with the app. |
| project | `string` | optional | The slug of the Sentry project associated with the app. |
| org | `string` | optional | The slug of the Sentry organization associated with the app. Can also be specified via `process.env.SENTRY_ORG`. |
| project | `string` | optional | The slug of the Sentry project associated with the app. Can also be specified via `process.env.SENTRY_PROJECT`. |
| authToken | `string` | optional | The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: `project:releases` (and `org:read` if `setCommits` option is used). |
| url | `string` | optional | The base URL of your Sentry instance. Defaults to https://sentry.io/, which is the correct value for SAAS customers. |
| customHeader | `string` | optional | A header added to all outgoing requests. A string in the format `header-key: header-value` |
| vcsRemote | `string` | optional | The name of the remote in the version control system. Defaults to `origin`. |
| release | `string` | optional | Unique identifier for the release. Defaults to the output of the `sentry-cli releases propose-version` command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses `HEAD`'s commit SHA. (**For `HEAD` option, requires access to `git` CLI and for the root directory to be a valid repository**). |
| release | `string` | optional | Unique identifier for the release. Can also be specified via `process.env.SENTRY_RELEASE`. Defaults to the output of the `sentry-cli releases propose-version` command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses `HEAD`'s commit SHA. (**For `HEAD` option, requires access to `git` CLI and for the root directory to be a valid repository**). |
| dist | `string` | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number. |
| entries | `array`/`RegExp`/`function(key: string): bool` | optional | Filter for entry points that should be processed. By default, the release will be injected into all entry points. |
| ignoreFile | `string` | optional | Path to a file containing list of files/directories to ignore. Can point to `.gitignore` or anything with the same format. |
Expand Down
14 changes: 11 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function attachAfterCodeGenerationHook(compiler, options) {
sourceMap.set(
'javascript',
new RawSource(
`${rawSource.source()}
`${rawSource.source()}
(function (){
var globalThis = (typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {});
globalThis.SENTRY_RELEASES = globalThis.SENTRY_RELEASES || {};
Expand Down Expand Up @@ -260,8 +260,10 @@ class SentryCliPlugin {
* Returns undefined if proposeVersion failed.
*/
getReleasePromise() {
return (this.options.release
? Promise.resolve(this.options.release)
const userSpecifiedRelease =
this.options.release || process.env.SENTRY_RELEASE;
return (userSpecifiedRelease
? Promise.resolve(userSpecifiedRelease)
: this.cli.releases.proposeVersion()
)
.then(version => `${version}`.trim())
Expand Down Expand Up @@ -398,6 +400,9 @@ class SentryCliPlugin {
{
loader: SENTRY_LOADER,
options: {
// We check for `process.env.SENTRY_RELEASE` earlier, which is why
// it's not used here the way `process.env.SENTRY_ORG` and
// `process.env.SENTRY_PROJECT` are
releasePromise: this.release,
org: this.options.org || process.env.SENTRY_ORG,
project: this.options.project || process.env.SENTRY_PROJECT,
Expand Down Expand Up @@ -570,6 +575,9 @@ class SentryCliPlugin {
}

attachAfterCodeGenerationHook(compiler, {
// We check for `process.env.SENTRY_RELEASE` earlier, which is why it's
// not used here the way `process.env.SENTRY_ORG` and
// `process.env.SENTRY_PROJECT` are
releasePromise: this.release,
org: this.options.org || process.env.SENTRY_ORG,
project: this.options.project || process.env.SENTRY_PROJECT,
Expand Down