Skip to main content

fs.project

@listenai/lisa_core / Exports / fs / Project

Class: Project

fs.Project

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

Table of contents#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

constructor#

new Project()

Defined in#

src/fs/project.ts:68

Properties#

_download_path#

Private Optional _download_path: string

template 目录

Defined in#

src/fs/project.ts:46


_root#

Private Optional _root: string

项目主目录

Defined in#

src/fs/project.ts:20


_template_path#

Private Optional _template_path: string

template 目录

Defined in#

src/fs/project.ts:33


error#

error: LogFunction

错误日志方法

Defined in#

src/fs/project.ts:68


info#

info: LogFunction

日志方法

Defined in#

src/fs/project.ts:63

Accessors#

download_path#

get download_path(): string

Returns#

string

Defined in#

src/fs/project.ts:55

set download_path(dir): void

Parameters#

NameType
dirstring

Returns#

void

Defined in#

src/fs/project.ts:48


root#

get root(): string

Returns#

string

Defined in#

src/fs/project.ts:26

set root(dir): void

Parameters#

NameType
dirstring

Returns#

void

Defined in#

src/fs/project.ts:22


template_path#

get template_path(): string

Returns#

string

Defined in#

src/fs/project.ts:39

set template_path(dir): void

Parameters#

NameType
dirstring

Returns#

void

Defined in#

src/fs/project.ts:35

Methods#

copy#

copy(source, target): Promise<void>

文件复制 or 目录复制

Parameters#

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

Returns#

Promise<void>

Defined in#

src/fs/project.ts:138


downloadFile#

downloadFile(opts): Promise<Object>

下载文件

Parameters#

NameType
optsObject
opts.fileNamestring
opts.progress?(percentage: number, transferred: number, total: number) => void
opts.targetDir?string
opts.urlstring

Returns#

Promise<Object>

Defined in#

src/fs/project.ts:171


download_join#

download_join(...paths): string

获取下载路径

Parameters#

NameTypeDescription
...pathsstring[]路径地址

Returns#

string

Defined in#

src/fs/project.ts:100


join#

join(...paths): string

获取项目的对应目录

Parameters#

NameTypeDescription
...pathsstring[]路径地址

Returns#

string

Defined in#

src/fs/project.ts:84


mkdir#

mkdir(...paths): Promise<void>

创建目录

Parameters#

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

Returns#

Promise<void>

Defined in#

src/fs/project.ts:108


template#

template(source, target, data): Promise<void>

模版渲染器

Parameters#

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

Returns#

Promise<void>

Defined in#

src/fs/project.ts:154


template_join#

template_join(...paths): string

获取模板路径

Parameters#

NameTypeDescription
...pathsstring[]路径地址

Returns#

string

Defined in#

src/fs/project.ts:92


touch#

touch(...paths): Promise<void>

创建空白文件

Parameters#

NameType
...pathsstring[]

Returns#

Promise<void>

Defined in#

src/fs/project.ts:122


unzip#

unzip(source, target?): Promise<void>

解压文件

Parameters#

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

Returns#

Promise<void>

Defined in#

src/fs/project.ts:210


zip#

zip(): AdmZip

获取zip实例

Returns#

AdmZip

Defined in#

src/fs/project.ts:218

  • 没帮助 0