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

ship-es

v0.2.3

Published

> Quickly bundle, containerize and deploy JavaScript and TypeScript server-side projects

Downloads

2

Readme

ship-es

Quickly bundle, containerize and deploy JavaScript and TypeScript server-side projects

ship-es enables you to quickly build your node.js code and deploy it as a tiny docker image, all with a single command and no required configuration. Great for anything from Webservers to Chatbots.

setup

ship-es works without any configuration by default.

# create new node.js project
$ pnpm init && pnpm i -D ship-es

# write code
$ echo "console.log('hello world')" > index.ts

# run your project locally
$ pnpx ship-es dev ./index.ts

# push your code to a container registry (in this case docker.io)
$ pnpx ship-es ship ./index.ts explodingcamera/myproject

using pnpm is reccommended. You can substiture this for your package manager of choice, e.g npm or yarn

Below, we've provided a simple GitHub Workflow file to automatically build new commits pushed to your main branch and push them as a container to GitHub's Container Registry.

CI/CD

Ship-es doesn't depend on any platform specific code. Just either docker, podman or nerdctl needs to be installed.

GitHub Actions

.github/workflows/deploy.yml

name: Deploy

# We want this to run on all commits to `main`
on:
  push:
    branches:
      - main

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      # Install node.js
      - uses: actions/setup-node@v2
        with:
          node-version: "17"

      # Install pnpm, our recommended package manager (will increase speed by a lot)
      - uses: pnpm/[email protected]
        with:
          version: 6.0.2

      # Authenticate with container registry
      - uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      # Build & push container image
      - name: Deploy
        run: |
          pnpm install
          pnpx ship-es ./index.ts ghcr.io/username/project --push

configuration

To customize your deployment there are variety of options:

  • --push Push the image to your container registry after building it

  • versioning
    When using these flags, ship-es will by default use the version number you provide in the package.json file located in your current working directory.

    • --tag: Override Tag, can be used multiple times
    • --release Tag with stable, x.x.x, x.x and x (based on your package.json)
    • --verison: Override version used by release
  • bundling

    • --external: By default, ship-es bundles all of your packages into a single file to minimize their filesize and impove compatibility and start-up-performance. This might lead to issues with packages that access external files or depend on native code. To use these, add them using the --external flag (can be specfied multiple times and supports glob patterns). Only packages marked as external will be included in your generated image!
    • --static: To include specific folders in the final build (like a public/ folder with static assets), add these using --static ./public.

api

ship-es was build to also be used programatically by other projects as a base. Documentation on this will follow soon.

Related Projects

Tools used by ship-es

ship-es is not build to be a catch-all solution for complex deployment pipelines, rather it is a simple starting point and alternative to the huge amount of boilerplate code required to deploy a simple project. Below are the libraries ship-es uses internally that you could also use to build more complex setups:

  • kaniko - A userspace Dockerfile build-tool
  • esbuild - A JavaScript/Typescipt bundler/minifier written in Go