Skip to content

Commit

Permalink
Merge branch 'main' into add-in-bundle-name-config-option
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov authored Dec 19, 2023
2 parents 92ae7b4 + 7fc27b3 commit 3930adc
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 11 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,26 @@

# Codecov Bundler Plugins

TODO
> [!WARNING]
> These plugins are currently in alpha and are subject to change.
Codecov plugins for various JavaScript bundlers. Currently supporting Rollup, Vite, Webpack 5.

Checkout the individual packages for more information and examples:

- [Rollup](https://npmjs.org/package/@codecov/rollup-plugin)
- [Vite](https://npmjs.org/package/@codecov/vite-plugin)
- [Webpack](https://npmjs.org/package/@codecov/webpack-plugin)

## Features

The Codecov Bundler Plugins take care of Codecov-related tasks at build time of your JavaScript programs.
It supports the following features:

- Bundle Analysis Stats Upload

## More information

- [Codecov Documentation](https://docs.codecov.com/docs)
- [Codecov Feedback](https://github.com/codecov/feedback/discussions)
- [Sentry Discord](https://discord.gg/Ww9hbqr)
14 changes: 14 additions & 0 deletions integration-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<p align="center">
<a href="https://about.codecov.io" target="_blank">
<img src="https://about.codecov.io/wp-content/themes/codecov/assets/brand/sentry-cobranding/logos/codecov-by-sentry-logo.svg" alt="Codecov by Sentry logo" width="280" height="84">
</a>
</p>

# Integration Tests

Each directory in the fixtures directory represents one testing scenario, with a corresponding test file for each bundler we currently support.
When `pnpm run test:e2e` is ran, we run jest, which will pick up all \*.test.ts files.

In the `test-api` directory is a simple API that we use to create more realistic testing scenarios for each bundler.

In the `test-apps` directory are a set of apps that we use to test the integration with each bundler.
9 changes: 3 additions & 6 deletions integration-tests/test-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import { Hono } from "hono";

const app = new Hono();

app.get("/", (c) => c.text("Hello Hono!"));

app.all(
"/:status{[0-9]{3}}/upload/bundle_analysis/v1/:badPUT{true|false}",
"/test-url/:status/:badPUT{true|false}/upload/bundle_analysis/v1",
(c) => {
const status = parseInt(c.req.param("status"));
const badPUT = c.req.param("badPUT") === "true";
const url = new URL(c.req.url);
let putURL = `${url.protocol}//${url.host}/file-upload`;

if (status >= 400 && !badPUT) {
return c.text(`Error code: ${status}`, { status });
}

const url = new URL(c.req.url);
let putURL = `${url.protocol}//${url.host}/file-upload`;

if (badPUT) {
putURL = `${putURL}/${status}`;
}
Expand Down
23 changes: 22 additions & 1 deletion packages/bundler-plugin-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,25 @@

# Codecov Bundler Plugin Core

TODO
> [!WARNING]
> These plugins are currently in alpha and are subject to change.
Core package containing the bundler-agnostic logic for the Codecov Bundler Plugins.

Checkout the individual packages for more information and examples:

- [Rollup](https://npmjs.org/package/@codecov/rollup-plugin)
- [Vite](https://npmjs.org/package/@codecov/vite-plugin)
- [Webpack](https://npmjs.org/package/@codecov/webpack-plugin)

## Features

The Codecov Bundler Core package contains the following functionality:

- Bundle Analysis Stats Upload

## More information

- [Codecov Documentation](https://docs.codecov.com/docs)
- [Codecov Feedback](https://github.com/codecov/feedback/discussions)
- [Sentry Discord](https://discord.gg/Ww9hbqr)
50 changes: 49 additions & 1 deletion packages/rollup-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,52 @@

# Codecov Rollup Plugin

TODO
> [!WARNING]
> These plugins are currently in alpha and are subject to change.
> A Rollup plugin that provides bundle analysis support for Codecov.
## Installation

Using npm:

```bash
npm install @codecov/rollup-plugin --save-dev
```

Using yarn:

```bash
yarn add @codecov/rollup-plugin --dev
```

Using pnpm

```bash
pnpm add @codecov/rollup-plugin --save-dev
```

## Example

```js
// rollup.config.js
import { defineConfig } from "rollup";
import { codecovRollupPlugin } from "@codecov/rollup-plugin";

export default defineConfig({
plugins: [
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: true,
bundleName: "example-rollup-bundle",
globalUploadToken: process.env.CODECOV_TOKEN,
}),
],
});
```

## More information

- [Codecov Documentation](https://docs.codecov.com/docs)
- [Codecov Feedback](https://github.com/codecov/feedback/discussions)
- [Sentry Discord](https://discord.gg/Ww9hbqr)
50 changes: 49 additions & 1 deletion packages/vite-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,52 @@

# Codecov Vite Plugin

TODO
> [!WARNING]
> These plugins are currently in alpha and are subject to change.
> A Vite plugin that provides bundle analysis support for Codecov.
## Installation

Using npm:

```bash
npm install @codecov/vite-plugin --save-dev
```

Using yarn:

```bash
yarn add @codecov/vite-plugin --dev
```

Using pnpm

```bash
pnpm add @codecov/vite-plugin --save-dev
```

## Example

```js
// vite.config.js
import { defineConfig } from "vite";
import { codecovVitePlugin } from "@codecov/vite-plugin";

export default defineConfig({
plugins: [
// Put the Codecov vite plugin after all other plugins
codecovVitePlugin({
enableBundleAnalysis: true,
bundleName: "example-vite-bundle",
globalUploadToken: process.env.CODECOV_TOKEN,
}),
],
});
```

## More information

- [Codecov Documentation](https://docs.codecov.com/docs)
- [Codecov Feedback](https://github.com/codecov/feedback/discussions)
- [Sentry Discord](https://discord.gg/Ww9hbqr)
56 changes: 55 additions & 1 deletion packages/webpack-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,58 @@

# Codecov Webpack Plugin

TODO
> [!WARNING]
> These plugins are currently in alpha and are subject to change.
> A Webpack plugin that provides bundle analysis support for Codecov.
## Installation

Using npm:

```bash
npm install @codecov/webpack-plugin --save-dev
```

Using yarn:

```bash
yarn add @codecov/webpack-plugin --dev
```

Using pnpm

```bash
pnpm add @codecov/webpack-plugin --save-dev
```

## Example

```js
// webpack.config.js
const path = require("path");
const { codecovWebpackPlugin } = require("@codecov/webpack-plugin");

module.exports = {
entry: "./src/index.js",
mode: "production",
output: {
filename: "main.js",
path: path.resolve(__dirname, "dist"),
},
plugins: [
// Put the Codecov vite plugin after all other plugins
codecovWebpackPlugin({
enableBundleAnalysis: true,
bundleName: "example-webpack-bundle",
globalUploadToken: process.env.CODECOV_TOKEN,
}),
],
};
```

## More information

- [Codecov Documentation](https://docs.codecov.com/docs)
- [Codecov Feedback](https://github.com/codecov/feedback/discussions)
- [Sentry Discord](https://discord.gg/Ww9hbqr)

0 comments on commit 3930adc

Please sign in to comment.