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:
Name | Type |
---|---|
dir | string |
Returns: void
#
root• get root(): string
Returns: string
• set root(dir
: string): void
Parameters:
Name | Type |
---|---|
dir | string |
Returns: void
#
template_path• get template_path(): string
Returns: string
• set template_path(dir
: string): void
Parameters:
Name | Type |
---|---|
dir | string |
Returns: void
#
Methods#
copy▸ copy(source
: string, target
: string): Promise‹void›
文件复制 or 目录复制
Parameters:
Name | Type | Description |
---|---|---|
source | string | 模版地址,注意是在项目设置的模版目录中寻找 |
target | string | 目标地址,注意是在项目中对应的地址 |
Returns: Promise‹void›
#
downloadFile▸ downloadFile(opts
: object): Promise‹object›
下载文件
Parameters:
▪ opts: object
Name | Type |
---|---|
fileName | string |
progress? | undefined | function |
targetDir? | undefined | string |
url | string |
Returns: Promise‹object›
#
download_join▸ download_join(...paths
: string[]): string
获取下载路径
Parameters:
Name | Type | Description |
---|---|---|
...paths | string[] | 路径地址 |
Returns: string
#
join▸ join(...paths
: string[]): string
获取项目的对应目录
Parameters:
Name | Type | Description |
---|---|---|
...paths | string[] | 路径地址 |
Returns: string
#
mkdir▸ mkdir(...paths
: string[]): Promise‹void›
创建目录
Parameters:
Name | Type | Description |
---|---|---|
...paths | string[] | 目录路径,请注意,这是里相对路径 |
Returns: Promise‹void›
#
template▸ template(source
: string, target
: string, data
: any): Promise‹void›
模版渲染器
Parameters:
Name | Type | Description |
---|---|---|
source | string | 模版地址,注意是在项目设置的模版目录中寻找 |
target | string | 目标地址,注意是在项目中对应的地址 |
data | any | - |
Returns: Promise‹void›
#
template_join▸ template_join(...paths
: string[]): string
获取模板路径
Parameters:
Name | Type | Description |
---|---|---|
...paths | string[] | 路径地址 |
Returns: string
#
touch▸ touch(...paths
: string[]): Promise‹void›
创建空白文件
Parameters:
Name | Type |
---|---|
...paths | string[] |
Returns: Promise‹void›
#
unzip▸ unzip(source
: string, target?
: undefined | string): Promise‹void›
解压文件
Parameters:
Name | Type | Description |
---|---|---|
source | string | zip文件地址 |
target? | undefined | string | 解压目录 |
Returns: Promise‹void›
#
zip▸ zip(): AdmZip‹›
获取zip实例
Returns: AdmZip‹›