0.5.0 • Published 4 years ago

@tommywalkie/excalidraw-cli v0.5.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

excalidraw-cli

npm version Bundlephobia badge build

Experimental Excalidraw CLI tool.

Parses Excalidraw JSON schemas (*.excalidraw) into PNGs (*.png).

This project is a follow-up to excalidraw#1261 and strives to provide a CLI for excalidraw.

demo

Demo ⤴️

Install

npm install -g @tommywalkie/excalidraw-cli

Alpine

If using Alpine (e.g. for Docker stuff), install the following packages.

FROM node:alpine
RUN apk update
RUN apk add --no-cache python g++ build-base cairo-dev jpeg-dev pango-dev \
    musl-dev giflib-dev pixman-dev pangomm-dev libjpeg-turbo-dev freetype-dev

Usage

$ excalidraw-cli --help
Parses Excalidraw JSON schemas into PNGs

USAGE
  $ excalidraw-cli [INPUT] [OUTPUT]

ARGUMENTS
  INPUT   [default: {cwd}] Excalidraw file path / directory path
  OUTPUT  [default: {cwd}] Output PNG file path / directory path

OPTIONS
  -h, --help     show CLI help
  -q, --quiet    disable console outputs
  -v, --version  show CLI version

How it works ?

Currently, excalidraw NPM package only exports a React component. excalidraw-cli uses node-canvas at its core, this allows to generate canvas without relying on the window context, and uses a home-made renderer which tries to mimic Excalidraw's as much as possible, using Rough.js API primarily.

Hopefully, excalidraw-cli will directly use Excalidraw renderer methods for consistent results, once Excalidraw provides some Node-compatible API.

See the related issue thread excalidraw#1780.

Contributing

Note: Most of the codebase is currently in ES2017, it will soon be converted to TypeScript for educational purposes, but also for easier integration with Excalidraw.

Install dependencies with npm or yarn.

npm install

Export fonts, transpile TypeScript / ES2017 source into CommonJS for production.

npm run prepack

Test the CLI with the transpiled source code.

node ./bin/run           # Run with Node
npm run excalidraw-cli   # Run with NPM script

Prepack and launch Jest tests.

npm run test

You can check requested / planned / work-in-progress features in Projects.

License

MIT

0.5.0

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago