fisx-command-init
Init project or files using the given tempalte.
How to use
Init project
fisx init # using the default project template to init project fisx init spa # init spa project template fisx init spa --force # force init the not empty project directory fisx init gitlab:xx/xx # init project using the template from gitlab fisx init github:xx/xx # init project using the template from github fisx init ./xx/xx # init project from local template fisx init npm:xx@1.0.0 # specify the scaffold version
The init source syntax is the same as fisx package install
If using gitlab, some custom options you can configure:
fis;fis;
Init file
fisx init html index.html # create html file fisx init js app.js # create js file
View help information
fisx init -h
Force use the latest scaffold
If your scaffold is from remote, and you want to disable the local cache and fetch the latest to init, you can use --latest
options.
fisx init --latest
Custom builtin template
Default builtin template is fisx-scaffold. You can custom the builtin template type:
-
Custom project template
fis; -
Custom file template
fis; -
Custom the deafult template source owner:
fisx init abc
is equivalent tofisx init myrepos/abc
, and is also equivalent tofisx init github:myrepos/abc
.fis; -
Custom the scaffold source type
By default, the default source type is
GitHub
, using the following setting to change:fis;
Template syntax
Syntax of variable
-
${#variableName#}
: the variable value will be inited in the form of command interaction -
${#variableName=variable default value#}
: with default value -
${#varName:boolean=true#}
: specify the type of the variable -
The template is rendered by template engine etpl, so it supports the syntax like conditional expression defined in
etpl
. -
The command open and close syntax:
<!#--
and--#>
. -
You can use the template variable in file name or file content.
Builtin template variable
-
author: by default using the author information from
package.json
, if not found, will try to use the system use name. -
date: the date format is like
YYYY/m/d
-
name: the project name, by default using the project director name
-
custom your template variable
-
using the config
fis;fis; -
using the command args
fisx init xx --author xxx@xx.com
-