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

codebuilder

v1.0.0

Published

An AWS CodeBuild project optimized for multiple source repos & any combination of buildspec based scripts from config values

Downloads

3

Readme

codebuilder

An AWS CodeBuild project optimized for multiple source repos & any combination of buildspec based scripts from config values. This is achieved by pointing a single CodeBuild project to this projects CI tooling and moving buildspec.yml build phases to environment variables.

Inspiration:

  • I wanted to be able to execute longer running scripts (lambda limits </3)
  • I wanted to avoid having AWS credentials on third party services
  • I also wanted something like deploybot.com, or a chatbot for running one off scripts like publishing npm packages
  • I want a cheaper alternative to paid versions of circle/travis ci, and code pipeline didn't work out for me

AWS Services Overview

  • CodeBuild - we'll utilize this service for it's per-minute based pricing <3
  • S3 - A single bucket to host the CI tooling scripts that we'll point the CodeBuild project
  • Lambda - A single lambda to handle the Step Function State transitions
  • Step Function State Machine - Creates a CodeBuild execution, waits for completion, logs completion status

state-machine-preview

Getting started

Provision AWS resources with Terraform

Read through terraform/main.tf and update variable names for your environment and remote state s3 bucket.

Create the s3 bucket for terraform remote state:

BUCKET=codebuilder-tf npm run tf:create:remote

Initialize the terraform state

npm run tf:init

Run terraform plan to see what resources will be provisioned

npm run tf:plan

If that looks right, run terraform apply to creae the resources in AWS

npm run tf:apply

Upload CI tooling to S3

Replace bucket name with the bucket created via terraform.

BUCKET=codebuilder-tools npm run upload-tools

Deploy Lambda

Replace the placeholder lambda function code that terraform uploaded by deploying the new code with claudia.js.

npm run claudia:update

Run an example codebuilder step function

This example will clone, test, build, and deploy a static react site to s3.

First create a bucket and configure it for static site hosting. (For convenience I've added those scripts to this project)

BUCKET=sample-create-react-app npm run s3:create-bucket
BUCKET=sample-create-react-app npm run s3:configure-bucket

Start your first codebuilder state function by running:

npm run codebuilder

codebuilder config

The following config variables determine which project and branch to build

CI_REPO
# example: CI_REPO=eddywashere/sample-create-react-app

CI_COMMIT
# example: CI_COMMIT=feature-branch
# example: CI_COMMIT=c420de0

The following config variables are available to dynamically set your scripts in the CodeBuild execution.

CI_SCRIPT_INSTALL
# example: CI_SCRIPT_INSTALL="npm install yarn -g && yarn install --silent"

CI_SCRIPT_PRE_BUILD
# example: CI_SCRIPT_PRE_BUILD="npm run test"

CI_SCRIPT_BUILD
# example: CI_SCRIPT_BUILD="npm run build"

CI_SCRIPT_POST_BUILD
# example: CI_SCRIPT_POST_BUILD="npm run s3:upload"

Working with Secrets

Each project that you'd like to run scripts against should use parameter store to get encrypted secrets.

Ideas

  • Looking into setting up an SNS topic and or github pr status integration