# full-node-cli

> 全栈一体化工程脚手架

Latest version **1.0.2** (published 2021-03-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install full-node-cli
pnpm add full-node-cli
yarn add full-node-cli
bun add full-node-cli
```

Provides the command `full`.

## 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.0.2 |
| Published | 2021-03-01 |
| First published | 2021-02-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | xuxinjiang |
| Maintainers | xuxinjiang |
| Keywords | vue全栈一体化脚手架, react全栈一体化脚手架, umi全栈一体化脚手架 |

## Links

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

## Dependencies (8)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [ora](https://npm.io/package/ora.md) ^3.4.0
- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [inquirer](https://npm.io/package/inquirer.md) ^6.5.2
- [commander](https://npm.io/package/commander.md) ^3.0.2
- [handlebars](https://npm.io/package/handlebars.md) ^4.7.7
- [log-symbols](https://npm.io/package/log-symbols.md) ^3.0.0
- [download-git-repo](https://npm.io/package/download-git-repo.md) ^2.0.0

## Recent versions

- 1.0.2 (latest) — 2021-03-01
- 1.0.1 — 2021-02-25
- 1.0.0 — 2021-02-25
- 0.0.1 — 2021-02-25

## README

# full-node-cli



### 功能介绍

> full-node-cli 是前端多框架全栈一体化脚手架，前端支持vue，react 与后端nodejs EggJs/MidwayJs 框架很好的结合，内置常规的前后端插件，方便快速开发。

#### 	内置功能点

- 前端多语言框架支持，vue, react,umi
- node后端使用的是MidwayJs框架，内置 Mysql，Sequelize模型orm框架 ，umzug数据迁移工具，Typescript ，等工具。

​	MidwayJs 文档： https://www.yuque.com/midwayjs/midway_v2

​	Sequelize 文档：https://www.sequelize.com.cn/

### 安装教程

``` bash
# 安装脚手架
npm install full-node-cli -g
```
### 创建项目

```bash
# 初始化脚手架文件
full create hello-world(项目名称)
```

选择前端vue 或 react 全栈一体框架

> 🍡 react,umi,egg/midway

> 🍭 vue,egg/midway



选择继续按提示完成操作

### 安装依赖

```bash
# 安装前后端依赖
npm run i
```

### 启动开发环境

```bash
# 启动前端开发环境
npm run c

# 启动后台开发环境
npm run s
```

### 开启后端数据库模型

修改配置文件 server/src/config/config.default.ts 

**注:根据项目需求确定是否用到数据库,不需要设置为 config.useSql = false**

```typescript
  // 开启使用数据库模型 
  config.useSql = true

	// 配置sequelize 的 数据库信息
  config.sequelize = {
    dialect: 'mysql', // 数据库类型
    host: '127.0.0.1', // 数据库服务ip地址
    port: '3306', // 端口
    database: 'database', // 数据库名称
    username: 'root', // 用户名称
    password: '123456', // 密码
    timezone: '+08:00',
    modelFile: isProd ? 'js' : 'ts', // 模型文件后缀名 （建议保持原样）
    logging: false, // 是否开启 log打印
    dialectOptions: {
      dateStrings: true,
      typeCast: (field: any, next: () => void) => {
        if (field.type === 'DATETIME') {
          return field.string()
        }
        return next()
      }
    }
  }
```

### 开启数据迁移功能

修改配置文件 server/src/config/config.default.ts

**注:根据项目需求确定是否用到数据库迁移,不需要设置为 config.useUmzug = false**

```javascript
 // 启用更新数据库脚本
  config.useUmzug = true
```

新建更新数据库脚本，存放在 server/src/models/migrations目录

例如：添加update-1.0.1.ts文件 （更新数据库脚本文件，把 text_user 表添加一个 tel_number 字段）

```typescript
import { QueryInterface, Sequelize } from 'sequelize'
import { DataType } from 'sequelize-typescript'

type Migration = {
  name: string
  path?: string
  context: {
    queryInterface: QueryInterface
    sequelize: Sequelize
  }
}

export const up = async ({ name, path, context: { queryInterface } }: Migration) => {
  try {
    console.log('upgrade db => ', name, path)
    // 更新表脚本
    await queryInterface.addColumn('text_user', 'tel_number', DataType.STRING())

  } catch (error) {
    console.log(error, 'error===')
  }
}

```

### 编译打包

```bash
# 整站编译打包
npm run build
```

打完包之后，本地启动后端开发环境

```
npm run s
```

 直接访问 http://127.0.0.1:7001 就可以访问前端编译后的页面了。**（注：在没有执行打包命令，后端开发环境访问页面都是上一次打包的版本）**

### 部署

使用纯 Node.js 或者 pm2 等工具部署，可以参考官方文档：https://www.yuque.com/midwayjs/midway_v2/deployment



ps:开发遇到问题的可以留言 565657400@qq.com

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