Init project or files using the given tempalte.
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:[email protected] # specify the scaffold versionThe init source syntax is the same as fisx package install
If using gitlab, some custom options you can configure:
fis.set('scaffold.gitlabDomain', 'http://<your gitlab domain>');
fis.set('scaffold.gitlabToken', '<private token>');fisx init html index.html # create html file
fisx init js app.js # create js filefisx init -hIf 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 --latestDefault builtin template is fisx-scaffold. You can custom the builtin template type:
-
Custom project template
fis.set('scaffold.project', { spa: { uri: 'yourscaffold/xxx', // by default source is github, you can use like github:xx to specify the source type description: 'the template descripion, you can see this in help information' } });
-
Custom file template
fis.set('scaffold.file', { html: { uri: 'yourscaffold/xxx.html', description: 'the template descripion, you can see this in help information' } });
-
Custom the deafult template source owner:
fisx init abcis equivalent tofisx init myrepos/abc, and is also equivalent tofisx init github:myrepos/abc.fis.set('scaffold.namespace', 'myrepos');
-
Custom the scaffold source type
By default, the default source type is
GitHub, using the following setting to change:fis.set('scaffold.source', { value: 'gitlab', options: function () { token: 'xx', domain: 'http://xx.gitlab.com' } });
-
${#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.
-
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.set('template.xxx', function () { return 'xxx'; }); fis.set('template.xxx', 'xxx');
-
using the command args
fisx init xx --author [email protected]
-