#template #generator #skeleton #git-repository #project #file-content #filesystem

bin+lib ffizer

ffizer is a files and folders initializer / generator. It creates or updates any kind (or part) of project from template(s)

64 releases (42 stable)

2.13.0 Nov 5, 2024
2.12.0 Dec 10, 2023
2.11.4 Sep 4, 2023
2.10.3 Apr 10, 2023
0.6.0 Nov 25, 2018

#21 in Template engine

Download history 119/week @ 2024-09-21 12/week @ 2024-09-28 1/week @ 2024-10-05 130/week @ 2024-11-02 22/week @ 2024-11-09 5/week @ 2024-11-16 2/week @ 2024-11-23

159 downloads per month

CC0 license

185KB
4.5K SLoC

ffizer

crates license crate version

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Actions Status test coverage

crates download GitHub All Releases

ffizer is a files and folders initializer / generator. It creates or updates any kind (or part) of project from template(s).

keywords: file generator, project template, project scaffolding, quick start, project bootstrap, project skeleton

asciicast: ffizer demo

Features

  • Create or update files and folder from one (or several) template(s).
  • A native executable (cli)
    • Install via download a standalone single file on system (no requirements like python, ruby, nodejs, java, ...).
    • Run as fast enough project generator.
    • Run with dry mode (useful to test).
  • A rust library
    • Can be included into other tool
  • Templates Authoring
    • Can be used for any file & folder generation (no specialization to one ecosystem).
    • Can start as simple as a folder to copy "as is".
    • Can use the Handlebars template syntax for file content, extended with functions:
      • To transform strings (toUpperCase, toLowerCase, Capitalize,...)
      • To retrieve content via http get (like .gitignore from gitignore.io, license from spdx)
      • ...
    • Can replace variables part in file and folder's name
    • Can be composed of other templates (applied as layer)
    • Can ignore file / folder under conditions
    • Can store the content at the root of the folder or under the sub-folder template
  • Templates Hosting
    • On a local folder
    • On a hosted git repository (public / private, github / bitbucket/ gitlab / ...)
      • At the root of the repository
      • In a sub-folder of the repository
      • In any revision (branch, tag, commit)

Suggestions are welcomes ;-)

A list of alternatives is available on the wiki, feel free to complete / correct.

Usages

Install

curl https://raw.githubusercontent.com/ffizer/ffizer/master/scripts/getLatest.sh | bash

Or download the binary for your platform from github releases, then un-archive it and place it your PATH.

via homebrew (MacOs & Linux)

brew install ffizer/ffizer/ffizer-bin
ffizer upgrade

via cargo

# install pre-build binary via cargo-binstall
cargo binstall ffizer

# install from source
cargo install ffizer --force --features cli

Run

❯ ffizer --help

ffizer is a files and folders initializer / generator.
It creates or updates any kind (or part) of project from template(s)

Usage: ffizer [OPTIONS] <COMMAND>

Commands:
  apply             Apply a template into a target directory
  inspect           Inspect configuration, caches,... (wip)
  show-json-schema  Show the json schema of the .ffizer.yaml files
  test-samples      test a template against its samples
  help              Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose...  Verbose mode (-v, -vv (very verbose / level debug), -vvv) print on stderr
  -h, --help        Print help information
  -V, --version     Print version information

https://ffizer.github.io/ffizer/book/

Apply a template (to create or update)

 ffizer apply --help

Apply a template into a target directory

Usage: ffizer apply [OPTIONS] --source <URI> --destination <FOLDER>

Options:
      --confirm <CONFIRM>          ask for plan confirmation [default: Never] [possible values: auto, always, never]
      --update-mode <UPDATE_MODE>  mode to update existing file [default: Ask] [possible values: ask, keep, override, update-as-remote, current-as-local, show-diff, merge]
  -y, --no-interaction             should not ask for confirmation (to use default value, to apply plan, to override, to run script,...)
      --offline                    in offline, only local templates or cached templates are used
  -s, --source <URI>               uri / path of the template
      --rev <REV>                  git revision of the template [default: master]
      --source-subfolder <FOLDER>  path of the folder under the source uri to use for template
  -d, --destination <FOLDER>       destination folder (created if doesn't exist)
  -v, --variables <KEY_VALUE>      set variable's value from cli ("key=value")
  -h, --help                       Print help information
  -V, --version                    Print version information

  • use a local folder as template

    ffizer apply --source $HOME/my_templates/tmpl0 --destination my_project
    
  • use a remote git repository as template

    ffizer apply --source https://github.com/ffizer/template_sample.git --destination my_project
    

    output

    Configure variables
    
     project_name · my-project
     package_name · my_project
    
    
    Plan to execute
    
      - make dir        my_project
      - make dir         ├─dir_1
      - add file         │  └─file_1_1.txt
      - make dir         ├─dir_2_my-project
      - add file         │  └─file_1_2.txt
      - add file         ├─file_1.txt
      - add file         ├─file_2.txt
      - add file         ├─file_3.txt
      - add file         ├─file_4_my_project.txt
      - add file         ├─file_5_my-project.txt
      - add file         └─file_6.hbs
    

Authoring a template

Start with Template Authoring Tutorial

Few templates

Build

cargo install cargo-make --force
cargo make ci-flow

Update CHANGELOG.md

cargo make update-changelog
git add CHANGELOG.md
git commit -m ':memo: (CHANGELOG) update'

Release a new version by bump patch (or minoror major)

cargo make publish patch # dry-run
cargo make publish --execute patch

Dependencies

~23–40MB
~646K SLoC