0.2.5 • Published 4 years ago
@lanten233/react-ts-cli v0.2.5
react-ts-cli
命令行工具
命令 | 说明 | 参数 |
---|---|---|
react-ts-dev | 启动本地服务 | ...env |
react-ts-build | 执行编译脚本 | ...env |
配置
创建 config/index.ts
文件
chestnut:
import path from 'path'
import { ReactTsConfigPartial } from '@sbc-fe/react-ts-cli'
const rootPath = process.cwd()
const projectName = 'new-project'
const projectTitle = 'New Project'
const config: ReactTsConfigPartial = {
projectName,
projectTitle,
port: 18081,
htmlTemplate: path.resolve(rootPath, 'src/index.html'),
devPublicPath: '',
entry: {
app: path.resolve(rootPath, 'src/index.tsx'),
},
}
export default config
创建 config/tsconfig.json
文件
chestnut:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"sourceMap": false,
"strict": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"suppressImplicitAnyIndexErrors": true,
"types": [
"node"
],
"lib": [
"esnext",
"scripthost",
"es5"
]
},
"exclude": [
"node_modules",
]
}
项目更目录需要添加 tsconfig.json
文件.
此外,请按需添加 .eslintignore
, .eslintrc.js
, .browserslistrc
文件.
使用
启动 dev-server:
react-ts-dev
编译:
react-ts-build
脚本将自动读取 config
下的配置文件
整合了 cross-env
, 可以直接添加环境变量:
react-ts-dev MY_ENV=xxx
react-ts-build MY_ENV=xxx
0.2.5
4 years ago
0.2.4
4 years ago
0.2.3
4 years ago
0.2.2
4 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.9
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago