diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f991c416e..b9bd0710b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,26 @@ we should rename this section to "Unreleased" --> The following changes only apply when using `sentry-cli` via the npm package [`@sentry/cli`](https://www.npmjs.com/package/@sentry/cli): - 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)). +- The type export `SentryCliReleases` has been removed +- 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: + ```js + // Old (default import) + const SentryCli = require('@sentry/cli'); + + // New (named import) + const { SentryCli } = require('@sentry/cli'); + ``` + + For ESM imports: + ```js + // Old + import SentryCli from '@sentry/cli'; + + // New + import { SentryCli } from '@sentry/cli'; + ``` + ### Improvements @@ -546,7 +566,7 @@ We made several refactors and added several tests in this release. These changes

Changes to tests

- + - ref(test): Broaden `with_header_matcher` types (#2261) by @szokeasaurusrex - ref(test): Accept `impl Into` for `with_matcher` (#2260) by @szokeasaurusrex - ref(test): Align `with_reponse_body` parameter to `mockito` (#2259) by @szokeasaurusrex diff --git a/bin/sentry-cli b/bin/sentry-cli index 81fb8c6f65..438b359c13 100755 --- a/bin/sentry-cli +++ b/bin/sentry-cli @@ -3,7 +3,7 @@ 'use strict'; const childProcess = require('child_process'); -const SentryCli = require('../js'); +const { SentryCli } = require('../js'); const child = childProcess .spawn(SentryCli.getPath(), process.argv.slice(2), { diff --git a/jest.config.js b/jest.config.js index b75329e4be..c97a791b4c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,7 @@ module.exports = { setupFiles: ['/setupTests.js'], testPathIgnorePatterns: ['/src/'], + transform: { + '^.+\\.ts$': 'ts-jest', + }, }; diff --git a/lib/__tests__/helper.test.js b/lib/__tests__/helper.test.js index b5988ca66b..b5ebe92660 100644 --- a/lib/__tests__/helper.test.js +++ b/lib/__tests__/helper.test.js @@ -2,7 +2,7 @@ const os = require('os'); const helper = require('../helper'); -const SOURCEMAPS_OPTIONS = require('../releases/options/uploadSourcemaps'); +const { SOURCEMAPS_OPTIONS } = require('../releases/options/uploadSourcemaps'); describe('SentryCli helper', () => { test('call sentry-cli --version', () => { diff --git a/lib/helper.js b/lib/helper.ts similarity index 81% rename from lib/helper.js rename to lib/helper.ts index d0387ebd43..068c886e33 100644 --- a/lib/helper.js +++ b/lib/helper.ts @@ -1,9 +1,10 @@ 'use strict'; -const os = require('os'); -const path = require('path'); -const fs = require('fs'); -const childProcess = require('child_process'); +import * as os from 'node:os'; +import * as path from 'node:path'; +import * as fs from 'node:fs'; +import * as childProcess from 'node:child_process'; +import { SentryCliOptions } from './types'; const BINARY_DISTRIBUTIONS = [ { packageName: '@sentry/cli-darwin', subpath: 'bin/sentry-cli' }, @@ -23,9 +24,9 @@ const BINARY_DISTRIBUTIONS = [ * Without this, the binary can be detected as an asset and included by bundlers * that use @vercel/nft. * - * @returns {string} The path to the sentry-cli binary + * @returns The path to the sentry-cli binary */ -function getFallbackBinaryPath() { +function getFallbackBinaryPath(): string { const parts = []; parts.push(__dirname); parts.push('..'); @@ -93,9 +94,9 @@ function getDistributionForThisPlatform() { /** * Throws an error with a message stating that Sentry CLI doesn't support the current platform. * - * @returns {never} nothing. It throws. + * @returns nothing. It throws. */ -function throwUnsupportedPlatformError() { +function throwUnsupportedPlatformError(): void { throw new Error( `Unsupported operating system or architecture! Sentry CLI does not work on this architecture. @@ -110,9 +111,9 @@ Sentry CLI supports: * Tries to find the installed Sentry CLI binary - either by looking into the relevant * optional dependencies or by trying to resolve the fallback binary. * - * @returns {string} The path to the sentry-cli binary + * @returns The path to the sentry-cli binary */ -function getBinaryPath() { +function getBinaryPath(): string { if (process.env.SENTRY_BINARY_PATH) { return process.env.SENTRY_BINARY_PATH; } @@ -161,47 +162,41 @@ It seems like none of the "@sentry/cli" package's optional dependencies got inst /** * Will be used as the binary path when defined with `mockBinaryPath`. - * @type {string | undefined} */ -let mockedBinaryPath; +let mockedBinaryPath: string | undefined; /** * Overrides the default binary path with a mock value, useful for testing. * - * @param {string} mockPath The new path to the mock sentry-cli binary + * @param mockPath The new path to the mock sentry-cli binary * @deprecated This was used in tests internally and will be removed in the next major version. */ // TODO(v3): Remove this function -function mockBinaryPath(mockPath) { +function mockBinaryPath(mockPath: string) { mockedBinaryPath = mockPath; } -/** - * The javascript type of a command line option. - * @typedef {'array'|'string'|'boolean'|'inverted-boolean'} OptionType - */ - -/** - * Schema definition of a command line option. - * @typedef {object} OptionSchema - * @prop {string} param The flag of the command line option including dashes. - * @prop {OptionType} type The value type of the command line option. - * @prop {string} [invertedParam] The flag of the command line option including dashes (optional). - */ - -/** - * Schema definition for a command. - * @typedef {Object.} OptionsSchema - */ +export type OptionsSchema = Record< + string, + | { + param: string; + type: 'array' | 'string' | 'number' | 'boolean' | 'inverted-boolean'; + invertedParam?: string; + } + | { + param?: never; + type: 'array' | 'string' | 'number' | 'boolean' | 'inverted-boolean'; + invertedParam: string; + } +>; /** * Serializes command line options into an arguments array. * - * @param {OptionsSchema} schema An options schema required by the command. - * @param {object} options An options object according to the schema. - * @returns {string[]} An arguments array that can be passed via command line. + * @param schema An options schema required by the command. + * @param options An options object according to the schema. */ -function serializeOptions(schema, options) { +function serializeOptions(schema: OptionsSchema, options: Record): string[] { return Object.keys(schema).reduce((newOptions, option) => { const paramValue = options[option]; if (paramValue === undefined || paramValue === null) { @@ -246,20 +241,23 @@ function serializeOptions(schema, options) { /** * Serializes the command and its options into an arguments array. * - * @param {string[]} command The literal name of the command. - * @param {OptionsSchema} [schema] An options schema required by the command. - * @param {object} [options] An options object according to the schema. - * @returns {string[]} An arguments array that can be passed via command line. + * @param command The literal name of the command. + * @param schema An options schema required by the command. + * @param options An options object according to the schema. + * @returns An arguments array that can be passed via command line. */ -function prepareCommand(command, schema, options) { +function prepareCommand( + command: string[], + schema: OptionsSchema, + options: Record +): string[] { return command.concat(serializeOptions(schema || {}, options || {})); } /** * Returns the absolute path to the `sentry-cli` binary. - * @returns {string} */ -function getPath() { +function getPath(): string { return mockedBinaryPath !== undefined ? mockedBinaryPath : getBinaryPath(); } @@ -280,17 +278,23 @@ function getPath() { * const output = await execute(['--version']); * expect(output.trim()).toBe('sentry-cli x.y.z'); * - * @param {string[]} args Command line arguments passed to `sentry-cli`. - * @param {boolean} live can be set to: + * @param args Command line arguments passed to `sentry-cli`. + * @param live can be set to: * - `true` to inherit stdio and reject the promise if the command * exits with a non-zero exit code. * - `false` to not inherit stdio and return the output as a string. - * @param {boolean} silent Disable stdout for silents build (CI/Webpack Stats, ...) - * @param {string} [configFile] Relative or absolute path to the configuration file. - * @param {import('./index').SentryCliOptions} [config] More configuration to pass to the CLI - * @returns {Promise} A promise that resolves to the standard output. + * @param silent Disable stdout for silents build (CI/Webpack Stats, ...) + * @param configFile Relative or absolute path to the configuration file. + * @param config More configuration to pass to the CLI + * @returns A promise that resolves to the standard output. */ -async function execute(args, live, silent, configFile, config = {}) { +async function execute( + args: string[], + live: boolean, + silent: boolean, + configFile: string | undefined, + config: SentryCliOptions = {} +): Promise { const env = { ...process.env }; if (configFile) { env.SENTRY_PROPERTIES = configFile; @@ -353,7 +357,7 @@ function getProjectFlagsFromOptions({ projects = [] } = {}) { return projects.reduce((flags, project) => flags.concat('-p', project), []); } -module.exports = { +export { execute, getPath, getProjectFlagsFromOptions, diff --git a/lib/index.js b/lib/index.ts similarity index 55% rename from lib/index.js rename to lib/index.ts index be7bcefaa2..fe2f8fb239 100644 --- a/lib/index.js +++ b/lib/index.ts @@ -1,17 +1,17 @@ 'use strict'; -const pkgInfo = require('../package.json'); -const helper = require('./helper'); -const Releases = require('./releases'); +import * as pkgInfo from '../package.json'; +import * as helper from './helper'; +import Releases from './releases'; +import type { SentryCliOptions } from './types'; -/** - * @typedef {import('./types').SentryCliOptions} SentryCliOptions - * @typedef {import('./types').SentryCliUploadSourceMapsOptions} SentryCliUploadSourceMapsOptions - * @typedef {import('./types').SourceMapsPathDescriptor} SourceMapsPathDescriptor - * @typedef {import('./types').SentryCliNewDeployOptions} SentryCliNewDeployOptions - * @typedef {import('./types').SentryCliCommitsOptions} SentryCliCommitsOptions - * @typedef {import('./types').SentryCliReleases} SentryCliReleases - */ +export type { + SentryCliOptions, + SentryCliUploadSourceMapsOptions, + SourceMapsPathDescriptor, + SentryCliNewDeployOptions, + SentryCliCommitsOptions, +} from './types'; /** * Interface to and wrapper around the `sentry-cli` executable. @@ -28,7 +28,9 @@ const Releases = require('./releases'); * const release = await cli.releases.proposeVersion()); * console.log(release); */ -class SentryCli { +export class SentryCli { + public releases: Releases; + /** * Creates a new `SentryCli` instance. * @@ -36,47 +38,43 @@ class SentryCli { * location and the value specified in the `SENTRY_PROPERTIES` environment variable is * overridden. * - * @param {string | null} [configFile] - Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files. + * @param configFile Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files. * By default, the config file is looked for upwards from the current path and defaults from ~/.sentryclirc are always loaded. * This value will update `SENTRY_PROPERTIES` env variable. - * @param {SentryCliOptions} [options] - More options to pass to the CLI + * @param options More options to pass to the CLI */ - constructor(configFile, options) { + constructor(public configFile: string | null, public options: SentryCliOptions) { if (typeof configFile === 'string') { this.configFile = configFile; } this.options = options || { silent: false }; - this.releases = new Releases({ ...this.options, configFile }); + this.releases = new Releases(this.options, configFile); } /** * Returns the version of the installed `sentry-cli` binary. - * @returns {string} */ - static getVersion() { + static getVersion(): string { return pkgInfo.version; } /** * Returns an absolute path to the `sentry-cli` binary. - * @returns {string} */ - static getPath() { + static getPath(): string { return helper.getPath(); } /** * See {helper.execute} docs. - * @param {string[]} args Command line arguments passed to `sentry-cli`. - * @param {boolean} live can be set to: + * @param args Command line arguments passed to `sentry-cli`. + * @param live can be set to: * - `true` to inherit stdio and reject the promise if the command * exits with a non-zero exit code. * - `false` to not inherit stdio and return the output as a string. - * @returns {Promise} A promise that resolves to the standard output. + * @returns A promise that resolves to the standard output. */ - execute(args, live) { + execute(args: string[], live: boolean): Promise { return helper.execute(args, live, this.options.silent, this.configFile, this.options); } } - -module.exports = SentryCli; diff --git a/lib/logger.js b/lib/logger.ts similarity index 50% rename from lib/logger.js rename to lib/logger.ts index bfe73e6500..8e2b3ed756 100644 --- a/lib/logger.js +++ b/lib/logger.ts @@ -1,11 +1,9 @@ 'use strict'; -const format = require('util').format; +import { format } from 'node:util'; -module.exports = class Logger { - constructor(stream) { - this.stream = stream; - } +export class Logger { + constructor(public stream: NodeJS.WriteStream) {} log() { const message = format(...arguments); diff --git a/lib/releases/__tests__/index.test.js b/lib/releases/__tests__/index.test.js index 25ed4ccec5..491a509c9e 100644 --- a/lib/releases/__tests__/index.test.js +++ b/lib/releases/__tests__/index.test.js @@ -1,4 +1,4 @@ -const SentryCli = require('../..'); +const { SentryCli } = require('../..'); describe('SentryCli releases', () => { afterEach(() => { @@ -23,7 +23,7 @@ describe('SentryCli releases', () => { beforeEach(() => { mockExecute.mockClear(); // eslint-disable-next-line global-require - const SentryCliLocal = require('../..'); + const { SentryCli: SentryCliLocal } = require('../..'); cli = new SentryCliLocal(); }); describe('new', () => { diff --git a/lib/releases/index.js b/lib/releases/index.ts similarity index 67% rename from lib/releases/index.js rename to lib/releases/index.ts index 8b01f2d769..cb8e4f5641 100644 --- a/lib/releases/index.js +++ b/lib/releases/index.ts @@ -1,49 +1,26 @@ 'use strict'; +import { + SentryCliCommitsOptions, + SentryCliNewDeployOptions, + SentryCliOptions, + SentryCliUploadSourceMapsOptions, +} from '../types'; +import { DEPLOYS_OPTIONS } from './options/deploys'; +import { SOURCEMAPS_OPTIONS } from './options/uploadSourcemaps'; + const helper = require('../helper'); /** * Default arguments for the `--ignore` option. - * @type {string[]} - */ -const DEFAULT_IGNORE = ['node_modules']; - -/** - * Schema for the `upload-sourcemaps` command. - * @type {import('../helper').OptionsSchema} - */ -const SOURCEMAPS_SCHEMA = require('./options/uploadSourcemaps'); - -/** - * Schema for the `deploys new` command. - * @type {import('../helper').OptionsSchema} - */ -const DEPLOYS_SCHEMA = require('./options/deploys'); - -/** - * @typedef {import('../types').SentryCliUploadSourceMapsOptions} SentryCliUploadSourceMapsOptions - * @typedef {import('../types').SourceMapsPathDescriptor} SourceMapsPathDescriptor - * @typedef {import('../types').SentryCliNewDeployOptions} SentryCliNewDeployOptions - * @typedef {import('../types').SentryCliCommitsOptions} SentryCliCommitsOptions */ +const DEFAULT_IGNORE: string[] = ['node_modules']; /** * Manages releases and release artifacts on Sentry. - * @namespace SentryReleases */ -class Releases { - /** - * Creates a new `Releases` instance. - * - * @param {Object} [options] More options to pass to the CLI - */ - constructor(options) { - this.options = options || {}; - if (typeof this.options.configFile === 'string') { - this.configFile = this.options.configFile; - } - delete this.options.configFile; - } +export default class Releases { + constructor(public options: SentryCliOptions = {}, private configFile: string | null) {} /** * Registers a new release with sentry. @@ -51,12 +28,11 @@ class Releases { * The given release name should be unique and deterministic. It can later be used to * upload artifacts, such as source maps. * - * @param {string} release Unique name of the new release. - * @param {{projects?: string[]}} [options] The list of project slugs for a release. - * @returns {Promise} A promise that resolves when the release has been created. - * @memberof SentryReleases + * @param release Unique name of the new release. + * @param options The list of project slugs for a release. + * @returns A promise that resolves when the release has been created. */ - async new(release, options) { + async new(release: string, options: { projects?: string[] }): Promise { const args = ['releases', 'new', release].concat(helper.getProjectFlagsFromOptions(options)); return this.execute(args, null); } @@ -64,12 +40,11 @@ class Releases { /** * Specifies the set of commits covered in this release. * - * @param {string} release Unique name of the release - * @param {SentryCliCommitsOptions} options A set of options to configure the commits to include - * @returns {Promise} A promise that resolves when the commits have been associated - * @memberof SentryReleases + * @param release Unique name of the release + * @param options A set of options to configure the commits to include + * @returns A promise that resolves when the commits have been associated */ - async setCommits(release, options) { + async setCommits(release: string, options: SentryCliCommitsOptions): Promise { if (!options || (!options.auto && (!options.repo || !options.commit))) { throw new Error('options.auto, or options.repo and options.commit must be specified'); } @@ -95,11 +70,10 @@ class Releases { * Marks this release as complete. This should be called once all artifacts has been * uploaded. * - * @param {string} release Unique name of the release. - * @returns {Promise} A promise that resolves when the release has been finalized. - * @memberof SentryReleases + * @param release Unique name of the release. + * @returns A promise that resolves when the release has been finalized. */ - async finalize(release) { + async finalize(release: string): Promise { return this.execute(['releases', 'finalize', release], null); } @@ -107,10 +81,9 @@ class Releases { * Creates a unique, deterministic version identifier based on the project type and * source files. This identifier can be used as release name. * - * @returns {Promise} A promise that resolves to the version string. - * @memberof SentryReleases + * @returns A promise that resolves to the version string. */ - async proposeVersion() { + async proposeVersion(): Promise { const version = await this.execute(['releases', 'propose-version'], null); return version.trim(); } @@ -144,12 +117,14 @@ class Releases { * decompress: false // decompress gzip files before uploading * }); * - * @param {string} release Unique name of the release. - * @param {SentryCliUploadSourceMapsOptions} options Options to configure the source map upload. - * @returns {Promise} A promise that resolves when the upload has completed successfully. - * @memberof SentryReleases + * @param release Unique name of the release. + * @param options Options to configure the source map upload. + * @returns A promise that resolves when the upload has completed successfully. */ - async uploadSourceMaps(release, options) { + async uploadSourceMaps( + release: string, + options: SentryCliUploadSourceMapsOptions + ): Promise { if (!options || !options.include || !Array.isArray(options.include)) { throw new Error( '`options.include` must be a valid array of paths and/or path descriptor objects.' @@ -192,7 +167,7 @@ class Releases { return uploadPaths.map((path) => // `execute()` is async and thus we're returning a promise here - this.execute(helper.prepareCommand([...args, path], SOURCEMAPS_SCHEMA, newOptions), true) + this.execute(helper.prepareCommand([...args, path], SOURCEMAPS_OPTIONS, newOptions), true) ); }); @@ -207,11 +182,10 @@ class Releases { /** * List all deploys for a given release. * - * @param {string} release Unique name of the release. - * @returns {Promise} A promise that resolves when the list comes back from the server. - * @memberof SentryReleases + * @param release Unique name of the release. + * @returns A promise that resolves when the list comes back from the server. */ - async listDeploys(release) { + async listDeploys(release: string): Promise { return this.execute(['releases', 'deploys', release, 'list'], null); } @@ -232,31 +206,28 @@ class Releases { * url: 'https://example.com', // URL that points to the deployment * }); * - * @param {string} release Unique name of the release. - * @param {SentryCliNewDeployOptions} options Options to configure the new release deploy. - * @returns {Promise} A promise that resolves when the deploy has been created. - * @memberof SentryReleases + * @param release Unique name of the release. + * @param options Options to configure the new release deploy. + * @returns A promise that resolves when the deploy has been created. */ - async newDeploy(release, options) { + async newDeploy(release: string, options: SentryCliNewDeployOptions): Promise { if (!options || !options.env) { throw new Error('options.env must be a valid name'); } const args = ['releases', 'deploys', release, 'new']; - return this.execute(helper.prepareCommand(args, DEPLOYS_SCHEMA, options), null); + return this.execute(helper.prepareCommand(args, DEPLOYS_OPTIONS, options), null); } /** * See {helper.execute} docs. - * @param {string[]} args Command line arguments passed to `sentry-cli`. - * @param {boolean} live can be set to: + * @param args Command line arguments passed to `sentry-cli`. + * @param live can be set to: * - `true` to inherit stdio and reject the promise if the command * exits with a non-zero exit code. * - `false` to not inherit stdio and return the output as a string. - * @returns {Promise} A promise that resolves to the standard output. + * @returns A promise that resolves to the standard output. */ - async execute(args, live) { + async execute(args: string[], live: boolean): Promise { return helper.execute(args, live, this.options.silent, this.configFile, this.options); } } - -module.exports = Releases; diff --git a/lib/releases/options/deploys.js b/lib/releases/options/deploys.ts similarity index 70% rename from lib/releases/options/deploys.js rename to lib/releases/options/deploys.ts index d3733db585..e0baeaf5aa 100644 --- a/lib/releases/options/deploys.js +++ b/lib/releases/options/deploys.ts @@ -1,7 +1,9 @@ +import { OptionsSchema } from '../../helper'; + /** - * @type {import('../../helper').OptionsSchema} + * Schema for the `deploys new` command. */ -module.exports = { +export const DEPLOYS_OPTIONS = { env: { param: '--env', type: 'string', @@ -26,4 +28,4 @@ module.exports = { param: '--url', type: 'string', }, -}; +} satisfies OptionsSchema; diff --git a/lib/releases/options/uploadSourcemaps.js b/lib/releases/options/uploadSourcemaps.ts similarity index 86% rename from lib/releases/options/uploadSourcemaps.js rename to lib/releases/options/uploadSourcemaps.ts index 4385e60677..43713e64e6 100644 --- a/lib/releases/options/uploadSourcemaps.js +++ b/lib/releases/options/uploadSourcemaps.ts @@ -1,7 +1,9 @@ +import { OptionsSchema } from "../../helper"; + /** - * @type {import('../../helper').OptionsSchema} + * Schema for the `upload-sourcemaps` command. */ -module.exports = { +export const SOURCEMAPS_OPTIONS = { ignore: { param: '--ignore', type: 'array', @@ -59,4 +61,4 @@ module.exports = { param: '--use-artifact-bundle', type: 'boolean', }, -}; +} satisfies OptionsSchema; \ No newline at end of file diff --git a/lib/types.ts b/lib/types.ts index d966e65b67..167add3ccc 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -209,27 +209,3 @@ export interface SentryCliCommitsOptions { */ ignoreEmpty?: boolean; } - -/** - * Release management interface - */ -export interface SentryCliReleases { - new (release: string, options?: { projects: string[] } | string[]): Promise; - - setCommits(release: string, options: SentryCliCommitsOptions): Promise; - - finalize(release: string): Promise; - - proposeVersion(): Promise; - - uploadSourceMaps( - release: string, - options: SentryCliUploadSourceMapsOptions & { live?: boolean } - ): Promise; - - listDeploys(release: string): Promise; - - newDeploy(release: string, options: SentryCliNewDeployOptions): Promise; - - execute(args: string[], live: boolean): Promise; -} diff --git a/package-lock.json b/package-lock.json index 3d3ad70c6c..239cd6979d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1293,6 +1293,15 @@ "update-browserslist-db": "^1.1.3" } }, + "bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "requires": { + "fast-json-stable-stringify": "2.x" + } + }, "bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -3546,6 +3555,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -3584,6 +3599,12 @@ } } }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -4884,6 +4905,22 @@ "punycode": "^2.1.1" } }, + "ts-jest": { + "version": "27.1.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz", + "integrity": "sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA==", + "dev": true, + "requires": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^27.0.0", + "json5": "2.x", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "7.x", + "yargs-parser": "20.x" + } + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 26c8d533dc..ba9fbe7b5a 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "jest": "^27.5.1", "npm-run-all": "^4.1.5", "prettier": "2.8.8", + "ts-jest": "^27.1.5", "typescript": "5.8.3" }, "optionalDependencies": { @@ -37,9 +38,9 @@ "@sentry/cli-linux-arm64": "2.58.2", "@sentry/cli-linux-i686": "2.58.2", "@sentry/cli-linux-x64": "2.58.2", + "@sentry/cli-win32-arm64": "2.58.2", "@sentry/cli-win32-i686": "2.58.2", - "@sentry/cli-win32-x64": "2.58.2", - "@sentry/cli-win32-arm64": "2.58.2" + "@sentry/cli-win32-x64": "2.58.2" }, "scripts": { "postinstall": "npm run install-cli", diff --git a/scripts/install.js b/scripts/install.js index eb1fb94987..8f79ab24fc 100755 --- a/scripts/install.js +++ b/scripts/install.js @@ -18,7 +18,7 @@ const which = require('which'); const helper = require('../js/helper'); const pkgInfo = require('../package.json'); -const Logger = require('../js/logger'); +const { Logger } = require('../js/logger'); const logger = new Logger(getLogStream('stderr')); diff --git a/tsconfig.json b/tsconfig.json index b36b57978d..047e84c95e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "checkJs": true, "resolveJsonModule": true, "target": "ES2015", + "module": "commonjs", "moduleResolution": "node", "skipLibCheck": true, "rootDir": "lib",