apeman-tmpl
Version:
Template manager for apeman.
246 lines (161 loc) • 5.66 kB
Markdown
apeman-tmpl
==========
<!---
This file is generated by ape-tmpl. Do not update manually.
--->
<!-- Badge Start -->
<a name="badges"></a>
[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
[![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[bd_repo_url]: https://github.com/apeman-cmd-labo/apeman-tmpl
[bd_travis_url]: http://travis-ci.org/apeman-cmd-labo/apeman-tmpl
[bd_travis_shield_url]: http://img.shields.io/travis/apeman-cmd-labo/apeman-tmpl.svg?style=flat
[bd_license_url]: https://github.com/apeman-cmd-labo/apeman-tmpl/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/apeman-cmd-labo/apeman-tmpl
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/apeman-cmd-labo/apeman-tmpl.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/apeman-cmd-labo/apeman-tmpl.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/apeman-cmd-labo/apeman-tmpl
[bd_gemnasium_shield_url]: https://gemnasium.com/apeman-cmd-labo/apeman-tmpl.svg
[bd_npm_url]: http://www.npmjs.org/package/apeman-tmpl
[bd_npm_shield_url]: http://img.shields.io/npm/v/apeman-tmpl.svg?style=flat
[bd_bower_badge_url]: https://img.shields.io/bower/v/apeman-tmpl.svg?style=flat
<!-- Badge End -->
<!-- Description Start -->
<a name="description"></a>
Template manager for apeman.
<!-- Description End -->
<!-- Overview Start -->
<a name="overview"></a>
Overview
--------
apeman-tmpl helps you to generate project skelton from templates.
There are [official tmpl plugins][tmpl_labo_url] supported by apeman team.
[tmpl_labo_url]: https://github.com/apeman-tmpl-labo
<!-- Overview End -->
<!-- Sections Start -->
<a name="sections"></a>
<!-- Section from "doc/readme/01.Installation.md.hbs" Start -->
<a name="section-doc-readme-01-installation-md"></a>
Installation
-----
Install apeman-tmpl module via [npm][npm_url].
```bash
$ npm install apeman-tmpl -g
```
[npm_url]: https://www.npmjs.com/
<!-- Section from "doc/readme/01.Installation.md.hbs" End -->
<!-- Section from "doc/readme/02.Usage.md.hbs" Start -->
<a name="section-doc-readme-02-usage-md"></a>
Usage
---------
1. Prepare an Apemanfile.js at your project root.
2. Run the command via CLI.
***Apemanfile.js***
```javascript
/** Example of Apemanfile.js */
"use strict";
module.exports = {
$cwd: __dirname,
$pkg: {/*...*/},
$tmpls: {
// Use a template plugin.
'ci/build.js': require('apeman-tmpl-ci')({
task: 'build'
}, '755'),
// Define your own template.
'src/foo.js': {
// Custom tmpl conforms bud file format for `coz`.
// For more detail, see https://www.npmjs.com/package/coz
tmpl: '../../asset/foo.js.hbs',
data: {},
mode: '644',
force: true
}
},
$tasks: {/*...*/},
$apps: {/*...*/},
$wchs: {/*...*/}
};
```
Then,
```bash
# Render all templates
$ apeman-tmpl
```
##### CLI Options
```bash
$ apeman-tmpl -h
Usage: apeman-tmpl [options]
Render template files.
Options:
-h, --help output usage information
-V, --version output the version number
-v, --verbose Show verbose logs
-p, --pattern <pattern> Template name pattern
-l, --list List available templates
-c, --configuration <configuration> Pathname of Apemanfile
Examples:
$ apeman-tmpl # Render all templates.
$ apeman-tmpl -p **/*.txt # Render specific templates.
$ apeman-tmpl -l # Show available templates.
```
<!-- Section from "doc/readme/02.Usage.md.hbs" End -->
<!-- Section from "doc/readme/03.Programmatic API.md.hbs" Start -->
<a name="section-doc-readme-03-programmatic-a-p-i-md"></a>
Programmatic API
------
apeman-tmpl also provide programmatic API.
Firstly, install the module locally.
```bash
$ npm install apeman-tmpl --save-dev
```
Then,
```javascript
"use strict";
const apemanTmpl = require('apeman-tmpl');
apemanTmpl({
}, (err) => {
/*...*/
});
```
##### Programmatic Options
| Key | Description | Default |
| --- | ----------- | ------- |
| verbose | Show verbose logs | |
| pattern | Template name pattern | |
| list | List available templates | |
| configuration | Pathname of Apemanfile | |
<!-- Section from "doc/readme/03.Programmatic API.md.hbs" End -->
<!-- Section from "doc/readme/04.Contributing.md.hbs" Start -->
<a name="section-doc-readme-04-contributing-md"></a>
Contribution
------
You can create your own tmpl plugin quickly with scaffold.
Install [apeman-scaffold][scaffold_url] as a global module
```bash
$ npm install apeman-scaffold -g
```
then, generate scaffold.
```bash
$ apeman-scaffold tmpl apeman-tmpl-yourown
```
[scaffold_url]: https://www.npmjs.com/package/apeman-scaffold
<!-- Section from "doc/readme/04.Contributing.md.hbs" End -->
<!-- Sections Start -->
<!-- LICENSE Start -->
<a name="license"></a>
License
-------
This software is released under the [MIT License](https://github.com/apeman-cmd-labo/apeman-tmpl/blob/master/LICENSE).
<!-- LICENSE End -->
<!-- Links Start -->
<a name="links"></a>
Links
------
+ [apeman](http://github.com/apeman-labo/apeman)
+ [apeman-cmd-labo](https://github.com/apeman-cmd-labo)
+ [apeman-tmpl-labo](https://github.com/apeman-tmpl-labo)
+ [coz](https://github.com/coz-repo/coz)
<!-- Links End -->