# freemarker-visualizer

> A command-line utility to produce visualize graphs of FreeMarker dependencies.

Latest version **0.2.1** (published 2020-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install freemarker-visualizer
pnpm add freemarker-visualizer
yarn add freemarker-visualizer
bun add freemarker-visualizer
```

Provides the command `freemarker-visualizer`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2020-11-23 |
| First published | 2020-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 3 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | colinfruit |
| Maintainers | colinfruit |
| Keywords | commander.js |

## Links

- npm: https://www.npmjs.com/package/freemarker-visualizer
- Repository: https://github.com/colinfruit/freemarker-visualizer
- Issues: https://github.com/colinfruit/freemarker-visualizer/issues
- npm.io page: https://npm.io/package/freemarker-visualizer

## Dependencies (3)

- [graphviz](https://npm.io/package/graphviz.md) 0.0.9
- [commander](https://npm.io/package/commander.md) ^6.2.0
- [freemarker-parser](https://npm.io/package/freemarker-parser.md) ^1.1.6

## Recent versions

- 0.2.1 (latest) — 2020-11-23
- 0.2.0 — 2020-11-22
- 0.0.2 — 2020-11-21
- 0.0.1 — 2020-11-20
- 0.0.0 — 2020-11-18

## README

freemarker-visualizer
=====================

<p align="center">
    :construction: Work in Progress! :construction:
</p>

[![Version](https://img.shields.io/npm/v/freemarker-visualizer.svg)](https://npmjs.org/package/freemarker-visualizer)
[![Downloads/week](https://img.shields.io/npm/dw/freemarker-visualizer.svg)](https://npmjs.org/package/freemarker-visualizer)
[![License](https://img.shields.io/npm/l/freemarker-visualizer.svg)](https://github.com/colinfruit/freemarker-visualizer/blob/master/package.json)

<!-- introduction -->
# Introduction
A command-line utility to produce visual graphs of FreeMarker file trees.
It was inspired by [Madge](https://github.com/pahen/madge), a library that produces visual graphs of JavaScript dependencies.

- Files specified in `<#import />` and `<#include />` directives are graphed by default
- Plugins can be used to add additional information to the graph
<!-- introductionstop -->

<!-- setup -->
# Setup
```sh
npm install -g freemarker-visualizer
```
## Install `graphviz`:
```sh
# OS X:
brew install graphviz || port install graphviz
# Fedora:
dnf install graphviz
# Ubuntu:
apt-get install graphviz
```
<!-- setupstop -->

<!-- usage -->
# Usage
### Graph file tree:
```sh
freemarker-visualizer path/to/template.ftl --directories path/to/dir
```
This will display a visual graph.

### Save graph as an image:
```sh
freemarker-visualizer path/to/template.ftl --directories path/to/dir --image graph.svg
```
This will save `graph.svg` in the `cwd`.

### Specify multiple template directories:
```sh
freemarker-visualizer path/to/template.ftl --directories dir1 dir2
```
This is useful in a project that has multiple base template directories. To avoid difficulty using `freemarker-visualizer`, the directories may be set in a configuration file.

### Add additional template info:
```sh
freemarker-visualizer path/to/template.ftl --directories path/to/dir --plugins path/to/plugin.js
```
This will generate a graph with additional information about each processed template.
<!-- usagestop -->

<!-- config -->
# Configuration
Property | Type | Default | Description
--- | --- | --- | ---
`directories` | Array | null | paths of base directories to search for templates
`plugins` | Array | null | paths to plugins
`template` | String | null | path to template
`image` | String | `graph.png` | path for generated graph image


You can add a configuration file in `.config/freemarker-visualizer/config.js` in your home directory or provide it through the `--config` flag.
<!-- configstop -->

<!-- plugins -->
# Writing plugins
To generate additional information about each template, a plugin can be referenced through the cli or added to the configuration file.

Each plugin must:
- be a JavaScript file
- export a function with a data parameter
- return an object with the new information to be displayed

See [example plugins](https://github.com/colinfruit/freemarker-visualizer/tree/master/examples/plugins) for more information.
<!-- pluginsstop -->

<!-- limitations -->
# Limitations
Currently, this utility will ignore template paths that are not relative to one of the provided base template directories. For example, "*/template.ftl" would not be resolved.
<!-- limitationsstop -->

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