New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

freemarker-visualizer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freemarker-visualizer

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

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

freemarker-visualizer

:construction: Work in Progress! :construction:

Version Downloads/week License

Introduction

A command-line utility to produce visual graphs of FreeMarker file trees. It was inspired by 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

Setup

npm install -g freemarker-visualizer

Install graphviz:

# OS X:
brew install graphviz || port install graphviz
# Fedora:
dnf install graphviz
# Ubuntu:
apt-get install graphviz

Usage

Graph file tree:

freemarker-visualizer path/to/template.ftl --directories path/to/dir

This will display a visual graph.

Save graph as an image:

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:

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:

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.

Configuration

PropertyTypeDefaultDescription
directoriesArraynullpaths of base directories to search for templates
pluginsArraynullpaths to plugins
templateStringnullpath to template
imageStringgraph.pngpath 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.

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 for more information.

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.

Keywords

commander.js

FAQs

Package last updated on 23 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts