Skip to content

chore: Remove unneeded deps from main package.json #12644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
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
3 changes: 2 additions & 1 deletion dev-packages/bundle-analyzer-scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

This repository contains a set of scenarios to check the SDK against webpack bundle analyzer.

You can run the scenarios by running `yarn analyze` and selecting the scenario you want to run.
You can run the scenarios by running `yarn analyze --scenario SCENARIO_NAME`. To view all avaliable scenarios, run
`yarn analyze --list`.

If you want to have more granular analysis of modules, you can build the SDK packages with with `preserveModules` set to
`true`. You can do this via the `SENTRY_BUILD_PRESERVE_MODULES`.
Expand Down
7 changes: 3 additions & 4 deletions dev-packages/bundle-analyzer-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
"license": "MIT",
"private": true,
"dependencies": {
"html-webpack-plugin": "^5.5.0",
"inquirer": "^8.2.0",
"webpack": "^5.76.0",
"webpack-bundle-analyzer": "^4.5.0"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.92.1",
"webpack-bundle-analyzer": "^4.10.2"
},
"scripts": {
"analyze": "node webpack.cjs"
Expand Down
35 changes: 20 additions & 15 deletions dev-packages/bundle-analyzer-scenarios/webpack.cjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
const path = require('path');
const { promises } = require('fs');
const path = require('node:path');
const { promises } = require('node:fs');
const { parseArgs } = require('node:util');

const inquirer = require('inquirer');
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const HtmlWebpackPlugin = require('html-webpack-plugin');

async function init() {
const scenarios = await getScenariosFromDirectories();

const answers = await inquirer.prompt([
{
type: 'rawlist',
name: 'scenario',
message: 'Which scenario you want to run?',
choices: scenarios,
pageSize: scenarios.length,
loop: false,
},
]);
const { values } = parseArgs({
args: process.argv.slice(2),
options: { scenario: { type: 'string', short: 's' }, list: { type: 'boolean', short: 'l' } },
});

if (values.list) {
console.log('Available scenarios:', scenarios);
process.exit(0);
}

if (!scenarios.some(scenario => scenario === values.scenario)) {
console.error('Invalid scenario:', values.scenario);
console.error('Available scenarios:', scenarios);
process.exit(1);
}

console.log(`Bundling scenario: ${answers.scenario}`);
console.log(`Bundling scenario: ${values.scenario}`);

await runWebpack(answers.scenario);
await runWebpack(values.scenario);
}

async function runWebpack(scenario) {
Expand Down
5 changes: 3 additions & 2 deletions dev-packages/node-integration-tests/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import type { AddressInfo } from 'net';
import type { BaseTransportOptions, Envelope, Transport, TransportMakeRequestResponse } from '@sentry/types';
import type { Express } from 'express';

/**
* Debug logging transport
Expand All @@ -21,7 +22,7 @@ export function loggingTransport(_options: BaseTransportOptions): Transport {
/**
* Starts an express server and sends the port to the runner
*/
export function startExpressServerAndSendPortToRunner(app: Express): void {
export function startExpressServerAndSendPortToRunner(app: any): void {
const server = app.listen(0, () => {
const address = server.address() as AddressInfo;

Expand Down
10 changes: 5 additions & 5 deletions dev-packages/node-integration-tests/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as http from 'http';
import type { AddressInfo } from 'net';
import * as path from 'path';
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as Sentry from '@sentry/node';
import type { EnvelopeItemType } from '@sentry/types';
import { logger, parseSemver } from '@sentry/utils';
import type { AxiosRequestConfig } from 'axios';
import axios from 'axios';
import type { Express } from 'express';
import type { HttpTerminator } from 'http-terminator';
import { createHttpTerminator } from 'http-terminator';
import nock from 'nock';
Expand Down Expand Up @@ -146,10 +146,10 @@ export class TestEnv {
const defaultServerPath = path.resolve(process.cwd(), 'utils', 'defaults', 'server');

const [server, url] = await new Promise<[http.Server, string]>(resolve => {
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
const app = require(serverPath || defaultServerPath).default as Express;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const app = require(serverPath || defaultServerPath).default as any;

app.get('/test', (_req, res) => {
app.get('/test', (_req: any, res: any) => {
try {
require(scenarioPath || `${testDir}/scenario`);
} finally {
Expand Down
6 changes: 4 additions & 2 deletions dev-packages/node-integration-tests/utils/server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import type { AddressInfo } from 'net';
import type { Envelope } from '@sentry/types';
import { parseEnvelope } from '@sentry/utils';
Expand All @@ -12,7 +14,7 @@ import express from 'express';
export function createBasicSentryServer(onEnvelope: (env: Envelope) => void): Promise<number> {
const app = express();
app.use(express.raw({ type: () => true, inflate: true, limit: '100mb' }));
app.post('/api/:id/envelope/', (req, res) => {
app.post('/api/:id/envelope/', (req: any, res: any) => {
try {
const env = parseEnvelope(req.body as Buffer);
onEnvelope(env);
Expand Down Expand Up @@ -48,7 +50,7 @@ export function createTestServer(done: (error: unknown) => void) {
const app = express();

for (const [path, callback, result] of gets) {
app.get(path, (req, res) => {
app.get(path, (req: any, res: any) => {
try {
callback(req.headers);
} catch (e) {
Expand Down
2 changes: 2 additions & 0 deletions dev-packages/overhead-metrics/src/util/github.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */

import * as fs from 'fs';
import path from 'path';
import { Octokit } from '@octokit/rest';
Expand Down
19 changes: 0 additions & 19 deletions dev-packages/rollup-utils/plugins/npmPlugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
* Sucrase plugin docs: https://github.com/rollup/plugins/tree/master/packages/sucrase
*/

import * as fs from 'fs';
import * as path from 'path';

import { codecovRollupPlugin } from '@codecov/rollup-plugin';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import cleanup from 'rollup-plugin-cleanup';
Expand Down Expand Up @@ -160,19 +156,4 @@ export function makeRrwebBuildPlugin({ excludeShadowDom, excludeIframe } = {}) {
});
}

/**
* Plugin that uploads bundle analysis to codecov.
*
* @param type The type of bundle being uploaded.
* @param prefix The prefix for the codecov bundle name. Defaults to 'npm'.
*/
export function makeCodeCovPlugin() {
const packageJson = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }));
return codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: packageJson.name,
uploadToken: process.env.CODECOV_TOKEN,
});
}

export { makeExtractPolyfillsPlugin } from './extractPolyfillsPlugin.mjs';
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
],
"devDependencies": {
"@biomejs/biome": "^1.4.0",
"@codecov/rollup-plugin": "0.0.1-beta.5",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-esm-shim": "^0.1.5",
"@rollup/plugin-json": "^6.1.0",
Expand All @@ -102,8 +101,8 @@
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@rollup/pluginutils": "^5.1.0",
"@size-limit/file": "~11.1.0",
"@size-limit/webpack": "~11.1.0",
"@size-limit/file": "~11.1.4",
"@size-limit/webpack": "~11.1.4",
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
"@types/jest": "^27.4.1",
"@types/jsdom": "^21.1.6",
Expand All @@ -112,7 +111,6 @@
"codecov": "^3.6.5",
"deepmerge": "^4.2.2",
"downlevel-dts": "~0.11.0",
"es-check": "7.1.0",
"eslint": "7.32.0",
"jest": "^27.5.1",
"jest-environment-node": "^27.5.1",
Expand All @@ -122,12 +120,11 @@
"nodemon": "^2.0.16",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.1",
"replace-in-file": "^4.0.0",
"rimraf": "^3.0.2",
"rollup": "^4.13.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-license": "^3.3.1",
"size-limit": "~11.1.0",
"size-limit": "~11.1.4",
"sucrase": "^3.35.0",
"ts-jest": "^27.1.4",
"ts-node": "10.9.1",
Expand All @@ -136,8 +133,15 @@
"vitest": "^1.6.0",
"yalc": "^1.0.0-pre.53"
},
"//_resolutions_comment": [
"Because new versions of strip-ansi, string-width, and wrap-ansi are ESM only packages,",
"we need to resolve them to the CommonJS versions.",
"This is a temporary solution until we can upgrade to a version of lerna that supports ESM packages"
],
"resolutions": {
"gauge/strip-ansi": "6.0.1"
"gauge/strip-ansi": "6.0.1",
"wide-align/string-width": "4.2.3",
"cliui/wrap-ansi": "7.0.0"
},
"version": "0.0.0",
"name": "sentry-javascript",
Expand Down
4 changes: 2 additions & 2 deletions packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"@sentry/types": "8.12.0",
"@sentry/utils": "8.12.0",
"@sentry/vite-plugin": "2.20.1",
"magic-string": "0.30.7",
"magic-string": "0.30.10",
"magicast": "0.2.8",
"sorcery": "0.11.0"
},
"devDependencies": {
"@babel/types": "7.20.7",
"@babel/types": "7.24.7",
"@sveltejs/kit": "^2.0.2",
"svelte": "^4.2.8",
"vite": "^5.0.10"
Expand Down
1 change: 0 additions & 1 deletion packages/sveltekit/src/vite/autoInstrument.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
import type { ExportNamedDeclaration } from '@babel/types';
import { parseModule } from 'magicast';
import type { Plugin } from 'vite';
Expand Down
44 changes: 27 additions & 17 deletions scripts/versionbump.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
const replace = require('replace-in-file');
const { readFile, writeFile } = require('node:fs').promises;
const pjson = require(`${process.cwd()}/package.json`);

const files = process.argv.slice(2);
if (files.length === 0) {
console.error('Please provide files to bump');
process.exit(1);
}
const REPLACE_REGEX = /\d+\.\d+.\d+(?:-\w+(?:\.\w+)?)?/g;

async function run() {
const files = process.argv.slice(2);
if (files.length === 0) {
// eslint-disable-next-line no-console
console.error('[versionbump] Please provide files to bump');
process.exit(1);
}

replace({
files: files,
from: /\d+\.\d+.\d+(?:-\w+(?:\.\w+)?)?/g,
to: pjson.version,
})
.then(changedFiles => {
console.log('Modified files:', changedFiles.join(', '));
})
.catch(error => {
console.error('Error occurred:', error);
try {
await Promise.all(
files.map(async file => {
const data = String(await readFile(file, 'utf8'));
await writeFile(file, data.replace(REPLACE_REGEX, pjson.version));
}),
);

// eslint-disable-next-line no-console
console.log(`[versionbump] Bumped version for ${files.join(', ')}`);
} catch (error) {
// eslint-disable-next-line no-console
console.error('[versionbump] Error occurred:', error);
process.exit(1);
});
}
}

run();
Loading
Loading