[Pkg-javascript-commits] [node-strip-ansi] 01/02: Imported Upstream version 3.0.1
Thorsten Alteholz
alteholz at moszumanska.debian.org
Sun Jul 17 13:23:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-strip-ansi.
commit 503a532c09d4eb02c4726bd637c2140ac808d910
Author: Thorsten Alteholz <debian at alteholz.de>
Date: Sun Jul 17 15:23:38 2016 +0200
Imported Upstream version 3.0.1
---
.editorconfig | 2 +-
.gitignore | 1 -
.jshintrc | 13 -------------
cli.js | 47 -----------------------------------------------
package.json | 25 +++++++++++--------------
readme.md | 24 +++++++-----------------
test.js | 36 ++++++++----------------------------
7 files changed, 27 insertions(+), 121 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 86c8f59..8f9d77e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,7 +7,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-[package.json]
+[{package.json,*.yml}]
indent_style = space
indent_size = 2
diff --git a/.gitignore b/.gitignore
index 163ac7c..3c3629e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
node_modules
-colored.example.txt
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 804f8af..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "node": true,
- "esnext": true,
- "bitwise": true,
- "camelcase": true,
- "curly": true,
- "immed": true,
- "newcap": true,
- "noarg": true,
- "undef": true,
- "unused": "vars",
- "strict": true
-}
diff --git a/cli.js b/cli.js
deleted file mode 100755
index b83f63b..0000000
--- a/cli.js
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env node
-'use strict';
-var fs = require('fs');
-var pkg = require('./package.json');
-var stripAnsi = require('./');
-var argv = process.argv.slice(2);
-var input = argv[0];
-
-function help() {
- console.log([
- '',
- ' ' + pkg.description,
- '',
- ' Usage',
- ' strip-ansi <input-file> > <output-file>',
- ' cat <input-file> | strip-ansi > <output-file>',
- '',
- ' Example',
- ' strip-ansi unicorn.txt > unicorn-stripped.txt'
- ].join('\n'));
-}
-
-function init(data) {
- process.stdout.write(stripAnsi(data));
-}
-
-if (argv.indexOf('--help') !== -1) {
- help();
- return;
-}
-
-if (argv.indexOf('--version') !== -1) {
- console.log(pkg.version);
- return;
-}
-
-if (!input && process.stdin.isTTY) {
- help();
- return;
-}
-
-if (input) {
- init(fs.readFileSync(input, 'utf8'));
-} else {
- process.stdin.setEncoding('utf8');
- process.stdin.on('data', init);
-}
diff --git a/package.json b/package.json
index fe0856b..301685b 100644
--- a/package.json
+++ b/package.json
@@ -1,30 +1,27 @@
{
"name": "strip-ansi",
- "version": "2.0.2",
+ "version": "3.0.1",
"description": "Strip ANSI escape codes",
"license": "MIT",
- "repository": "sindresorhus/strip-ansi",
+ "repository": "chalk/strip-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus at gmail.com",
- "url": "http://sindresorhus.com"
+ "url": "sindresorhus.com"
},
"maintainers": [
- "Sindre Sorhus <sindresorhus at gmail.com> (http://sindresorhus.com)",
- "Joshua Appelman <jappelman at xebia.com> (http://jbnicolai.com)"
+ "Sindre Sorhus <sindresorhus at gmail.com> (sindresorhus.com)",
+ "Joshua Boy Nicolai Appelman <joshua at jbna.nl> (jbna.nl)",
+ "JD Ballard <i.am.qix at gmail.com> (github.com/qix-)"
],
- "bin": {
- "strip-ansi": "cli.js"
- },
"engines": {
"node": ">=0.10.0"
},
"scripts": {
- "test": "mocha"
+ "test": "xo && ava"
},
"files": [
- "index.js",
- "cli.js"
+ "index.js"
],
"keywords": [
"strip",
@@ -37,7 +34,6 @@
"colors",
"terminal",
"console",
- "cli",
"string",
"tty",
"escape",
@@ -52,9 +48,10 @@
"text"
],
"dependencies": {
- "ansi-regex": "^1.1.1"
+ "ansi-regex": "^2.0.0"
},
"devDependencies": {
- "mocha": "*"
+ "ava": "*",
+ "xo": "*"
}
}
diff --git a/readme.md b/readme.md
index 53ec264..cb7d9ff 100644
--- a/readme.md
+++ b/readme.md
@@ -1,11 +1,11 @@
-# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi)
+# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)
> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
-```sh
+```
$ npm install --save strip-ansi
```
@@ -20,22 +20,12 @@ stripAnsi('\u001b[4mcake\u001b[0m');
```
-## CLI
-
-```sh
-$ npm install --global strip-ansi
-```
-
-```sh
-$ strip-ansi --help
-
- Usage
- strip-ansi <input-file> > <output-file>
- cat <input-file> | strip-ansi > <output-file>
+## Related
- Example
- strip-ansi unicorn.txt > unicorn-stripped.txt
-```
+- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
+- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
+- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
+- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
## License
diff --git a/test.js b/test.js
index ed45e3a..13e15da 100644
--- a/test.js
+++ b/test.js
@@ -1,33 +1,13 @@
-'use strict';
-var assert = require('assert');
-var exec = require('child_process').exec;
-var strip = require('./');
+import test from 'ava';
+import fn from './';
-it('should strip color from string', function () {
- assert.equal(strip('\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m'), 'foofoo');
+test('strip color from string', t => {
+ t.is(fn('\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m'), 'foofoo');
});
-it('should strip color from ls command', function () {
- assert.equal(strip('\u001b[00;38;5;244m\u001b[m\u001b[00;38;5;33mfoo\u001b[0m'), 'foo');
+test('strip color from ls command', t => {
+ t.is(fn('\u001b[00;38;5;244m\u001b[m\u001b[00;38;5;33mfoo\u001b[0m'), 'foo');
});
-
-it('should strip reset;setfg;setbg;italics;strike;underline sequence from string', function () {
- assert.equal(strip('\x1b[0;33;49;3;9;4mbar\x1b[0m'), 'bar');
-});
-
-it('should strip color with CLI', function (cb) {
- exec('echo "\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m" | ./cli.js', function (err, stdout) {
- assert.equal(stdout, 'foofoo\n');
- cb();
- });
-});
-
-it('should strip color from file with CLI', function (cb) {
- exec('echo "\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m" > colored.example.txt', function (err, stdout) {
- if (err) cb(err);
- exec('./cli.js colored.example.txt', function (err, stdout) {
- assert.equal(stdout, 'foofoo\n');
- cb(err);
- });
- })
+test('strip reset;setfg;setbg;italics;strike;underline sequence from string', t => {
+ t.is(fn('\x1b[0;33;49;3;9;4mbar\x1b[0m'), 'bar');
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-strip-ansi.git
More information about the Pkg-javascript-commits
mailing list