# makejs.art

> JavaScript formatter (I guess?) that turns your code into (executable!) ascii art in the form of a picture.

Latest version **1.0.2** (published 2022-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install makejs.art
pnpm add makejs.art
yarn add makejs.art
bun add makejs.art
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-11-09 |
| First published | 2022-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 18.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Peter Elmers |
| Maintainers | pelmers |

## Links

- npm: https://www.npmjs.com/package/makejs.art
- Repository: https://github.com/pelmers/makejs.art
- Homepage: https://github.com/pelmers/makejs.art#readme
- Issues: https://github.com/pelmers/makejs.art/issues
- npm.io page: https://npm.io/package/makejs.art

## Dependencies (4)

- [nan](https://npm.io/package/nan.md) ^2.17.0
- [node-canvas](https://npm.io/package/node-canvas.md) ^2.9.0
- [@babel/parser](https://npm.io/package/@babel/parser.md) 7.14.8
- [@babel/generator](https://npm.io/package/@babel/generator.md) 7.14.8

## Recent versions

- 1.0.2 (latest) — 2022-11-09
- 1.0.1 — 2022-11-09
- 1.0.0 — 2022-11-09

## README

# [Make JS Art](https://makejs.art/)

JavaScript formatter (I guess?) that turns your code into (executable!) ascii
art in the form of a picture.

**Example:**
![](example.gif)

**[Try it out!](https://makejs.art/)**

Works best with images that have a well-defined subject.

### Develop

```
git submodule init
git submodule update
yarn
yarn build
yarn jest
```

### More Details

I have published a [blog post](https://pelmers.com/making-javascript-art/) on this project.

### [Node API](https://www.npmjs.com/package/makejs.art)

Now you can also use this as a node module to programmatically turn your code into ascii art!
This will use the node-canvas library to render the provided image to an invisible buffer.

**Install**:

```
npm install makejs.art
OR
yarn add makejs.art
```

**Usage**:

```js
import { makeJsArt } from 'makejs.art';

const source = `
  const a = 1;
  const b = 2;
  const c = a + b;
  console.log(c);
`;

const art = await makeJsArt(source, {
    imagePath: 'path/to/image.png',
    mode: 'intensity',
    cutoff: 0.5,
    invert: false,
});
```

### Webpack Plugin API

This project uses its own webpack plugin to ascii artify itself!
See an example output at [index.js](/dist/index.js).

**Install**:

```
npm install makejs.art
OR
yarn add makejs.art
```

**Usage**:
In `webpack.config.js`:

```js
const { MakeJsArtWebpackPlugin } = require('makejs.art');
module.exports = {
    ...
    plugins: [
        new MakeJsArtWebpackPlugin({
            /* path to an image on disk to use as base of artwork */
            imagePath: 'path/to/image.png',
            /* mode = intensity | saliency */
            mode: 'intensity',
            /* cutoff = 0.0 - 1.0 */
            cutoff: 0.5,
            /* invert = true | false */
            invert: false,
            /* ignorePatterns = [string | RegExp], if empty all .js assets are modified */
            ignorePatterns: [/vendors-.*/],
        }),
    ],
}
```

---
_Source: https://npm.io/package/makejs.art · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
