Skip to main content

Project

项目类,用于快捷创建项目结构

Hierarchy#

  • Project

Index#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

constructor#

+ new Project(): Project

Returns: Project

Properties#

error#

error: LogFunction

错误日志方法


info#

info: LogFunction

日志方法

Accessors#

download_path#

get download_path(): string

Returns: string

set download_path(dir: string): void

Parameters:

NameType
dirstring

Returns: void


root#

get root(): string

Returns: string

set root(dir: string): void

Parameters:

NameType
dirstring

Returns: void


template_path#

get template_path(): string

Returns: string

set template_path(dir: string): void

Parameters:

NameType
dirstring

Returns: void

Methods#

copy#

copy(source: string, target: string): Promise‹void›

文件复制 or 目录复制

Parameters:

NameTypeDescription
sourcestring模版地址,注意是在项目设置的模版目录中寻找
targetstring目标地址,注意是在项目中对应的地址

Returns: Promise‹void›


downloadFile#

downloadFile(opts: object): Promise‹object›

下载文件

Parameters:

opts: object

NameType
fileNamestring
progress?undefined | function
targetDir?undefined | string
urlstring

Returns: Promise‹object›


download_join#

download_join(...paths: string[]): string

获取下载路径

Parameters:

NameTypeDescription
...pathsstring[]路径地址

Returns: string


join#

join(...paths: string[]): string

获取项目的对应目录

Parameters:

NameTypeDescription
...pathsstring[]路径地址

Returns: string


mkdir#

mkdir(...paths: string[]): Promise‹void›

创建目录

Parameters:

NameTypeDescription
...pathsstring[]目录路径,请注意,这是里相对路径

Returns: Promise‹void›


template#

template(source: string, target: string, data: any): Promise‹void›

模版渲染器

Parameters:

NameTypeDescription
sourcestring模版地址,注意是在项目设置的模版目录中寻找
targetstring目标地址,注意是在项目中对应的地址
dataany-

Returns: Promise‹void›


template_join#

template_join(...paths: string[]): string

获取模板路径

Parameters:

NameTypeDescription
...pathsstring[]路径地址

Returns: string


touch#

touch(...paths: string[]): Promise‹void›

创建空白文件

Parameters:

NameType
...pathsstring[]

Returns: Promise‹void›


unzip#

unzip(source: string, target?: undefined | string): Promise‹void›

解压文件

Parameters:

NameTypeDescription
sourcestringzip文件地址
target?undefined | string解压目录

Returns: Promise‹void›


zip#

zip(): AdmZip‹›

获取zip实例

Returns: AdmZip‹›

  • 没帮助 0