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

@kotosha/autodiffgist

v0.1.3

Published

Create gists of staged changes from console with just one command πŸš€

Downloads

3

Readme

Autodiffgist

Create gists of staged changes from console with just one command πŸš€

Motivation

I write articles on the Medium.

I found out that it's quite tedious to make a gist for each change in the code by hand and that it's very inconvenient to paste the files as is (just compare these two articles (1 and 2) in terms of ease of understanding code changes from step to step).

So I wrote this little package to do all the hard work for me. It creates gists with one or more files depending on the current state of the git stage:

  • First, add all files in the current working directory to the stage with git add .
  • Then use git diff and tail to create nicely formatted diff files for each modified file in the stage
  • Finally, create a gist with all non-empty added and modified files with gh create gist

How to use it

Setup

First, make sure that you have Github CLI installed and that you are logged in. Follow this manual if it's not the case.

After that, install Autodiffgist globally:

npm i @kotosha/autodiffgist -g

Usage

Simply use autodiffgist command in any folder containing git repo:

autodiffgist

If you get an error command not found: autodiffgist it means npm could not find global packages. In this case, use npx instead:

npx autodiffgist

Options

Autodiffgist respects all options from gh gist create command except for -f.

Also, you can add -v (--verbose) option to prevent suppressing basic logs. Without it, you'll only get chalk-colored Autodiffgist logs.

Other options are not allowed and will result in a parse error.

Warnings and errors

  • WARN Empty files can not be added to gist: {name} β€” there is empty staged file that will not be added to gist
  • WARN There are no files to create gist with β€” pretty self-explanatory. There are no non-empty staged files with statuses Added (A) or Modified (M)
  • ERR Could not parse arguments β€” Autodiffgist could not parse arguments, please check Options section
  • ERR There are no GitHub CLI installed or you are not logged in. Please, follow this manual before using Autodiffgist: https://cli.github.com/manual/ β€” make sure you followed Setup section
  • ERR Can not read diff status file {path}: {err} β€” Autodiffgist pipes output of the git diff command to the temporary file. If you encounter this error, this was not performed correctly, therefore considered a bug. Please file an issue
  • ERR Can not read added file {path}: {err} β€” Autodiffgist could not read the stage file with Added status to determine whether it's empty. It should be considered a bug. Please file an issue
  • ERR Could not create gist: {stderr} β€” command gh gist create returned non-zero exit code. stderr log might be helpful to understand what is going on since this is not the problem related to Autodiffgist

Contribution

It's highly unlikely that I will develop this package further due to the motivation behind its development. If it suits your needs and you want to implement some features, please fork it and develop it on your own or send pull requests 🀝🏻