# vf-cli

> VF-CLI 能帮你快速开发并自动产出 VF Engine 所需要的 JSON 数据

Latest version **1.1.4** (published 2020-03-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install vf-cli
pnpm add vf-cli
yarn add vf-cli
bun add vf-cli
```

Provides the command `vf`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2020-03-26 |
| First published | 2020-01-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 1.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | haojenma@gmail.com |
| Maintainers | haojenma |

## Links

- npm: https://www.npmjs.com/package/vf-cli
- npm.io page: https://npm.io/package/vf-cli

## Dependencies (8)

- [ora](https://npm.io/package/ora.md) ^2.0.0
- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [inquirer](https://npm.io/package/inquirer.md) ^7.0.3
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [git-user-name](https://npm.io/package/git-user-name.md) ^2.0.0
- [update-notifier](https://npm.io/package/update-notifier.md) ^4.1.0
- [download-git-repo](https://npm.io/package/download-git-repo.md) ^3.0.2

## Recent versions

- 1.1.4 (latest) — 2020-03-26
- 1.1.3 — 2020-03-25
- 1.1.0 — 2020-01-10
- 1.0.1 — 2020-01-09

## README

## 概览
VF-CLI 能帮你快速开发并自动产出 VF Engine 所需要的 JSON 数据 
   
## 安装
    npm install -g vf-cli
## 使用
创建一个 VF 项目:

    vf init hello-world

最终结果如图：

<img src="./docs/assets/vf-cli-init-guide.jpg" style="width: 120px;">

### 初始化:

1. Project Name: 项目的名称
2. Project description(可选): 项目描述
3. Install Vue template test: 是否安装前端 Vue 模版项目，是否安装会产出不同的项目路径结构

不安装 Vue template 的结构为:

 ```
    hello-world
    |---build
    |---src
    |---types
    |---t2j.config.json
 ``` 

安装 Vue template 后的结构为:

```
hello-world
|----web
     |---build
     |---static
     |---vf-json
     |---index.html
     |---index.js
     |---...
|----ts2json
     |---build
     |---src
     |---types
     |---t2j.config.json
     |---...
       
```

其中安装后的结构，```ts2json/``` 文件夹里负责编写 Typescript，产出 JSON 文件到 ```web/`` 文件夹，
需要注意的是， ts2json 跟 web 是不同的服务，需要各启对应的服务

在 ts2json 里启动 ts to json 服务
```
cd ts2json
npm install 
npm run start
```

在 web 里启动前端 Vue 服务
```
cd web
npm install
npm run start
```


### ts2json 目录结构

```
    |-build // ts2json 的编译配置
    |-src // 在这里写业务，里面有一个简单的 demo 示例，可以按照你的业务需要自由删改
    |-types // 内置的类型约束文件，会随着 VF 持续迭代，如果有遗漏不全可能需要你先自行完善或告知我们
    |-t2j.config.json // ts2json 的配置选项
    |-其他常见配置文件
```
有关 ts2json 内部详细的配置请见 [帮助文档](https://github.com/vipkid-edu/vf-ts2json#how-to-use)

### web 目录结构
```
   |-build // 常见前端 build 配置
   |-static // 静态资源文件夹
   |-vf-json // 从 ts2json 产出的 json 文件会放在这里
   |-index.html 
   |-index.js
   |-App.vue 
```

### Engine 依赖
目前CLI没有内置 VF 引擎，如需引用请先自行安装。 有关引擎内嵌、更新提醒等功能正在开发
       
## 下一步
即将开发的特性

1. 引擎内嵌
2. 引擎更新提示
3. 持续完善 VF Engine 类型校验
3. CLI 更新提示

## 其他文档参考
待补充

---
_Source: https://npm.io/package/vf-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
