Comparing version 1.0.1 to 1.1.0
@@ -1,1 +0,1 @@ | ||
module.exports=function(r){function n(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var o={};return n.m=r,n.c=o,n.i=function(r){return r},n.d=function(r,o,e){n.o(r,o)||Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:e})},n.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(o,"a",o),o},n.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},n.p="",n(n.s=1)}([function(r,n,o){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default="\n.....rrrrr..yyy.\n....rrrrrrrrryy.\n....oooyyxy.rrr.\n...oyoyyyxyyyrr.\n...oyooyyyoyyyr.\n...ooyyyyoooor..\n.....yyyyyyyrr..\n..rrrrbrrrbrr..o\nyyrrrrrbrrrb..oo\nyyyrrrrbbbbYbboo\n.y..brbbYbbbbboo\n..ooobbbbbbbbboo\n.ooobbbbbb......\n.oo.............\n"},function(r,n,o){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.MarioArt=void 0;var e=o(0),t=function(r){return r&&r.__esModule?r:{default:r}}(e),u={r:"[48;5;9m",b:"[48;5;12m",g:"[48;5;10m",x:"[48;5;0m",w:"[48;5;15m",o:"[48;5;95m",y:"[48;5;224m",Y:"[48;5;11m",".":"[m"},y=function(r){var n="+"+"-".repeat(r.length+2)+"+ \n| "+r+" |\n+"+"-".repeat(r.length+2)+"+\n";return n+=" \\\n \\\n"},b=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r&&r.trim()&&r.trim().split("\n");if(o&&o.length){var e=n.speak,t=o.map(function(r){return r.split("").map(function(r){return""+u[r]+" [0m"}).join("")}).join("\n");return e&&(t=y(e)+t),t}};console.log(b(t.default)),n.default={get:b},n.MarioArt=t.default}]); | ||
module.exports=function(e){function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}var t={};return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=5)}([function(e,n,t){e.exports=t.p+"/arts/ironman.ansi"},function(e,n,t){e.exports=t.p+"/arts/mario.ansi"},function(e,n,t){e.exports=t.p+"/arts/minions.ansi"},function(e,n,t){e.exports=t.p+"/arts/parrot.ansi"},function(e,n){e.exports=require("fs")},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var a=t(1),u=r(a),i=t(2),o=r(i),f=t(3),s=r(f),l=t(0),p=r(l),c=t(4),d=r(c),m=[{name:"mario",path:__dirname+u.default},{name:"minions",path:__dirname+o.default},{name:"parrot",path:__dirname+s.default},{name:"ironman",path:__dirname+p.default}],_=function(e){var n="+"+"-".repeat(e.length+2)+"+ \n| "+e+" |\n+"+"-".repeat(e.length+2)+"+\n";return n+=" \\\n \\\n"},x=function(e){var n=e||{},t=n.artName,r=n.filePath,a=n.speechText,u="";if(r){if(!d.default.existsSync(r))return"Art file not found!"+r;u=d.default.readFileSync(r,"utf8")}else{if(!t)return"artName or filePath required.";var i=m.find(function(e){return e.name===t});if(!i)return"Art not found";u=d.default.readFileSync(i.path,"utf8")}return a&&(u=_(a)+u),u};n.default={get:x}}]); |
{ | ||
"name": "ansi-art", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "create ansi art using simple texts", | ||
@@ -30,4 +30,5 @@ "main": "dist/index.js", | ||
"babel-preset-es2015": "^6.24.1", | ||
"file-loader": "^0.11.1", | ||
"webpack": "^2.4.1" | ||
} | ||
} |
#### ANSI ART | ||
Create ANSI art using simple texts | ||
Create ANSI art and render it with speech bubbles inside node. | ||
https://gauravchl.github.io/ansi-art/webapp/ | ||
<img width="510" alt="screen shot 2017-04-25 at 11 51 53 am" src="https://cloud.githubusercontent.com/assets/3471415/25371301/b440ebe6-29ad-11e7-8459-abbea63e1630.png"> | ||
**Example:** | ||
**Steps:** | ||
1. Create and download the ANSI art from webapp: https://gauravchl.github.io/ansi-art/webapp/ | ||
2. Install `npm install ansi-art ` package to render the downloaded art file. | ||
3. You can also render existing art files directly which is available inside repo: '/src/arts/'. | ||
**Examples:** | ||
``` | ||
// Using existing art | ||
import ANSI from 'ansi-art'; | ||
let mario = ANSI.get({artName: 'mario'}); | ||
console.log(mario); | ||
const mario = ` | ||
.....rrrrr..yyy. | ||
....rrrrrrrrryy. | ||
....oooyyxy.rrr. | ||
...oyoyyyxyyyrr. | ||
...oyooyyyoyyyr. | ||
...ooyyyyoooor.. | ||
.....yyyyyyyrr.. | ||
..rrrrbrrrbrr..o | ||
yyrrrrrbrrrb..oo | ||
yyyrrrrbbbbYbboo | ||
.y..brbbYbbbbboo | ||
..ooobbbbbbbbboo | ||
.ooobbbbbb...... | ||
.oo............. | ||
` | ||
``` | ||
let mario = ANSI.get(mario); | ||
console.log(mario); | ||
``` | ||
// Using custom art file | ||
import ANSI from 'ansi-art'; | ||
let art = ANSI.get({filePath: '~/desktop/custom-art.ansi'}) | ||
console.log(art); | ||
``` | ||
``` | ||
// Using Speech bubble | ||
import ANSI from 'ansi-art'; | ||
let art = ANSI.get({artName: 'mario', speechText: 'Hello world'} | ||
console.log(art); | ||
**ANSI.get(text, options):** | ||
``` | ||
**ANSI.get(options):** | ||
Parameter | Type | Description | ||
------|------ | ------------- | ||
text | string | Text to be converted into ANSI, Characters inside text represents the color. r for red, b for blue, '.' for transparent., [See available colors](https://github.com/gauravchl/ansi-art/blob/master/src/index.js#L5): | ||
options | object | More options for ansi art | ||
options.speak | string | If provided, render the text inside 'speech bubble' above the ANSI art | ||
options.filePath | string | Path to custom ANSI art file(eg: ~/mario.ansi) | ||
options.artName | string | Name of existing ANSI art available within package.[See available arts](https://github.com/gauravchl/ansi-art/blob/master/src/arts/) | ||
options.speechText | string | If provided, render the text inside 'speech bubble' above the ANSI art | ||
@@ -47,19 +54,12 @@ | ||
**More Examples:** | ||
``` | ||
// Using Existing Arts, available inside '/src/arts/' | ||
import ANSI, { MarioArt } from 'ansi-art'; | ||
<img width="242" alt="screen shot 2017-05-14 at 4 57 37 pm" src="https://cloud.githubusercontent.com/assets/3471415/26033277/97663dc8-38c6-11e7-88d3-3d4534642ef4.png"> | ||
console.log(ANSI.get(MarioArt)); | ||
``` | ||
Mario credits: https://github.com/acarl005/node-super-mario | ||
``` | ||
// Using Speech bubble | ||
import ANSI, { MarioArt } from 'ansi-art'; | ||
Parrot credits: https://github.com/matheuss/parrotsay-api | ||
console.log(ANSI.get(MarioArt, {speak: 'Hello World'})); | ||
``` | ||
**Contributing** | ||
<img width="375" alt="screen shot 2017-04-25 at 12 45 50 pm" src="https://cloud.githubusercontent.com/assets/3471415/25372927/2b153fa4-29b5-11e7-97ab-dbcfecbc5e28.png"> | ||
Please feel free to submit any bugs or suggestions as issues or request to add any art into existing collections. Pull requests are welcome. |
@@ -7,4 +7,6 @@ var path = require('path'); | ||
var SRC_DIR = path.resolve(__dirname, 'src'); | ||
var WEB_DIR = path.resolve(__dirname, 'webapp'); | ||
var config = { | ||
@@ -26,3 +28,7 @@ entry: SRC_DIR + '/index.js', | ||
}, | ||
], | ||
{ | ||
test: /\.(ansi)$/i, | ||
loader: 'file-loader?name=/arts/[name].[ext]' | ||
} | ||
] | ||
}, | ||
@@ -37,7 +43,37 @@ plugins: [ | ||
], | ||
target: 'node', | ||
node: { | ||
__dirname: false, | ||
__filename: false, | ||
} | ||
}; | ||
var webappConfig = { | ||
entry: WEB_DIR + '/src/index.js', | ||
output: { | ||
path: WEB_DIR, | ||
filename: 'index.js', | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js|\.es6$/, | ||
include: WEB_DIR + '/src', | ||
loader: 'babel-loader', | ||
exclude: /node_modules/, | ||
query: { presets: ['es2015']} | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin(), | ||
], | ||
module.exports = [config]; | ||
} | ||
module.exports = [ config, webappConfig ]; |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
28418
10
63
5
2
1