้•œๅƒ็ซ™็‚น ยท ๆœฌ้กต็”ฑ็ฌฌไธ‰ๆ–น GitHub ๅช่ฏป้•œๅƒๆไพ›๏ผŒ้ž GitHub ๅฎ˜ๆ–น็ซ™็‚น๏ผŒไธๆŽฅๅ—ไปปไฝ•็™ปๅฝ•ๆˆ–ๅ‡ญๆฎ่พ“ๅ…ฅใ€‚ๅ‰ๅพ€ github.com
Skip to content

About

CLI to copy out differences between two folders ๐Ÿ“ 

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

151 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Build Diff

npm version

A small CLI utility to compare two "build" folders, and copy out the differences between them.

Requirements

Both of these come standard with macOS and probably most linux/unix flavors.

Install

$ npm install -g @romellem/build-diff
# or
$ yarn global add @romellem/build-diff

Usage

$ build-diff [options] <old-build-directory> <new-build-directory>

Options

  -q, --quiet          Hides progress as it compares the directories. Defaults to false.
  -j, --json           Outputs results as JSON. Defaults to false.
  -o, --output <name>  Name of the output folder and ZIP file. Defaults to "build_for_upload".

Examples

Standard Example

Given two folders old/ and new/, whose contents are shown below:

old/
โ”œโ”€โ”€ deleted.txt
โ”œโ”€โ”€ unchanged.txt
โ””โ”€โ”€ updated.txt

new/
โ”œโ”€โ”€ new.txt
โ”œโ”€โ”€ sub/
โ”‚ย ย  โ””โ”€โ”€ file.txt
โ”œโ”€โ”€ unchanged.txt
โ””โ”€โ”€ updated.txt

Diffing the two folders yields:

$ build-diff old new
Comparing "old" against "new"...
Diffing directories... Done
Parsing diff results... Done
Copying over changed files... Done
Zipping changed files... Done

The following files were deleted:
  deleted.txt


The following files were changed:
  new.txt
  sub
  updated.txt

All changed files have been copied to build_for_upload, and zipped in build_for_upload.zip

--quiet and --json Flags

When using the --quiet and --json flag, I can pipe the output to jq and view the results as a formatted JSON string.

$ build-diff --quiet --json old new | jq
{
  "filesDeleted": [
    "deleted.txt"
  ],
  "filesChanged": [
    "new.txt",
    "sub",
    "updated.txt"
  ],
  "outputDir": "build_for_upload",
  "outputZip": "build_for_upload.zip"
}

--output Flag

To specificy a different output directory and zip name, simply set the --output argument.

$ build-diff --output=my_folder old new

...

All changed files have been copied to my_folder, and zipped in my_folder.zip

License

MIT

About

CLI to copy out differences between two folders ๐Ÿ“ 

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages