Skip to content

Commit d7f191c

Browse files
author
Luca Forstner
authored
feat: Add filesToDeleteAfterUpload alias for deleteFilesAfterUpload (#313)
1 parent 1b9e331 commit d7f191c

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

packages/bundler-plugin-core/src/debug-id-upload.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface DebugIdUploadPluginOptions {
2323
handleRecoverableError: (error: unknown) => void;
2424
sentryHub: Hub;
2525
sentryClient: NodeClient;
26-
deleteFilesAfterUpload?: string | string[];
26+
filesToDeleteAfterUpload?: string | string[];
2727
sentryCliOptions: {
2828
url: string;
2929
authToken: string;
@@ -46,7 +46,7 @@ export function createDebugIdUploadFunction({
4646
sentryClient,
4747
sentryCliOptions,
4848
rewriteSourcesHook,
49-
deleteFilesAfterUpload,
49+
filesToDeleteAfterUpload,
5050
}: DebugIdUploadPluginOptions) {
5151
return async (buildArtifactPaths: string[]) => {
5252
const artifactBundleUploadTransaction = sentryHub.startTransaction({
@@ -157,11 +157,11 @@ export function createDebugIdUploadFunction({
157157
uploadSpan.finish();
158158
}
159159

160-
if (deleteFilesAfterUpload) {
160+
if (filesToDeleteAfterUpload) {
161161
const deleteGlobSpan = artifactBundleUploadTransaction.startChild({
162162
description: "delete-glob",
163163
});
164-
const filePathsToDelete = await glob(deleteFilesAfterUpload, {
164+
const filePathsToDelete = await glob(filesToDeleteAfterUpload, {
165165
absolute: true,
166166
nodir: true,
167167
});

packages/bundler-plugin-core/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ export function sentryUnpluginFactory({
222222
createDebugIdUploadFunction({
223223
assets: options.sourcemaps?.assets,
224224
ignore: options.sourcemaps?.ignore,
225-
deleteFilesAfterUpload: options.sourcemaps?.deleteFilesAfterUpload,
225+
filesToDeleteAfterUpload:
226+
options.sourcemaps?.filesToDeleteAfterUpload ??
227+
options.sourcemaps?.deleteFilesAfterUpload,
226228
dist: options.release.dist,
227229
releaseName: options.release.name,
228230
logger: logger,

packages/bundler-plugin-core/src/sentry/telemetry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ export function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bund
8383
// Miscelaneous options
8484
hub.setTag("custom-error-handler", !!errorHandler);
8585
hub.setTag("sourcemaps-assets", !!sourcemaps?.assets);
86-
hub.setTag("delete-after-upload", !!sourcemaps?.deleteFilesAfterUpload);
86+
hub.setTag(
87+
"delete-after-upload",
88+
!!sourcemaps?.deleteFilesAfterUpload || !!sourcemaps?.filesToDeleteAfterUpload
89+
);
8790

8891
hub.setTag("node", process.version);
8992
hub.setTag("platform", process.platform);

packages/bundler-plugin-core/src/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,20 @@ export interface Options {
125125
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
126126
*
127127
* Use the `debug` option to print information about which files end up being deleted.
128+
*
129+
* @deprecated Use `filesToDeleteAfterUpload` instead.
128130
*/
131+
// TODO(v3): Remove this option.
129132
deleteFilesAfterUpload?: string | string[];
133+
134+
/**
135+
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact upload to Sentry has been completed.
136+
*
137+
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
138+
*
139+
* Use the `debug` option to print information about which files end up being deleted.
140+
*/
141+
filesToDeleteAfterUpload?: string | string[];
130142
};
131143

132144
/**

packages/dev-utils/src/generate-documentation-table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ errorHandler: (err) => {
9494
"Hook to rewrite the `sources` field inside the source map before being uploaded to Sentry. Does not modify the actual source map. Effectively, this modifies how files inside the stacktrace will show up in Sentry.\n\nDefaults to making all sources relative to `process.cwd()` while building.",
9595
},
9696
{
97-
name: "deleteFilesAfterUpload",
97+
name: "filesToDeleteAfterUpload",
9898
type: "string | string[]",
9999
fullDescription:
100100
"A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact upload to Sentry has been completed.\n\nThe globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)\n\nUse the `debug` option to print information about which files end up being deleted.",

0 commit comments

Comments
 (0)