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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cloud-build-badge

v1.4.1

Published

A cloud function that changes GitHub badges depending on Cloud Build status. Forked from sbsends/cloud-build-badge

Downloads

53

Readme

cloud-build-badge

npm version License

Automate the creation of Google Cloud Build badges for your project! Cloud builds in the Google Cloud Platform are fun, but unlike Travis, Circle-CI, and AppVeyor, it doesn't provide badges out-of-the-box. This small script aims to provide a solution.

(This is a fork of sbsends/cloud-build-badge that solves the same problem using sed commands and environment variables. My aim is to provide a more "JS-native" solution)

I also wrote a blog post tutorial for creating Cloud Build badges. Read it here

Setup

The first three steps ensure that we have the required badges in our project's cloud storage. The last step simply install this package in your system.

  1. Ensure that you have the Google Cloud SDK installed in your system.
  2. In your project, create a Google Cloud Storage bucket (referred to as ${BUCKET}), and make a folder named build.
  3. Inside build/, save an SVG copy of the SUCCESS and FAILURE badges. You can create your own here, or you can just copy and save from here (success, failure).
  4. Install cloud-build-badge via npm:
$ npm install cloud-build-badge

Deploy

It only takes three steps to start deploying your cloud badges! First we create the deploy script, then we call gcloud functions to send it over to GCP, then we put the resulting badge in our project's README

  1. Run cloud-build-badge and supply the following arguments:
--id            deploy function unique ID
--repository    target repository name
--branches      target branches, e.g. master, development
--bucket        name of bucket, e.g. ${BUCKET}

For example,

cloud-build-badge \
    --id myFunction \
    --repository my-repository \
    --branches master development \ # You can supply multiple values
    --bucket my-project-bucket

This will generate a JS file (default is function.js) that contains the deploy function that we'll need.

  1. Copy the resulting command to deploy via gcloud functions. As reference, here's what it looks like:
gcloud functions deploy <ID> \
    --runtime nodejs6 \
    --trigger-resource cloud-builds \
    --trigger-event google.pubsub.topic.publish
  1. You'll find the resulting badge saved inside your project's GCS bucket! You can then use it for your README's badge! This badge, through Cloud Functions, will change depending on the status of your latest build.
[![cloud build status](https://storage.googleapis.com/<BUCKET>/build/<REPOSITORY>-<BADGE>.svg)](https://github.com/ljvmiranda921/cloud-build-badge)