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

@tandil/diffsplit

v0.1.8

Published

Easy split of .diff & .patch into its files

Downloads

14

Readme

@tandil/diffsplit

NPM Package Version License Conventional Commits

Easy split of .diff & .patch into its files

What is this?

This CLI utility splits .diff or .patch files in unified format into parts by file without deleting or overwriting anything.

See a simple example

Installation

npm i -g @tandil/diffsplit

Note that this requires Node.js installed.

Usage

In your terminal

diffsplit file1.diff file2.diff [... more files]

Example

Suppose you have a diff file mypatch.diff you created from a git diff and it includes modifications for 3 files:

diff --git a/es6.txt b/es6.txt
index ca683c3..f1a9a31 100644
--- a/es6.txt
+++ b/es6.txt
@@ -1,4 +1,6 @@
-ECMAScript is a scripting-language specification standardized by Ecma International.
-It was created to standardize JavaScript to help foster multiple independent implementations.
-
+ECMAScript
+----------
 
+It is a scripting-language specification standardized by Ecma International.
+It was created to standardize JavaScript to help foster multiple independent implementations.
+It was initially created for web browsers.
diff --git a/life.txt b/life.txt
index 39257de..6410213 100644
--- a/life.txt
+++ b/life.txt
@@ -1,7 +1,10 @@
-Life / From Wikipedia, the free encyclopedia
+Life
+----
 
 Life is a characteristic that distinguishes physical entities that have biological processes,
 such as signaling and self-sustaining processes, from those that do not, either because such
 functions have ceased (they have died), or because they never had such functions and are
 classified as inanimate. Various forms of life exist, such as plants, animals, fungi, protists,
 archaea, and bacteria. Biology is the science concerned with the study of life.
+
+Source: From Wikipedia, the free encyclopedia
diff --git a/lorem.txt b/lorem.txt
index 83449d4..733ae45 100644
--- a/lorem.txt
+++ b/lorem.txt
@@ -1,10 +1,13 @@
 Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+
 Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
 when an unknown printer took a galley of type and scrambled it to make a type
 specimen book.
 
 It has survived not only five centuries, but also the leap into electronic
-typesetting, remaining essentially unchanged. It was popularised in the 1960s
+typesetting, remaining essentially unchanged.
+
+It was popularised in the 1960s
 with the release of Letraset sheets containing Lorem Ipsum passages, and more
 recently with desktop publishing software like Aldus PageMaker including
 versions of Lorem Ipsum.

Just running

diffsplit mypatch.diff

You will get the output:

Processing file: "mypatch.patch"
 OK:
  Split in 3 files

and 3 files will be created with the individual diffs for each of the files in your patch:

mypatch_0001.patch
mypatch_0002.patch
mypatch_0003.patch

Don't worry, this command will not overwrite existing files. If you had already a file with one of those names, a suffix will be added. Lets say you had already a file named mypatch_0003.diff, the created files would be:

mypatch_0001.diff
mypatch_0002.diff
mypatch_0003-1.diff

In this example, the resulting files will content:

mypatch_0001.patch

diff --git a/es6.txt b/es6.txt
index ca683c3..f1a9a31 100644
--- a/es6.txt
+++ b/es6.txt
@@ -1,4 +1,6 @@
-ECMAScript is a scripting-language specification standardized by Ecma International.
-It was created to standardize JavaScript to help foster multiple independent implementations.
-
+ECMAScript
+----------
 
+It is a scripting-language specification standardized by Ecma International.
+It was created to standardize JavaScript to help foster multiple independent implementations.
+It was initially created for web browsers.

mypatch_0002.patch

diff --git a/life.txt b/life.txt
index 39257de..6410213 100644
--- a/life.txt
+++ b/life.txt
@@ -1,7 +1,10 @@
-Life / From Wikipedia, the free encyclopedia
+Life
+----
 
 Life is a characteristic that distinguishes physical entities that have biological processes,
 such as signaling and self-sustaining processes, from those that do not, either because such
 functions have ceased (they have died), or because they never had such functions and are
 classified as inanimate. Various forms of life exist, such as plants, animals, fungi, protists,
 archaea, and bacteria. Biology is the science concerned with the study of life.
+
+Source: From Wikipedia, the free encyclopedia

mypatch_0003.patch

diff --git a/lorem.txt b/lorem.txt
index 83449d4..733ae45 100644
--- a/lorem.txt
+++ b/lorem.txt
@@ -1,10 +1,13 @@
 Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+
 Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
 when an unknown printer took a galley of type and scrambled it to make a type
 specimen book.
 
 It has survived not only five centuries, but also the leap into electronic
-typesetting, remaining essentially unchanged. It was popularised in the 1960s
+typesetting, remaining essentially unchanged.
+
+It was popularised in the 1960s
 with the release of Letraset sheets containing Lorem Ipsum passages, and more
 recently with desktop publishing software like Aldus PageMaker including
 versions of Lorem Ipsum.

Having issues?

Feel free to report any issues or feature request in Github repo.