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

@trussle/ci

v1.0.3

Published

Continuous Integration scripts

Downloads

36

Readme

Trussle CI

This package provides a suite of scripts used by Trussle's Continuous Integration system to build Docker images for testing and deployment.

Usage

Installation

Install this package as a devDependency:

npm install --save-dev @trussle/ci

Dockerfile

Next, set up your Dockerfile with the following constraints:

  • There should be a builder stage, which creates an image ready to build and test in the /builder directory. The ENTRYPOINT should run all unit tests (with coverage) and provide results in JUnit format to the directory /builder/test-results.
  • The final stage of the Dockerfile should create a runner image continaing only the files required to run the application. The ENTRYPOINT should run the application.
  • The host machine's NPM token will be injected into the image as the argument NPM_TOKEN, so you'll likely need the following lines at the top of your Dockerfile:
# Embed the NPM_TOKEN (passed in from the host machine) into the image.
ARG NPM_TOKEN
RUN echo -n ${NPM_TOKEN} > /root/.npmrc

Samples of Dockerfiles can be found in the templates.

Docker Compose

If you have integration tests (tests that require an external dependency to be running), you should include a Docker Compose file that looks like this:

version: "2.1"

services:
  integration:
    image: "878732450721.dkr.ecr.eu-west-1.amazonaws.com/[package-name]-builder:latest"
    # depends_on:
    #   - service1
    #   - service2
    entrypoint: npm run test:integration
    environment:
      - NODE_ENV=CI
  # Your other services go here!

Running

You can now run:

  • npx t-ci builder to make the build/test image.
  • npx t-ci test-unit runs unit tests in the builder.
  • npx t-ci test-integration sets up the Docker Compose environment and runs the integration tests.
  • npx t-ci runner to make the runner image.

These commands can be used to make your Jenkinsfile super short:

pipeline {
  agent any
  stages {
    stage("Setup") { steps { sh "npx t-ci builder" } }
    stage("Tests") {
      parallel {
        stage("Unit Tests") { steps { sh "npx t-ci test-unit" } }
        stage("Integration Tests") { steps { sh "npx t-ci test-integration" } }
      }
    }
    stage("Build") { steps { sh "npx t-ci runner" } }
  }
  post {
    always {
      junit "test-results/**/*.xml"
      sh "aws s3 sync test-results/ s3://qa-junit-test-reports/${env.JOB_NAME}/${env.BUILD_NUMBER}/test-results"
      cleanWs(
        cleanWhenAborted: true,
        cleanWhenFailure: true,
        cleanWhenNotBuilt: true,
        cleanWhenSuccess: true,
        cleanWhenUnstable: true,
        cleanupMatrixParent: true,
        deleteDirs: true
      )
    }
  }
}