npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@zooshdigital/bitbucket-code-insights

v1.3.0

Published

Function to upload reports to Bitbucket

Readme

Zoosh Bitbucket Code Insights

The Zoosh Bitbucket Code Insights is designed for uploading builds, reports or other metadata to Bitbucket Pull Requests. It constructs the URL for the Bitbucket API based on the provided external ID (which represents the name of the report), and then sends REST API requests to publish the information. The request body is formatted as JSON and includes necessary details such as title, report type, details, result, and data. Upon successful upload, the script logs the response from Bitbucket.

The project is fully typed, so information about what and how can be uploaded is documented by types.

Installation

To install Zoosh Bitbucket Code Insights, simply include it as a dependency in your project's package.json file:

npm install @zooshdigital/bitbucket-code-insights

or

yarn add @zooshdigital/bitbucket-code-insights

Prerequisites

Authentication

While some requests could be automatically authenticated running in a pipeline, Bitbucket doesn't allow that for all endpoints. Thus, for simplicity, the library expects an access token for all API calls. This can be a repository, project or workspace access token in the BITBUCKET_BUILD_TOKEN environment variable. Create a token and make it available as a repository or deployment variable to the pipeline.

Other identifiers

Since information is attached to a commit (even in case of a pull request), the library needs the BITBUCKET_REPO_FULL_NAME and BITBUCKET_COMMIT environment variables to do that. These two are standard Bitbucket pipeline variables, so there is no need to set them explicitly if running the script in a pipeline.

Usage

The project offers the following function to easily upload metadata to our commits or pull requests:

  • uploadReportToBitbucket: Creates a "report" with the given metrics. This is best used for attaching useful information to a pull requests (for example coverage metrics).
  • uploadAnnotationsToBitbucket: Attaches "annotations" to a report created by the previous command (these annotations can be shown in the diff view of the pull request)
  • createBuildOnBitbucket: Creates a "build" with the given details. This is useful to show the result of a specific build or test step explicitly in the list of builds, besides the main pipeline build.

More details can be found in the Bitbucket API documentation here.

Example

To use the uploadReportToBitbucket function in your project, you can access it like this:

import uploadReportToBitbucket from '@zooshdigital/bitbucket-code-insights';

const externalId = 'your_external_id';
const body = {
  // Report body
};

await uploadReportToBitbucket(externalId, body);

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.