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

happy

v1.0.1

Published

Happy simplifies your day-to-day git workflow

Downloads

201

Readme

Happy

Happy simplifies your day-to-day git workflow:

$ happy
$ happy "Move the dates to ISO 8601"
$ happy "Quick hot fix" --now

happy analyzes your project to find the appropriate npm scripts to run and then commits and deploys those changes with git.

Getting started

First install it globally:

npm install happy -g

Then you can run it in your console, either with just happy or with happy "Message". Run happy --help anytime:

$ happy --help

  Happy simplifies your day-to-day git workflow.

  Usage
    $ happy
    $ happy "Message here" --now
    $ happy "Message here" --publish patch

  Options
    --now                Skip build, lint and tests to deploy the changes *now*
    --publish VERSION    Publish your package to NPM with "np VERSION --yolo"
    --patch              Alias for --publish patch
    --minor              Alias for --publish minor
    --major              Alias for --publish major

  Examples
    $ happy
    ✔ Building project
    ↓ Linting
    ✔ Testing project
    ✔ Saving changes
    ✔ Downloading latest
    ✔ Uploading changes

    $ happy "Move the dates to ISO 8601"
    ✔ Building project
    ↓ Linting
    ✔ Testing project
    ✔ Saving changes
    ↓ Downloading latest
    ✔ Uploading changes

    $ happy --now
    ✔ Saving changes
    ↓ Downloading latest
    ✔ Uploading changes

What it does

It makes sure your project is ready to deploy, and then deploy it. For this, these are the steps:

Building project

Run the npm run build script if this script is found in your package.json configuration. Example:

{
  "scripts": {
    "build": "rollup -c"
  }
}

This step will be skipped if:

  • The script "build" is not found in the project package.json.
  • The flag --now was passed.

Linting

Run the npm run lint script if this script is found in your package.json configuration. Example:

{
  "scripts": {
    "lint": "eslint"
  }
}

This step will be skipped if:

  • The script "lint" is not found in the project package.json.
  • The flag --now was passed.

Testing project

Run the npm test script if this script is found in your package.json configuration. Example:

{
  "scripts": {
    "test": "jest"
  }
}

The test script will also set the environment variable CI=true to avoid some common issues.

This step will be skipped if:

  • The script "test" is not found in the project package.json.
  • The flag --now was passed.

Saving Changes

This is the equivalent of adding and commiting the changed files to Git. The message for the commit is the string that you pass:

happy "Added that new cool feature"

When no string is provided, it will save the changes with a generic commit with the current timestamp like:

Saved on 2020-08-13T10:20:00Z

This step will be skipped if:

  • There are no changes to add or commit.
  • The changes were already commited.

Downloading latest

Try to pull the latest changes from the remote repo to combine them locally. It will exit if there's a problem with the merge so that you can merge it manually.

This step might take longer than the others since it talks to your git server.

This step will be skipped if:

  • There were no changes in the remote repo (you are up to date).

This step will throw an error if:

  • The origin is not set.

TODO: ask/fix the origin if it's not set

Uploading changes

Take all of your changes and upload them to the origin that is set in your project. This is specially useful when combined with e.g. Heroku, and you set heroku as the origin, since it will also deploy the full website.

This step takes longer than the others since it's talking to your git server.

This step will be skipped if:

  • There were no changes in the local repo.

Publish to npm

You need to have the library np installed for this, please do npm i np -g

Add a --publish VERSION flag to publish the current package to npm with np:

happy --publish patch
happy --publish minor
happy --publish major

happy --publish 5.0.0

As an alias, you can do with just --patch, --minor or --major instead:

happy --patch
happy --minor
happy --major

happy --publish 5.0.0