vz-generator 0.2.6

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global vz-generator --version 0.2.6                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local vz-generator --version 0.2.6                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=vz-generator&version=0.2.6                
nuke :add-package vz-generator --version 0.2.6                

vz-generator

Command Line Tool (CLI) for generate files.

NuGet version

This command is built following dotnet core global tools.

中文版readme

Install

dotnet tool install -g vz-generator

Usage

init to load settings and sample templates

vz init 

sample names:

vz init --list-samples

only load specific sample:

vz init --with-sample abp --with-sample vue.pinia

After init, please see options in .vz/generate.settings.json

Settings

TODO syntax liquid help

TODO tpl path to output path TODO file to file TODO file to folder TODO folder to folder

Template Syntax

The basic liquid syntax and builtin functions follow Scriban.

Notice

As name of paths or files not allowed the char '|', so by convention, we use '___' instead of '|'.

Extended naming functions

 {{'nameIt'|pascal_case}} =>  NameIt 
 {{'NameIt'|camel_case}}  =>  nameIt 
 {{'NameIt'|kebab_case}}  =>  name-it 
 {{'NameIt'|snake_case}}  =>  name_it 
 {{'person'|pluralize}}   =>  people 
 {{'people'|singularize}} =>  person 

Generate any files with subpaths as you want

vz g

By default, g(generate) subcommand will ask what option you want to run.

You also can use -p <your option in .vz/generate.settings.json> to provide answer

vz g -p 'Create Abp'

It will continue to ask you for some other setting which not store in .vz/generate.settings.json, such as the value of the variables. Also, can be provided as below:

vz g -p 'Create Abp' --var project=MyCompany.MyProject --var entity=User

vscode setup

vz init will create .vscode/settings.json to associate .vz/generate.settings.schema.json with .vz/generate.settings.json. if .vscode/settings.json is already exists, it will not override it, and you should update the file yourself with the content it will show you.

Just do what you want.

Be free to modify the file .vz/generate.settings.json, vz g will search the templates as you specified, load variables as you declared, and output the generated files to where you specified.

Even vz g -c <file path to your own settings.json> can override the default path to generate.settings.json, but the content of it should match the schema as .vz/generate.settings.schema.json stored.

Follow the Usage vz g -h.

Contribute

Be FREE to submit (PRs) your own templates as default samples (for any languages any scenarios) which may helpful to others.

Develop on MacOS

IDE: VS Code

DEBUG mode will use .vzx instead of .vz

  • For DEBUG SubCommand init:
    • should check "args" in .vscode/launch.json
    • should check dependsOn of build task in .vscode/tasks.json, before build should run clean .vzx and zip samples
  • For DEBUG SubCommand g:
    • should check "args" in .vscode/launch.json, and strings in it will treated as tokens (whitespace will not parsed).
    • should commented out the line dependsOn of build task in .vscode/tasks.json

All things work well.

Develop on windows

IDE: VS Code

DEBUG mode will use .vzx instead of .vz

  • For DEBUG SubCommand init:
    • should check "args" in .vscode/launch.json
    • should check dependsOn of build task in .vscode/tasks.json, before build should run clean .vzx and zip samples
    • the commands in task clean .vzx should be change to powershell Remove-Item or sth works in the specific shell.
    • the commands in task zip samples should be change to powershell Compress-Archive or sth works in the specific shell.
  • For DEBUG SubCommand g:
    • should check "args" in .vscode/launch.json, and strings in it will treated as tokens (whitespace will not parsed).
    • should commented out the line dependsOn of build task in .vscode/tasks.json

resgen maybe problem on windows when develop with pure dotnet core with vs code, but visual studio should work (not confrim).

Template Development

the -w option of subommand g, will watch the folder which template files belong to, and regenerate the output in time. It facilitates the development of templates.

vz g -w 

It will not watch the setting file, or ask you for any options or inputs again (only watch templates).
In watch mode, output always override exists files.

MIT

References

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.1.0 282 3/22/2024
2.0.0 3,026 11/22/2023
1.2.0 148 11/22/2023
1.1.0-alpha.1 208 11/16/2023
0.2.8 170 8/1/2023
0.2.7 169 8/1/2023
0.2.6 148 7/31/2023
0.2.5 182 7/28/2023
0.2.4 163 7/27/2023
0.2.3 190 7/27/2023
0.2.2 165 7/25/2023
0.2.1 171 7/24/2023
0.2.0 177 7/24/2023
0.1.1 152 7/21/2023
0.1.0 164 7/21/2023

v0.2.6 add rename subcommand;
     v0.2.5 add gitlab sample; k8s sample add init website option;
     v0.2.4 TemplateVariableType.YamlFile support;
     v0.2.3 add sample k8s;bugfix:output to folder get access denied;
     v0.2.2 finish sample swagger2api。