diff2html-cli
Advanced tools
Comparing version 1.4.6-rc.3 to 1.5.0-master.398363a
{ | ||
"name": "diff2html-cli", | ||
"version": "1.4.6-rc.3", | ||
"homepage": "https://www.github.com/rtfpessoa/diff2html-cli", | ||
"version": "1.5.0-master.398363a", | ||
"homepage": "https://diff2html.xyz/index.html#cli", | ||
"description": "Fast Diff to colorized HTML", | ||
@@ -35,12 +35,26 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=0.12.0" | ||
"node": ">=10.13" | ||
}, | ||
"preferGlobal": true, | ||
"scripts": { | ||
"style": "eslint src/*.js", | ||
"coverage": "istanbul cover _mocha -- -u exports -R spec ./test/**/*", | ||
"test": "npm run style && npm run coverage", | ||
"codacy": "npm run coverage && cat ./coverage/lcov.info | codacy-coverage", | ||
"preversion": "npm test", | ||
"postversion": "git push && git push --tags" | ||
"eslint": "eslint --ignore-path .gitignore \"**/*.{js,jsx,ts,tsx,json}\"", | ||
"lint:check": "yarn run eslint", | ||
"lint:fix": "yarn run eslint --fix", | ||
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|jsx|ts|tsx|json|css|html|md|mdx)'", | ||
"format:check": "yarn run prettier --check", | ||
"format:fix": "yarn run prettier --write", | ||
"build": "yarn run build:es5", | ||
"build:es5": "rm -rf lib; tsc -p tsconfig.json --outDir lib", | ||
"build:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i", | ||
"build:toc": "yarn run build:toc-base README.md", | ||
"test": "is-ci 'test:coverage' 'test:watch'", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "jest --watch", | ||
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch", | ||
"coverage:open": "yarn run test:coverage && open ./coverage/index.html", | ||
"coverage:push": "cat ./coverage/lcov.info | codacy-coverage", | ||
"validate": "yarn run format:check && yarn run lint:check && yarn run build && yarn run test:coverage", | ||
"fix": "yarn run format:fix && yarn run lint:fix", | ||
"preversion": "yarn run validate", | ||
"version": "git add -A package.json" | ||
}, | ||
@@ -50,19 +64,36 @@ "bin": { | ||
}, | ||
"main": "./src/main.js", | ||
"main": "./lib/diff2html.js", | ||
"types": "./lib/diff2html.d.ts", | ||
"dependencies": { | ||
"copy-paste": "^1.3.0", | ||
"diff2html": "^2.0.0-rc.9", | ||
"extend": "^3.0.0", | ||
"open": "0.0.5", | ||
"request": "^2.73.0", | ||
"yargs": "^4.8.0" | ||
"clipboardy": "^2.1.0", | ||
"diff2html": "3.0.0-master.df4481f", | ||
"open": "^7.0.0", | ||
"request": "^2.88.0", | ||
"yargs": "^15.0.2" | ||
}, | ||
"devDependencies": { | ||
"codacy-coverage": "^1.1.3", | ||
"eslint": "^3.0.1", | ||
"eslint-plugin-promise": "^1.3.2", | ||
"eslint-plugin-standard": "^1.3.2", | ||
"istanbul": "^0.4.4", | ||
"jscs": "^3.0.6", | ||
"mocha": "^2.5.3" | ||
"@types/hogan.js": "^3.0.0", | ||
"@types/jest": "24.9.0", | ||
"@types/node": "13.1.8", | ||
"@types/request": "2.48.4", | ||
"@typescript-eslint/eslint-plugin": "2.16.0", | ||
"@typescript-eslint/parser": "2.16.0", | ||
"codacy-coverage": "3.4.0", | ||
"eslint": "6.8.0", | ||
"eslint-config-prettier": "6.9.0", | ||
"eslint-plugin-import": "2.20.0", | ||
"eslint-plugin-jest": "23.6.0", | ||
"eslint-plugin-json": "2.0.1", | ||
"eslint-plugin-node": "11.0.0", | ||
"eslint-plugin-optimize-regex": "1.1.7", | ||
"eslint-plugin-promise": "4.2.1", | ||
"eslint-plugin-sonarjs": "0.5.0", | ||
"husky": "4.0.10", | ||
"is-ci-cli": "2.0.0", | ||
"jest": "24.9.0", | ||
"lint-staged": "9.5.0", | ||
"markdown-toc": "^1.2.0", | ||
"prettier": "1.19.1", | ||
"ts-jest": "24.3.0", | ||
"typescript": "3.7.5" | ||
}, | ||
@@ -72,5 +103,5 @@ "license": "MIT", | ||
"bin", | ||
"src", | ||
"dist" | ||
"lib", | ||
"template.html" | ||
] | ||
} |
180
README.md
# diff2html-cli | ||
[![Codacy Code Badge](https://api.codacy.com/project/badge/grade/e6139937d72f40ed8b3920d53c74298a)](https://www.codacy.com/app/Codacy/diff2html-cli) | ||
[![Codacy Coverage Badge](https://api.codacy.com/project/badge/coverage/e6139937d72f40ed8b3920d53c74298a)](https://www.codacy.com/app/Codacy/diff2html-cli) | ||
[![Codacy Quality Badge](https://api.codacy.com/project/badge/Grade/e6139937d72f40ed8b3920d53c74298a)](https://www.codacy.com/app/rtfpessoa/diff2html-cli?utm_source=github.com&utm_medium=referral&utm_content=rtfpessoa/diff2html-cli&utm_campaign=Badge_Grade) | ||
[![Codacy Coverage Badge](https://api.codacy.com/project/badge/Coverage/e6139937d72f40ed8b3920d53c74298a)](https://www.codacy.com/app/rtfpessoa/diff2html-cli?utm_source=github.com&utm_medium=referral&utm_content=rtfpessoa/diff2html-cli&utm_campaign=Badge_Coverage) | ||
[![Circle CI](https://circleci.com/gh/rtfpessoa/diff2html-cli.svg?style=svg)](https://circleci.com/gh/rtfpessoa/diff2html-cli) | ||
[![Dependency Status](https://dependencyci.com/github/rtfpessoa/diff2html/badge)](https://dependencyci.com/github/rtfpessoa/diff2html) | ||
@@ -12,39 +11,53 @@ [![npm](https://img.shields.io/npm/v/diff2html-cli.svg)](https://www.npmjs.com/package/diff2html-cli) | ||
[![node](https://img.shields.io/node/v/diff2html-cli.svg)]() | ||
[![npm](https://img.shields.io/npm/l/diff2html-cli.svg)]() | ||
[![node](https://img.shields.io/node/v/diff2html-cli.svg)]() [![npm](https://img.shields.io/npm/l/diff2html-cli.svg)]() | ||
[![npm](https://img.shields.io/npm/dm/diff2html-cli.svg)](https://www.npmjs.com/package/diff2html-cli) | ||
[![Gitter](https://badges.gitter.im/rtfpessoa/diff2html.svg)](https://gitter.im/rtfpessoa/diff2html?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | ||
Diff to Html generates pretty HTML diffs from git diff output in your terminal | ||
Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal | ||
## Features | ||
## Table of Contents | ||
* `line-by-line` and `side-by-side` diff | ||
<!-- toc --> | ||
* new and old line numbers | ||
- [Features](#features) | ||
- [Online Example](#online-example) | ||
- [Distributions](#distributions) | ||
- [Setup](#setup) | ||
- [Usage](#usage) | ||
- [Custom HTML wrapper template](#custom-html-wrapper-template) | ||
- [Examples:](#examples) | ||
- [Contributions](#contributions) | ||
- [Developing](#developing) | ||
- [License](#license) | ||
- [Thanks](#thanks) | ||
* inserted and removed lines | ||
<!-- tocstop --> | ||
* GitHub like style | ||
## Features | ||
* Code syntax highlight | ||
- Unified diff and Git diff input | ||
* Line similarity matching | ||
- `line-by-line` and `side-by-side` diff | ||
## Online Example | ||
- new and old line numbers | ||
> Go to [Diff2HTML](http://rtfpessoa.github.io/diff2html/) | ||
- inserted and removed lines | ||
## Distributions | ||
- GitHub like style | ||
* [WebJar](http://www.webjars.org/) | ||
- Code syntax highlight | ||
* [Node Module](https://www.npmjs.org/package/diff2html) | ||
- Line similarity matching | ||
* [Bower Package](http://bower.io/search/?q=diff2html) | ||
## Online Example | ||
* [Node CLI](https://www.npmjs.org/package/diff2html-cli) | ||
> Go to [Diff2HTML](https://diff2html.xyz/) | ||
* Manually download and import `rtfpessoa/diff2html/dist/diff2html.min.js` into your page | ||
## Distributions | ||
- [NPM CLI](https://www.npmjs.org/package/diff2html-cli) | ||
- [NPM / Node.js library [ES5 & ES6]](https://github.com/rtfpessoa/diff2html) | ||
- [CDNJS](https://cdnjs.com/libraries/diff2html) | ||
- [WebJar](http://www.webjars.org/) | ||
## Setup | ||
@@ -56,49 +69,108 @@ | ||
Usage: diff2html [options] -- [diff args] | ||
Usage: diff2html [options] -- [diff args] | ||
Options: | ||
-s, --style Output style [string] [choices: "line", "side"] [default: "line"] | ||
--su, --summary Show files summary [string] [choices: "closed", "open", "hidden"] [default: "closed"] | ||
--lm, --matching Diff line matching type [string] [choices: "lines", "words", "none"] [default: "none"] | ||
--lmt, --matchWordsThreshold Diff line matching word threshold [string] [default: "0.25"] | ||
--lmm, --matchingMaxComparisons Diff line matching maximum line comparisons of a block of changes [default: 2500] | ||
-f, --format Output format [string] [choices: "html", "json"] [default: "html"] | ||
-d, --diff Diff style [string] [choices: "word", "char"] [default: "word"] | ||
-i, --input Diff input source [string] [choices: "file", "command", "stdin"] [default: "command"] | ||
-o, --output Output destination [string] [choices: "preview", "stdout"] [default: "preview"] | ||
-u, --diffy Upload to diffy.org [string] [choices: "browser", "pbcopy", "print"] | ||
-F, --file Send output to file (overrides output option) [string] | ||
--version Show version number [boolean] | ||
-h, --help Show help [boolean] | ||
| flag | alias | description | choices | default | | ||
| ----- | ------------------------ | -------------------------------------------------------------------------- | ---------------------------- | --------- | | ||
| -s | --style | Output style | `line`, `side` | `line` | | ||
| --sc | --synchronisedScroll | Synchronised horizontal scroll | `true`, `false` | `true` | | ||
| --hc | --highlightCode | Highlight code | `true`, `false` | `true` | | ||
| --su | --summary | Show files summary | `closed`, `open`, `hidden` | `closed` | | ||
| --d | --diffStyle | Diff style | `word`, `char` | `word` | | ||
| --lm | --matching | Diff line matching type | `lines`, `words`, `none` | `none` | | ||
| --lmt | --matchWordsThreshold | Diff line matching word threshold | | `0.25` | | ||
| --lmm | --matchingMaxComparisons | Diff line matching maximum line comparisons of a block of changes | `2500` | | ||
| --hwt | --htmlWrapperTemplate | Path to custom template to be rendered when using the `html` output format | _[string]_ | | ||
| -f | --format | Output format | `html`, `json` | `html` | | ||
| -i | --input | Diff input source | `file`, `command`, `stdin` | `command` | | ||
| -o | --output | Output destination | `preview`, `stdout` | `preview` | | ||
| -u | --diffy | Upload to diffy.org | `browser`, `pbcopy`, `print` | | | ||
| -F | --file | Send output to file (overrides output option) | _[string]_ | | | ||
| --ig | --ignore | Ignore particular files from the diff | _[string]_ | | | ||
| -v | --version | Show version number | | | | ||
| -h | --help | Show help | | | | ||
Examples: | ||
diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1 | ||
-> diff last commit, line by line, word comparison between lines,previewed | ||
in the browser and input from git diff command | ||
diff2html -i file -- my-file-diff.diff | ||
-> reading the input from a file | ||
diff2html -f json -o stdout -- -M HEAD~1 | ||
-> print json format to stdout | ||
diff2html -F my-pretty-diff.html -- -M HEAD~1 | ||
-> print to file | ||
### Custom HTML wrapper template | ||
© 2014 rtfpessoa | ||
For support, check out https://github.com/rtfpessoa/diff2html-cli | ||
The template is a very based on a simple replace of several placeholders as coded | ||
https://github.com/rtfpessoa/diff2html-cli/blob/master/src/cli.ts#L40 | ||
> NOTE: notice the `--` in the examples | ||
To provide a custom template you need to make sure you have the following comments and imports in your HTML, exactly as | ||
they are here: | ||
- Inside the `<head>` tag | ||
``` | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css" /> | ||
<!--diff2html-css--> | ||
<!--diff2html-js-ui--> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const targetElement = document.getElementById("diff"); | ||
const diff2htmlUi = new Diff2HtmlUI(targetElement); | ||
//diff2html-fileListToggle | ||
//diff2html-synchronisedScroll | ||
//diff2html-highlightCode | ||
}); | ||
</script> | ||
``` | ||
- Inside the `<body>` tag | ||
``` | ||
<div id="diff"> | ||
<!--diff2html-diff--> | ||
</div> | ||
``` | ||
### Examples: | ||
`diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1` | ||
- diff last commit, line by line, word comparison between lines, previewed in the browser and input from git diff | ||
command | ||
`diff2html -i file -- my-file-diff.diff` | ||
- reading the input from a file | ||
`diff -u file1.txt file2.txt | diff2html -i stdin` | ||
- reading diff from stdin | ||
`diff2html -f json -o stdout -- -M HEAD~1` | ||
- print json format to stdout | ||
`diff2html -F my-pretty-diff.html -- -M HEAD~1` | ||
- print to file | ||
`diff2html -F my-pretty-diff.html --hwt my-custom-template.html -- -M HEAD~1` | ||
- print to file using custom markup templates can include the following variables | ||
`diff2html --ig package-lock.json --ig yarn.lock` | ||
- Ignore `package-lock.json` and `yarn.lock` from the generated diff | ||
_NOTE_: notice the `--` in the examples | ||
## Contributions | ||
This is a developer friendly project, all the contributions are welcome. | ||
To contribute just send a pull request with your changes following the guidelines described in `CONTRIBUTING.md`. | ||
I will try to review them as soon as possible. | ||
This is a developer friendly project, all the contributions are welcome. To contribute just send a pull request with | ||
your changes following the guidelines described in `CONTRIBUTING.md`. I will try to review them as soon as possible. | ||
## Developing | ||
Make some changes, `yarn build` and then `./bin/diff2html` 😉 | ||
## License | ||
Copyright 2014 Rodrigo Fernandes. Released under the terms of the MIT license. | ||
Copyright 2014-2019 Rodrigo Fernandes. Released under the terms of the MIT license. | ||
## Thanks | ||
This project is inspired in [pretty-diff](https://github.com/scottgonzalez/pretty-diff) by [Scott González](https://github.com/scottgonzalez). | ||
This project is inspired in [pretty-diff](https://github.com/scottgonzalez/pretty-diff) by | ||
[Scott González](https://github.com/scottgonzalez). | ||
--- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
57692
5
37
661
175
24
2
2
+ Addedclipboardy@^2.1.0
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedarch@2.2.0(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedclipboardy@2.3.0(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcross-spawn@6.0.6(transitive)
+ Addeddiff2html@3.0.0-master.df4481f(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedexeca@1.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedget-stream@4.1.0(transitive)
+ Addedhandlebars@4.7.8(transitive)
+ Addedhighlight.js@9.17.1(transitive)
+ Addedis-docker@2.2.1(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedis-wsl@2.2.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedopen@7.4.2(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addeduglify-js@3.19.3(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwordwrap@1.0.0(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
- Removedcopy-paste@^1.3.0
- Removedextend@^3.0.0
- Removedansi-regex@2.1.1(transitive)
- Removedcamelcase@3.0.0(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcopy-paste@1.5.3(transitive)
- Removeddiff2html@2.12.2(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-caller-file@1.0.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinvert-kv@1.0.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedlcid@1.0.0(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedlodash.assign@4.2.0(transitive)
- Removedmerge@1.2.1(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedopen@0.0.5(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedrequire-main-filename@1.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
- Removedwhich-module@1.0.0(transitive)
- Removedwindow-size@0.2.0(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedy18n@3.2.2(transitive)
- Removedyargs@4.8.1(transitive)
- Removedyargs-parser@2.4.1(transitive)
Updatedopen@^7.0.0
Updatedrequest@^2.88.0
Updatedyargs@^15.0.2