Comparing version 1.2.0 to 1.3.0
@@ -0,4 +1,13 @@ | ||
## 1 April 2020 | ||
### [1.3.0](https://gitlab.com/artdeco/erte/compare/v1.2.0...v1.3.0) | ||
- [package] Move to _GitLab_. | ||
- [package] Compile package with _Depack_. | ||
- [fix] Highlight `\r\n` as full new line. | ||
- [license] Change to `AGPL-3.0`. | ||
## 29 April 2019 | ||
### [1.2.0](https://github.com/artdecocode/erte/compare/v1.1.7...v1.2.0) | ||
### [1.2.0](https://gitlab.com/artdeco/erte/compare/v1.1.7...v1.2.0) | ||
@@ -5,0 +14,0 @@ - [package] Vendor `diff` package's source module modified to remove callback and fix _GCC_ warning of unused property in self. |
{ | ||
"name": "erte", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "String difference with colour for Node.js.", | ||
"main": "build", | ||
"main": "compile/index.js", | ||
"module": "src/index.js", | ||
@@ -10,24 +10,21 @@ "scripts": { | ||
"test": "yarn t test/spec", | ||
"test-build": "ALAMODE_ENV=test-build yarn test", | ||
"b": "alamode src -o build -s", | ||
"depack": "depack depack/erte.js -o depack/erte_.js -c -a -p --externs externs.js", | ||
"doc": "doc documentary -o README.md", | ||
"d": "yarn-s d1 externs", | ||
"example": "node example", | ||
"example-c": "yarn e example/c.js", | ||
"example-b": "yarn e example/b.js", | ||
"e": "alanode", | ||
"externs": "typal externs.js -e", | ||
"d1": "typal src -c" | ||
"test-compile": "yarn test -e test-compile", | ||
"lib": "depack src/depack -o compile/erte.js -c -a -p --source_map_include_content", | ||
"depack": "depack depack/erte.js -o depack/erte_.js -c -a -p --externs types/externs.js", | ||
"doc": "doc -o README.md -d -a -n _erte", | ||
"d": "yarn-s template d1 externs", | ||
"template": "typal compile/template.js -T compile/index.js -t types", | ||
"d1": "typal compile/index.js types/index.js -u -t types", | ||
"externs": "typal types/externs.js -e", | ||
"e": "alanode" | ||
}, | ||
"files": [ | ||
"build", | ||
"compile", | ||
"src", | ||
"externs.js" | ||
"types/externs.js", | ||
"typedefs.json" | ||
], | ||
"externs": "externs.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/artdecocode/erte.git" | ||
}, | ||
"externs": "types/externs.js", | ||
"repository": "gitlab:artdeco/erte", | ||
"typedefs": "typedefs.json", | ||
"keywords": [ | ||
@@ -43,14 +40,14 @@ "erte", | ||
"author": "Anton <anton@adc.sh>", | ||
"license": "MIT", | ||
"license": "AGPL-3.0", | ||
"bugs": { | ||
"url": "https://github.com/artdecocode/erte/issues" | ||
"url": "https://gitlab.com/artdeco/erte/-/issues", | ||
"email": "incoming+artdeco-erte-17863860-issue-@incoming.gitlab.com" | ||
}, | ||
"homepage": "https://github.com/artdecocode/erte#readme", | ||
"homepage": "https://www.artd.eco", | ||
"devDependencies": { | ||
"alamode": "2.0.0", | ||
"snapshot-context": "2.2.2", | ||
"yarn-s": "^1.1.0", | ||
"zoroaster": "3.13.0" | ||
}, | ||
"dependencies": {} | ||
"alamode": "3.7.1", | ||
"documentary": "^1.38.1", | ||
"yarn-s": "^1.2.3", | ||
"zoroaster": "4.3.0" | ||
} | ||
} |
@@ -1,7 +0,13 @@ | ||
<a href="https://artdeco.bz/erte"><img align="right" src="doc/woman.jpg" width="225" alt="erte" /> | ||
<div align="center"> | ||
# erte</a> | ||
# erte | ||
[![npm version](https://badge.fury.io/js/depack.svg)](https://npmjs.org/package/depack) | ||
[![npm version](https://badge.fury.io/js/erte.svg)](https://www.npmjs.com/package/erte) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/61wjo8vbokub9afe?svg=true)](https://ci.appveyor.com/project/bulbazaur/erte) | ||
<a href="https://gitlab.com/artdeco/erte/-/commits/master"> | ||
<img src="https://gitlab.com/artdeco/erte/badges/master/pipeline.svg" alt="Pipeline Badge"> | ||
</a> | ||
</div> | ||
`erte` Colors Strings' Foreground And Background And Shows String Difference With Color. | ||
@@ -13,15 +19,21 @@ | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/0.svg?sanitize=true"></a></p> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/0.svg?sanitize=true"> | ||
</a></div> | ||
## Table Of Contents | ||
<a href="https://www.artd.eco"><img align="right" src="doc/woman.jpg" width="225" alt="erte" /></a> | ||
- [Table Of Contents](#table-of-contents) | ||
- [API](#api) | ||
* [`_erte.Color`](#type-_ertecolor) | ||
* [`Color`](#type-color) | ||
- [`erte(source: string, target: string): string`](#ertesource-stringtarget-string-string) | ||
- [`c(string: string, color: Color): string`](#cstring-stringcolor-color-string) | ||
- [`b(string: string, color: Color): string`](#bstring-stringcolor-color-string) | ||
- [Copyright](#copyright) | ||
- [Copyright & License](#copyright--license) | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/1.svg?sanitize=true"></a></p> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/1.svg?sanitize=true"> | ||
</a></div> | ||
@@ -36,9 +48,15 @@ ## API | ||
`('black'|'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'white'|'grey')` __<a name="type-_ertecolor">`_erte.Color`</a>__: The color to apply. | ||
<code>('black' \| 'red' \| 'green' \| 'yellow' \| 'blue' \| 'magenta' \| 'cyan' \| 'white' \| 'grey')</code> __<a name="type-color">`Color`</a>__: The color to apply. | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/2.svg?sanitize=true"></a></p> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/2.svg?sanitize=true"> | ||
</a></div> | ||
## `erte(`<br/> `source: string,`<br/> `target: string,`<br/>`): string` | ||
## <code><ins>erte</ins>(</code><sub><br/> `source: string,`<br/> `target: string,`<br/></sub><code>): <i>string</i></code> | ||
Compares the strings using the [`diff`](https://www.npmjs.com/package/diff) package, | ||
and outputs a coloured version where strings don't match with green or red differences. | ||
Returns a string which uses shell-codes to highlight differences. | ||
Compares the strings using the [`diff`][2] package, and colors the differences with green or red. | ||
- <kbd><strong>source*</strong></kbd> <em>`string`</em>: The string to compare. | ||
- <kbd><strong>target*</strong></kbd> <em>`string`</em>: The string to comparison against. | ||
@@ -73,11 +91,14 @@ ```js | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/3.svg?sanitize=true"></a></p> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/3.svg?sanitize=true"> | ||
</a></div> | ||
## `c(`<br/> `string: string,`<br/> `color: Color,`<br/>`): string` | ||
## <code><ins>c</ins>(</code><sub><br/> `string: string,`<br/> `color: Color,`<br/></sub><code>): <i>string</i></code> | ||
Colors the foreground using an ANSI sequence. | ||
- <kbd><strong>string*</strong></kbd> <em>`string`</em>: The string to color. | ||
- <kbd><strong>color*</strong></kbd> <em><code><a href="#type-color" title="The color to apply.">Color</a></code></em>: The color to use. | ||
```js | ||
/** yarn example-c */ | ||
import { c } from '..' | ||
import { c } from 'erte' | ||
@@ -90,10 +111,13 @@ const redText = c('RED ALERT', 'red') | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/4.svg?sanitize=true"></a></p> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/4.svg?sanitize=true"> | ||
</a></div> | ||
## `b(`<br/> `string: string,`<br/> `color: Color,`<br/>`): string` | ||
## <code><ins>b</ins>(</code><sub><br/> `string: string,`<br/> `color: Color,`<br/></sub><code>): <i>string</i></code> | ||
Colors the background with specified ANSI color. | ||
- <kbd><strong>string*</strong></kbd> <em>`string`</em>: The string to color. | ||
- <kbd><strong>color*</strong></kbd> <em><code><a href="#type-color" title="The color to apply.">Color</a></code></em>: The color to use. | ||
```js | ||
/** yarn example-b */ | ||
import { b } from 'erte' | ||
@@ -107,9 +131,11 @@ | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/5.svg?sanitize=true"></a></p> | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/5.svg?sanitize=true"> | ||
</a></div> | ||
## Copyright | ||
## Copyright & License | ||
The `diff` package author: [Kevin Decker](https://github.com/kpdecker/jsdiff). | ||
The `diff` package is released under [BSD License](COPYING) by [Kevin Decker](https://github.com/kpdecker/jsdiff). [Artwork by Erte][3]. | ||
--- | ||
GNU Affero General Public License v3.0 | ||
@@ -119,22 +145,17 @@ <table> | ||
<th> | ||
<a href="https://artd.eco"> | ||
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco" /> | ||
<a href="https://www.artd.eco"> | ||
<img width="100" src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" | ||
alt="Art Deco"> | ||
</a> | ||
</th> | ||
<th>© <a href="https://artd.eco">Art Deco</a> 2019</th> | ||
<th> | ||
<a href="https://www.technation.sucks" title="Tech Nation Visa"> | ||
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif" | ||
alt="Tech Nation Visa" /> | ||
</a> | ||
</th> | ||
<th><a href="https://www.technation.sucks">Tech Nation Visa Sucks</a></th> | ||
<th>© <a href="https://www.artd.eco">Art Deco™</a> 2020</th> | ||
<th><a href="LICENSE"><img src=".documentary/agpl-3.0.svg" alt="AGPL-3.0"></a></th> | ||
</tr> | ||
</table> | ||
[Artwork by Erte][3]. | ||
[2]: https://npmjs.org/package/diff | ||
[2]: https://www.npmjs.com/package/diff | ||
[3]: http://www.erte.com | ||
%-1% | ||
<div align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/-1.svg?sanitize=true"> | ||
</a></div> |
@@ -27,5 +27,3 @@ import Diff from './diff' | ||
/** | ||
* Color the foreground. | ||
* @param {string} string The string to color. | ||
* @param {_erte.Color} color The color to apply. | ||
* @type {_erte.c} | ||
*/ | ||
@@ -39,5 +37,3 @@ export function c(string, color) { | ||
/** | ||
* Color the background. | ||
* @param {string} string The string to color. | ||
* @param {_erte.Color} color The color to apply. | ||
* @type {_erte.b} | ||
*/ | ||
@@ -51,8 +47,5 @@ export function b(string, color) { | ||
/** | ||
* Compares two strings and outputs a coloured version where strings don't match. | ||
* @param {string} source A string to compare. | ||
* @param {string} target Target string to compare with. | ||
* @returns {string} A string which uses shell-codes to highligh differences. | ||
* @type {_erte.erte} | ||
*/ | ||
export default function erte(source, target) { | ||
function erte(source, target) { | ||
const diff = new Diff() | ||
@@ -65,7 +58,7 @@ const d = diff.diff(source, target) | ||
p = s.map(t => { | ||
return t.replace(/\n$/mg, '⏎\n') | ||
return t.replace(/(\r?\n)$/mg, '⏎$1') | ||
}).map(t => c(t, 'green')).join(b(' ', 'green')) | ||
} else if (removed) { | ||
p = s.map(t => { | ||
return t.replace(/\n$/mg, '⏎\n') | ||
return t.replace(/(\r?\n)$/mg, '⏎$1') | ||
}).map(t => c(t, 'red')).join(b(' ', 'red')) | ||
@@ -81,10 +74,20 @@ } else { | ||
export default erte | ||
/* documentary types/index.xml */ | ||
/** | ||
* @typedef {('black'|'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'white'|'grey')} Color The color to apply. | ||
*/ | ||
/** | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {_erte.Color} Color The color to apply. | ||
* @typedef {import('../types').c} _erte.c | ||
*/ | ||
/** | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {('black'|'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'white'|'grey')} _erte.Color The color to apply. | ||
* @typedef {import('../types').b} _erte.b | ||
*/ | ||
/** | ||
* @suppress {nonStandardJsDocs} | ||
* @typedef {import('../types').erte} _erte.erte | ||
*/ |
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
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
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
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
73284
13
155
2
70
481
1
1