baidu-acu-react-tools
百度智能云AI团队react工具集
Last updated 2 months ago by tonyjeffrey .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install baidu-acu-react-tools 
SYNC missed versions from official npm registry.

baidu-acu-react-tools

基于react与antd等技术栈的命令行工具集合。本工具目标整合DevServer、Webpack、Build、Lint、Test、Babel等一系列功能,使产品线不再重复性地维护复杂的配置文件及相关脚本。

配置规则

使用该工具,大部分配置已经使用webpack和react社区默认做法,不需要额外处理。但是每个项目依然可以根据实际需要作出一些定制化,配置有两个入口, 都放在项目根目录下,分别是reactTools.config.js 和 private.json

  • 配置整个项目: reactTools.config.js
  • 配置单个私有化项目的分发版本

设计上,private.json的优先级高于 reactTools.config.js。

在 projectHelper文件中的getBizToolsAndPrivateConfig方法中,tools将试图读取两部分的配置,并且合并成为最终版配置。如果新添加了字段,需要在tools的脚本运行时生效,需要在getBizToolsAndPrivateConfig中处理合并逻辑,并且在相关脚本中读取变量并操作。

配置规则之 reactTools.config

该配置是为了处理整个项目级别的配置。大多数情况下作为公版发布。

const {join} = require('path');
const i18n = require('@baiducloud/i18n/transform-plugin');

const context = __dirname;

module.exports = {
    context: context,
    module: 'starter', // 必填项:模块简写,注意使用这套框架的module必须唯一 当前已被占starter、bml
    privateDeploy: true, // 选填项:如果设置为false,且cdnUrl和BOSConfig存在,才使用cdn地址
    build: {
        title: '数字人监控平台', // 项目title
        entry: join(context, 'src/main.js'), // entry文件
        output: join(context, 'dist'), // 产出的位置
        htmlTarget: join(context, 'public/index.html'), // html入口配置
        publicPath: '/',
        distSourceFolderName: 'static', // 输出中存放js、css及img资源的文件夹名字
        toolsPath: 'tools', // tools文件夹名字
        port: 3000, // node服务端口
        consoleHub: false, // 选填项:默认为false,设为true且构建命令--console=bce产出极简命名[id].[chunHash:8].(css|js)
        inlineSourceRegx: false, // 是否开启inlineSource模式,亦可传入匹配规则如.(js|css)$匹配inline资源
        splitChunksConfig: { // 重定义splitChunks配置
            minSize: 2500000,
            maxSize: 3000000,
            additionCacheGroups: [{ // 自定义打包模块组
                name: 'monaco',
                priority: 60,
                modules: ['monaco-editor']
            }]
        },
        additionPlugins: [
            new MonacoWebpackPlugin({
                languages: ['javascript', 'sql', 'python', 'json']
            })
        ],
        additionBabelConfig: { // 业务用babel扩展配置
            plugins: [
                [i18n.react, {
                    library: '@baiducloud/i18n',
                    output: 'dist/i18n'
                }]
            ]
        },
        externals: {
            '@baiducloud/i18n': 'i18n' // 为i18n提供一个全局变量,而不引入@baiducloud/i18n
        }
    },
    mockServer: {
        // mockProxyTarget: 'http://1.1.1.1:8080/', // mock代理服务地址(包括端口)
        port: 3001 // mockup服务端口
    }
};

配置规则之 private.json

该配置是为了处理单个私有化项目级别的配置。大多数情况下作为特定私有化版本发布。需要将enabled设置为true才能生效。

{
    "enabled": false,
    "company": "pufa",
    "distSourceFolderName": "console",
    "moreParam": "bbbb"
}

使用案例

在某一个私有化产品中,比如有XX管理平台,需要分发给n个客户。 所有客户公用的配置,都写到reactTools.config之中,默认不要开启private.json。 A客户的项目如果有定制化的需求,比如项目名称,构建产物打包路径需要定制化,可以开启private.json 中的 enabled,设置其他变量,提交合入代码之后,icode上新的构建产物即可满足需要。 B客户需要用公版,只需要把enable字段改为false,提交代码合入之后,便能得到公版构建产物。这样对于同样一套业务代码,可以灵活的配置不同的私有化配置,部署诉求。

Current Tags

  • 2.6.8                                ...           latest (2 months ago)

124 Versions

  • 2.6.8                                ...           2 months ago
  • 2.6.7                                ...           2 months ago
  • 2.6.6                                ...           2 months ago
  • 2.6.5                                ...           2 months ago
  • 2.6.4                                ...           2 months ago
  • 2.6.3                                ...           2 months ago
  • 2.6.2                                ...           2 months ago
  • 2.6.1                                ...           2 months ago
  • 2.6.0                                ...           2 months ago
  • 2.5.2                                ...           3 months ago
  • 2.5.1                                ...           3 months ago
  • 2.5.0                                ...           3 months ago
  • 2.4.8                                ...           3 months ago
  • 2.4.7                                ...           3 months ago
  • 2.4.6                                ...           3 months ago
  • 2.4.5                                ...           3 months ago
  • 2.4.4                                ...           3 months ago
  • 2.4.3                                ...           3 months ago
  • 2.4.2                                ...           3 months ago
  • 2.4.1                                ...           3 months ago
  • 2.4.0                                ...           3 months ago
  • 2.3.3                                ...           4 months ago
  • 2.3.2                                ...           4 months ago
  • 2.3.1                                ...           4 months ago
  • 2.3.0                                ...           4 months ago
  • 2.2.2                                ...           5 months ago
  • 2.2.1                                ...           5 months ago
  • 2.2.0                                ...           5 months ago
  • 2.1.5                                ...           5 months ago
  • 2.1.4                                ...           6 months ago
  • 2.1.3                                ...           6 months ago
  • 2.1.2                                ...           6 months ago
  • 2.1.1                                ...           6 months ago
  • 2.1.0                                ...           6 months ago
  • 2.0.1                                ...           7 months ago
  • 2.0.0                                ...           7 months ago
  • 1.9.3                                ...           7 months ago
  • 1.9.2                                ...           7 months ago
  • 1.9.1                                ...           7 months ago
  • 1.9.0                                ...           7 months ago
  • 1.8.2                                ...           7 months ago
  • 1.8.1                                ...           7 months ago
  • 1.8.0                                ...           7 months ago
  • 1.7.3                                ...           8 months ago
  • 1.7.2                                ...           8 months ago
  • 1.7.1                                ...           8 months ago
  • 1.7.0                                ...           8 months ago
  • 1.6.10                                ...           9 months ago
  • 1.6.9                                ...           9 months ago
  • 1.6.8                                ...           9 months ago
  • 1.6.7                                ...           9 months ago
  • 1.6.6                                ...           9 months ago
  • 1.6.5                                ...           9 months ago
  • 1.6.4                                ...           9 months ago
  • 1.6.3                                ...           10 months ago
  • 1.6.2                                ...           10 months ago
  • 1.6.1                                ...           10 months ago
  • 1.6.0                                ...           10 months ago
  • 1.5.4                                ...           10 months ago
  • 1.5.3                                ...           10 months ago
  • 1.5.2                                ...           10 months ago
  • 1.5.1                                ...           10 months ago
  • 1.5.0                                ...           10 months ago
  • 1.4.4                                ...           10 months ago
  • 1.4.3                                ...           10 months ago
  • 1.4.2                                ...           10 months ago
  • 1.4.1                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.3.1                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.9                                ...           a year ago
  • 1.2.8                                ...           a year ago
  • 1.2.7                                ...           a year ago
  • 1.2.6                                ...           a year ago
  • 1.2.5                                ...           a year ago
  • 1.2.4                                ...           a year ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.17                                ...           a year ago
  • 1.1.16                                ...           a year ago
  • 1.1.15                                ...           a year ago
  • 1.1.14                                ...           a year ago
  • 1.1.13                                ...           a year ago
  • 1.1.12                                ...           a year ago
  • 1.1.11                                ...           a year ago
  • 1.1.10                                ...           a year ago
  • 1.1.9                                ...           a year ago
  • 1.1.8                                ...           a year ago
  • 1.1.7                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.0.19                                ...           a year ago
  • 0.0.18                                ...           a year ago
  • 0.0.17                                ...           a year ago
  • 0.0.16                                ...           a year ago
  • 0.0.15                                ...           a year ago
  • 0.0.14                                ...           a year ago
  • 0.0.13                                ...           a year ago
  • 0.0.12                                ...           a year ago
  • 0.0.11                                ...           a year ago
  • 0.0.10                                ...           a year ago
  • 0.0.9                                ...           a year ago
  • 0.0.8                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 4
Dependencies (96)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |