-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffc5596
commit c317b76
Showing
22 changed files
with
285 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
"@codecov/standalone-analyzer": patch | ||
"@codecov/standalone-analyzer": minor | ||
--- | ||
|
||
Add support for no-bundler through new Standalone Analyzer library and CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { createAndUploadReport } = require("@codecov/standalone-analyzer"); | ||
|
||
const buildDir = "../../../examples/standalone/cli/dist"; | ||
|
||
const coreOpts = { | ||
dryRun: true, | ||
uploadToken: "your-upload-token", | ||
retryCount: 3, | ||
apiUrl: "https://api.codecov.io", | ||
bundleName: "my-bundle", // bundle identifier in Codecov | ||
enableBundleAnalysis: true, | ||
debug: true, | ||
}; | ||
|
||
const standaloneOpts = { | ||
beforeReportUpload: async (original) => original, | ||
}; | ||
|
||
createAndUploadReport(buildDir, coreOpts, standaloneOpts) | ||
.then((reportAsJson) => | ||
console.log(`Report successfully generated and uploaded: ${reportAsJson}`), | ||
) | ||
.catch((error) => | ||
console.error("Failed to generate or upload report:", error), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@codecov/example-standalone-analyzer-library", | ||
"version": "1.0.0", | ||
"private": true, | ||
"main": "analyze.js", | ||
"scripts": { | ||
"start": "node analyze.js" | ||
}, | ||
"devDependencies": { | ||
"@codecov/standalone-analyzer": "workspace:^" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Standalone Analyzer Library Import (ESM) Example | ||
|
||
This directory includes an example calling the standalone-analyzer exported library for bundle analysis. | ||
|
||
This example runs in an ESM environment. | ||
|
||
To run: | ||
|
||
``` | ||
# build the library | ||
cd packages/standalone-analyzer | ||
pnpm install | ||
pnpm run build | ||
# create an example build to analyze | ||
cd examples/standalone/cli | ||
pnpm install | ||
pnpm run build | ||
# run the node program | ||
cd examples/standalone/library-import | ||
pnpm install | ||
pnpm run start | ||
``` | ||
|
||
This will call the imported function. Note a Codecov API server (e.g., that at `test-api`) needs to be running for any uploads (i.e., not dry-run) to succeed. | ||
|
||
For example: | ||
|
||
``` | ||
pnpm run start | ||
``` | ||
|
||
Generates a bundle stats report and prints to console: | ||
|
||
``` | ||
Dry run output: {"version":"2","builtAt":1725381817642,"duration":6,"bundleName":"my-bundle","plugin":{"name":"@codecov/standalone-analyzer","version":"0.0.1-beta.12"},"assets":[{"name":"main.js","size":511,"gzipSize":301,"normalized":"main.js"},{"name":"main.js.map","size":732,"gzipSize":null,"normalized":"main.js.map"}],"chunks":[],"modules":[]} | ||
Report successfully generated and uploaded. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
``` | ||
pnpm install | ||
pnpm run run | ||
pnpm run start | ||
``` | ||
|
||
``` | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,11 +48,13 @@ | |
"generate:typedoc": "typedoc --options ./typedoc.json" | ||
}, | ||
"dependencies": { | ||
"@codecov/bundler-plugin-core": "workspace:^" | ||
"@codecov/bundler-plugin-core": "workspace:^", | ||
"yargs": "^17.7.2" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@types/node": "^20.11.15", | ||
"@types/yargs": "^17.0.33", | ||
"@vitest/coverage-v8": "^1.5.0", | ||
"codecovProdRollupPlugin": "npm:@codecov/[email protected]", | ||
"msw": "^2.1.5", | ||
|
Oops, something went wrong.