diff --git a/packages/stdline/.gitattributes b/packages/stdline/.gitattributes deleted file mode 100644 index fcadb2cf..00000000 --- a/packages/stdline/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text eol=lf diff --git a/packages/stdline/.npmignore b/packages/stdline/.npmignore deleted file mode 100644 index 3f82cffb..00000000 --- a/packages/stdline/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -.* -*.log -spec.js -example.js diff --git a/packages/stdline/.npmrc b/packages/stdline/.npmrc deleted file mode 100644 index e1a92050..00000000 --- a/packages/stdline/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -package-lock=false -access=public diff --git a/packages/stdline/README.md b/packages/stdline/README.md deleted file mode 100644 index e9f1b630..00000000 --- a/packages/stdline/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# stdline [![](https://img.shields.io/npm/v/stdline.svg)](https://www.npmjs.com/package/stdline) [![](https://img.shields.io/badge/source--000000.svg?logo=github&style=social)](https://github.com/omrilotan/mono/tree/master/packages/stdline) - -## 💬 Update current STDOUT stream - -![](https://user-images.githubusercontent.com/516342/49694510-3227c980-fb94-11e8-9d17-3638cc64633f.gif) - - -Work on current line -```js -const { - update, - end, -} = require('stdline'); - -console.log('processing:'); -... - -update('Got an update for you'); -... -end('Finished!'); -``` - -Clear screen -```js -const { clear } = require('stdline'); - -clear(); -``` diff --git a/packages/stdline/example.js b/packages/stdline/example.js deleted file mode 100644 index 06885909..00000000 --- a/packages/stdline/example.js +++ /dev/null @@ -1,20 +0,0 @@ -const { - clear, - end, - update, -} = require('.'); - -const DELAY = 40; - -clear(); - -console.log('processing:'); - -const array = new Array(100).fill(1).map((n, i) => i); - -array.forEach((n, i) => setTimeout(() => update(n + '%'), i * DELAY)); - -setTimeout(() => { - end('Blast off!'); - console.log('fin'); -}, array.length * DELAY); diff --git a/packages/stdline/index.js b/packages/stdline/index.js deleted file mode 100644 index 3697f6da..00000000 --- a/packages/stdline/index.js +++ /dev/null @@ -1,45 +0,0 @@ -const { - clearLine, - clearScreenDown, - cursorTo, -} = require('readline'); - -const { stdout } = process; - -Object.assign( - exports, - { - clear, - end, - update, - }, -); - -/** - * Update current STDOUT line - * @param {String} message - * no return value - */ -function update(message) { - clearLine(stdout, 0); // Clear current STDOUT line - cursorTo(stdout, 0); // Place cursor at the start - stdout.write(message.toString()); -} - -/** - * Update current STDOUT line and move to next one - * @param {String} message - * no return value - */ -function end(message = '') { - update([ message.toString(), '\n' ].join('')); -} - -/** - * Clear current STDOUT stream - * no return value - */ -function clear() { - cursorTo(stdout, 0, 0); - clearScreenDown(stdout); -} diff --git a/packages/stdline/package.json b/packages/stdline/package.json deleted file mode 100644 index 80ac6613..00000000 --- a/packages/stdline/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "stdline", - "version": "0.1.0", - "description": "💬 Update current STDOUT stream", - "keywords": [ - "stdout", - "printline", - "console.clear", - "cli", - "message", - "update", - "💬" - ], - "author": "omrilotan", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/omrilotan/mono.git" - }, - "homepage": "https://omrilotan.com/mono/stdline/", - "main": "index.js", - "scripts": { - "test": "echo \"I have on tests 😞\"" - } -}