You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Move javascript files to native typescript (#2989)
(closes#2617)
(closes [CLI-142](https://linear.app/getsentry/issue/CLI-142/use-typescript-to-generate-type-declarations))
This PR migrates all JavaScript files in the `lib/` directory to native TypeScript, removing the need for JSDoc type annotations and improving type safety.
### Main Changes
- Converted all `.js` files to `.ts` with proper TypeScript syntax
- Changed module system from CommonJS to ES6 modules for better TypeScript interoperability
- Updated exports to use ES6 `export` syntax instead of `module.exports`
- All types are now exported as named exports for better type inference and IDE support
- `OptionsSchema` is now a union to satisfy `SOURCEMAPS_OPTIONS`, as this one didn't had the required `param`
- The exports of `lib/releases/options` has changed its name
### Breaking Changes
**Module Exports**
- **Before**: `module.exports = SentryCli;` (CommonJS)
- **After**: `export class SentryCli { ... }` (ES6 named export)
We could have maintained backwards compatibility with `export = SentryCli;`. The only problem were the types which needed to be exported as well. With ES6 named exports, we can now export all types alongside the class.
### Internal Improvements
Simplified `Release` constructor
- **Before**: `new Releases({ ...this.options, configFile })` - configFile was merged into options
- **After**: `new Releases(this.options, configFile)` - two separate parameters
With 2 parameters it's easier to maintain and makes the separation of concerns clearer.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,25 @@ The following changes only apply when using `sentry-cli` via the npm package [`@
29
29
- Removed the `apiKey` option from `SentryCliOptions` ([#2935](https://github.com/getsentry/sentry-cli/pull/2935)). If you are using `apiKey`, you need to generate and use an [Auth Token](https://docs.sentry.io/account/auth-tokens/) via the `authToken` option, instead.
30
30
- Removed the `useArtifactBundle` option from `SentryCliUploadSourceMapsOptions` ([#3002](https://github.com/getsentry/sentry-cli/pull/3002)). This deprecated option was a no-op that users should simply stop passing.
31
31
- Drop support for Node.js <18. The minimum required Node.js version is now 18.0.0 ([#2985](https://github.com/getsentry/sentry-cli/issues/2985)).
32
+
- The type export `SentryCliReleases` has been removed.
33
+
- The JavaScript wrapper now uses named exports instead of default exports ([#2989](https://github.com/getsentry/sentry-cli/pull/2989)). You need to update your imports:
* If the `configFile` parameter is specified, configuration located in the default
36
38
* location and the value specified in the `SENTRY_PROPERTIES` environment variable is
37
39
* overridden.
38
40
*
39
-
* @param{string | null} [configFile] - Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files.
41
+
* @param configFile Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files.
40
42
* By default, the config file is looked for upwards from the current path and defaults from ~/.sentryclirc are always loaded.
41
43
* This value will update `SENTRY_PROPERTIES` env variable.
42
-
* @param{SentryCliOptions} [options] - More options to pass to the CLI
0 commit comments