Skip to content

Commit

Permalink
ref(types): Add dedupe to available TS types (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed May 22, 2023
1 parent 216949d commit eb134b7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
19 changes: 17 additions & 2 deletions js/__tests__/helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,37 @@ describe('SentryCli helper', () => {
helper.prepareCommand(command, SOURCEMAPS_OPTIONS, { sourceMapReference: true })
).toEqual(['releases', 'files', 'release', 'upload-sourcemaps', '/dev/null']);

expect(helper.prepareCommand(command, SOURCEMAPS_OPTIONS, { rewrite: true })).toEqual([
expect(
helper.prepareCommand(command, SOURCEMAPS_OPTIONS, { decompress: true, rewrite: true })
).toEqual([
'releases',
'files',
'release',
'upload-sourcemaps',
'/dev/null',
'--decompress',
'--rewrite',
]);

expect(helper.prepareCommand(command, SOURCEMAPS_OPTIONS, { rewrite: false })).toEqual([
expect(
helper.prepareCommand(command, SOURCEMAPS_OPTIONS, { rewrite: false, dedupe: false })
).toEqual([
'releases',
'files',
'release',
'upload-sourcemaps',
'/dev/null',
'--no-rewrite',
'--no-dedupe',
]);

// Only `invertedParam` registered for `dedupe` in `uploadSourcemaps`, so it should not add anything for positive boolean.
expect(helper.prepareCommand(command, SOURCEMAPS_OPTIONS, { dedupe: true })).toEqual([
'releases',
'files',
'release',
'upload-sourcemaps',
'/dev/null',
]);

expect(() => {
Expand Down
5 changes: 5 additions & 0 deletions js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ declare module '@sentry/cli' {
* This prevents the automatic detection of sourcemap references.
*/
sourceMapReference?: boolean;
/**
* Enable artifacts deduplication prior to uploading. This will skip uploading
* any artifacts that are already present on the server. Defaults to `true`.
*/
dedupe?: boolean;
/**
* When paired with the rewrite option this will remove a prefix from uploaded files.
* For instance you can use this to remove a path that is build machine specific.
Expand Down
1 change: 1 addition & 0 deletions js/releases/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class Releases {
* ignoreFile: null, // path to a file with ignore rules
* rewrite: false, // preprocess sourcemaps before uploading
* sourceMapReference: true, // add a source map reference to source files
* dedupe: true, // deduplicate already uploaded files
* stripPrefix: [], // remove certain prefices from filenames
* stripCommonPrefix: false, // guess common prefices to remove from filenames
* validate: false, // validate source maps and cancel the upload on error
Expand Down
4 changes: 4 additions & 0 deletions js/releases/options/uploadSourcemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ module.exports = {
invertedParam: '--no-sourcemap-reference',
type: 'boolean',
},
dedupe: {
invertedParam: '--no-dedupe',
type: 'boolean',
},
stripPrefix: {
param: '--strip-prefix',
type: 'array',
Expand Down

0 comments on commit eb134b7

Please sign in to comment.