Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/accordproject/template-cli

Command Line Interface for template engine and data format conversion
https://github.com/accordproject/template-cli

Last synced: 3 months ago
JSON representation

Command Line Interface for template engine and data format conversion

Awesome Lists containing this project

README

        

# Accord Project Template Manager

Command Line Interface for the [Accord Project Template Engine](https://github.com/accordproject/template-engine).

## Install

```shell
npm i @accordproject/template-cli -g
```

## Example Commands

### Help

```shell
ten help
```

### Generate

The `generate` command creates a document from a template + data.

The command below generates an HTML file using the `helloworld` template:

```shell
ten generate ~/dev/template-engine/test/templates/full/ ~/dev/template-engine/test/templates/full/data.json html ~/Desktop/test.html
```

### Compile

The `compile` command compiles a template to TypeScript code

The command below compiles the `helloworld` template:

```shell
ten compile ~/dev/template-engine/test/templates/helloworld ~/dev/temp/helloworld
```

To run the generated code:

```
cd ~/dev/temp/helloworld
npm i
npm start ~/dev/template-engine/test/templates/helloworld/data.json
```

The output should be:

```json
{
"$class": "[email protected]",
"xmlns": "[email protected]",
"nodes": [
{
"$class": "[email protected]",
"name": "top",
"nodes": [
{
"$class": "[email protected]",
"nodes": [
{
"$class": "[email protected]",
"text": "Hello ",
"nodes": []
},
{
"$class": "[email protected]",
"name": "message",
"value": "\"World\""
},
{
"$class": "[email protected]",
"text": ".",
"nodes": []
}
]
}
]
}
]
}
```