New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@codecov/bundle-analyzer

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codecov/bundle-analyzer

Official Codecov Bundle Analyzer

  • 1.8.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
534
decreased by-7.77%
Maintainers
0
Weekly downloads
 
Created
Source

Codecov by Sentry logo

Codecov Bundle Analyzer

The bundle analyzer is an importable library and CLI for Codecov bundle analysis. It is designed for users who operate without a standard bundler that is otherwise supported by Codecov's bundler plugins.

[!NOTE] The plugin does not support code coverage, see our docs to set up coverage today!

Installation

Using npm:

npm install @codecov/bundle-analyzer --save-dev

Using yarn:

yarn add @codecov/bundle-analyzer --dev

Using pnpm:

pnpm add @codecov/bundle-analyzer --save-dev

Example - Custom Script

This example shows how the package can be imported as a library.

// analyze.js
const { createAndUploadReport } = require("@codecov/bundle-analyzer");

const buildDirs = ["/path/to/build"];

const coreOpts = {
  dryRun: true,
  uploadToken: "your-upload-token",
  retryCount: 3,
  apiUrl: "https://api.codecov.io",
  bundleName: "@codecov/example-bundle-analyzer-cjs",
  enableBundleAnalysis: true,
  debug: true,
};

const bundleAnalyzerOpts = {
  beforeReportUpload: async (original) => original,
  ignorePatterns: ["*.map"],
  normalizeAssetsPattern: "[name]-[hash].js",
};

createAndUploadReport(buildDirs, coreOpts, bundleAnalyzerOpts)
  .then((reportAsJson) =>
    console.log(`Report successfully generated and uploaded: ${reportAsJson}`),
  )
  .catch((error) =>
    console.error("Failed to generate or upload report:", error),
  );

Example - CLI

This example shows how the package can be used as a CLI.

npx @codecov/bundle-analyzer ./dist --bundle-name=my-identifier --upload-token=abcd --dry-run

[OPTIONAL] - A config file can be passed for any extended options matching those described here.

npx @codecov/bundle-analyzer ./dist --bundle-name=my-identifier --upload-token=abcd --dry-run --config-file=./config.json
// config.json
{
  "gitService": "github",
  "oidc": {
    "useGitHubOIDC": false
  }
}

Supported Platforms

The CLI tool supports the following operating systems:

  • macOS
  • Linux

More information

Keywords

FAQs

Package last updated on 20 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc