1.1.6 • Published 3 years ago
@fch/fch-cli v1.1.6
fch-cli
起步
安装
npm i -g @fch/fch-cli
创建新项目
fch new|n [options] [name]
fch.json 务必保证当前的project是有的
{
"collection": "@fch/fch-react-schematic", -- 生成过程用的子schematics
"type": "web", -- 当前的项目类型 web 和 h5 暂时支持
"defaultSrcRoot": "/src/solution/", -- 最好不要更改当前的作用路径
"needRouter": [ -- 哪些生成命令需要额外添加路由注入
"c"
],
"needDto": [ -- 哪些生成命令需要同时生成dto文件
"s"
],
"baseUrl": { -- 设置service、dto文件夹所在路径
"service": "/src/solution/model/services",
"dto": "/src/solution/model/dto"
}
}
options 可选参数
-d
只能看到生成的目录结构和文件,不会真的生成文件-s
跳过安装node_modules
eg.
fch new my-project 可选h5 和 web
# OR
fch n my-project
使用
快速生成文件至当前目录
fch generate|g <schematic> [name]
schematic 可选参数
c
: 生成hooks组件fch g c <your-component-name>
rc
: 生成带有reducer的组件fch g rc <your-component-name>
s
: 生成请求的service文件fch g s <your-service-name>
d
: 生成相应dto文件fch g d <your-dto-name>
m
: 生成相应module模板文件fch g m <your-module-name>
table
: 生成相应component table模板文件fch g table <your-table-name>
modal
: 生成相应modal模板文件fch g modal <your-modal-name>
webpack功能
配置
在使用webpack打包构建功能的时候必须保证项目根目录中包含fch.json
和fch.webpack.config.js
,两个配置文件文件以及环境变量配置文件。
fch.json 中的
type
属性用于区分打包目标为web
还是h5
fch.webpack.config.js 用于配置用户自定义的webpack选项
目前只是开放了少数配置,后期陆续增加用户可修改的范围,如果用户不配置这个文件,那么webpack会根据预设的配置进行打包
- entry
- output
- publicPath
- filename
- path
- libary
- libaryTarget
- plugins
- html-webpack-plugin
const path = require('path')
module.exports = {
entry: {
index: './src/index.tsx',
indexSimple: './src/index.simple.tsx'
},
plugins: [
{
plugin: 'html-webpack-plugin',
option: {
template: process.argv[2] == '--build' ? path.resolve(__dirname, './public/index.html') : path.resolve(__dirname, './public/indexMap.html'),
title: '风控三期',
chunks: ['index']
}
},
{
plugin:'html-webpack-plugin',
option: {
filename: 'user-action-report-component.html',
template: path.resolve(__dirname, './public/index.simple.html'),
title: '今日用车报告',
chunks: ['indexSimple']
}
}
]
}
使用
在根目录的
package.json
中加入如下配置,然后执行。
"fch:start": "fch start",
"fch:build": "fch build"
1.1.6-5
3 years ago
1.1.6-4
3 years ago
1.1.6-3
3 years ago
1.1.6-2
3 years ago
1.1.6-1
3 years ago
1.1.6-0
3 years ago
1.1.6
3 years ago
1.1.5
3 years ago
1.1.4
3 years ago
1.1.0
3 years ago
1.1.3
3 years ago
1.1.2
3 years ago
1.1.2-1
3 years ago
1.1.2-0
3 years ago
1.0.20
4 years ago
1.0.19
4 years ago
1.0.18
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago