@cyber.insight/cyber-scripts v1.0.2
项目简介
提供命令行工具
cyber-scripts
cyber-scripts --help
获取帮助cyber-scripts create PROJECT_NAME
创建 react 前端微服务主应用模板项目代码cyber-scripts create --sub PROJECT_NAME
创建 react 前端微服务子应用模板项目代码提供全局的 webpack 配置文件,在模板项目里面通过安装 cyber-scripts 来实现
使用
1, 全局安装
yarn global add @cyberinsight/cyber-scripts
npm install -g @cyberinsight/cyber-scripts
3, 创建模板项目
cyber-scripts create PROJECT_NAME
或者
cyber-scripts create --sub PROJECT_NAME
4, 在项目根目录下安装依赖包
yarn
cyber-scripts 版本管理和发布
每次发布 cyber-scripts 的时候,需要首先将 package.json 里面的 version 版本号升级, 然后执行下面的命令。
npm publish
关于 eslint-plugin-react-hooks
eslint-plugin-react-hooks 被默认开启。
在使用 useEffect 的过程中,如果设计不好,exhaustive-deps 规则很有可能引入不必要的依赖,例如 props。
为了解决以上问题,请参考 reactJs 和 redux 的作者之一 Dan Abramov 详解 useEffect 的文章 A Complete Guide to useEffect 以及 reactJs 官方文档
关于 vendor
我们的基础架构会将不常更改的三方库,例如 react、react-dom、redux、antd 等(配置scripts/vendor.js
),打包到 vendor 目录中。
需要注意的是,vendor 是由版本号控制(config.js
中的 vendorVersion)的。每次修改scripts/vendor.js
中的三方包,都需要将版本号+1,然后发现新一版的 cyber-scripts。
在产品功能发布中,一个 vendor 版本号只能被构建一次,不允许重复使用一个版本号进行多次构建。
没有特殊情况,不要私自向 package.json 中添加三方依赖。
cyber-scripts
├─ Dockerfile
├─ Jenkinsfile
├─ babel-plugin-icon
│ ├─ README
│ ├─ demo
│ │ ├─ .babelrc
│ │ └─ index.js
│ ├─ generateIconComponent.js
│ └─ plugin.js
├─ bin
│ ├─ create-cyber-app.js
│ └─ index.js
├─ config.js
├─ jenkins.js
├─ mysite.template
├─ package.json
├─ scripts
│ ├─ autoConfig.js
│ ├─ babel.js
│ ├─ build.js
│ ├─ copy.js
│ ├─ deploy.js
│ ├─ lint.js
│ ├─ prettier.js
│ ├─ start.js
│ ├─ utils.js
│ └─ vendor.js
├─ templates
│ ├─ cyber-react-mfe-main
│ │ ├─ Dockerfile
│ │ ├─ Jenkinsfile
│ │ ├─ README.md
│ │ ├─ config.js
│ │ ├─ favicon.ico
│ │ ├─ index.html
│ │ ├─ jenkins.js
│ │ ├─ jsconfig.json
│ │ ├─ mysite.template
│ │ ├─ package.json
│ │ ├─ src
│ │ │ ├─ actions
│ │ │ │ ├─ App
│ │ │ │ │ └─ app.js
│ │ │ │ ├─ Common
│ │ │ │ │ └─ index.js
│ │ │ │ ├─ Login
│ │ │ │ │ └─ login.js
│ │ │ │ └─ Main
│ │ │ │ └─ index.js
│ │ │ ├─ apps
│ │ │ │ ├─ register.js
│ │ │ │ └─ utils.js
│ │ │ ├─ components
│ │ │ │ ├─ ErrorBoundary
│ │ │ │ │ ├─ index.jsx
│ │ │ │ │ └─ index.less
│ │ │ │ ├─ Header
│ │ │ │ │ ├─ index.jsx
│ │ │ │ │ └─ index.less
│ │ │ │ └─ Loading
│ │ │ │ ├─ index.jsx
│ │ │ │ └─ index.less
│ │ │ ├─ conf
│ │ │ │ └─ config.js
│ │ │ ├─ images
│ │ │ │ ├─ __generated__
│ │ │ │ │ ├─ SheBeiGaiLanIcon.jsx
│ │ │ │ │ ├─ XiTongGuanLiIcon.jsx
│ │ │ │ │ ├─ ZhanKaiShouQiIcon.jsx
│ │ │ │ │ └─ ZhiNengJianKongIcon.jsx
│ │ │ │ ├─ error-page.svg
│ │ │ │ ├─ login_bg.png
│ │ │ │ ├─ login_title_bg.png
│ │ │ │ └─ logo.png
│ │ │ ├─ index.jsx
│ │ │ ├─ index.less
│ │ │ ├─ middlewares
│ │ │ │ ├─ error.js
│ │ │ │ ├─ loading.js
│ │ │ │ ├─ promise.js
│ │ │ │ └─ thunk.js
│ │ │ ├─ reducers
│ │ │ │ ├─ App
│ │ │ │ │ └─ app.js
│ │ │ │ ├─ Common
│ │ │ │ │ └─ index.js
│ │ │ │ ├─ Login
│ │ │ │ │ └─ login.js
│ │ │ │ └─ Main
│ │ │ │ └─ index.js
│ │ │ ├─ router.jsx
│ │ │ ├─ store.js
│ │ │ ├─ styles
│ │ │ │ ├─ color.less
│ │ │ │ ├─ font.less
│ │ │ │ ├─ layout.less
│ │ │ │ ├─ theme.less
│ │ │ │ ├─ themes
│ │ │ │ │ ├─ dark.less
│ │ │ │ │ └─ light.less
│ │ │ │ └─ variables.less
│ │ │ ├─ utils
│ │ │ │ ├─ api.js
│ │ │ │ ├─ common.js
│ │ │ │ ├─ injectReducer.js
│ │ │ │ ├─ query-string.js
│ │ │ │ ├─ storage.js
│ │ │ │ ├─ validate.js
│ │ │ │ └─ websocket.js
│ │ │ └─ views
│ │ │ ├─ App
│ │ │ │ ├─ Side
│ │ │ │ │ ├─ SideMenu.jsx
│ │ │ │ │ ├─ SideMenu.less
│ │ │ │ │ ├─ index.jsx
│ │ │ │ │ └─ index.less
│ │ │ │ ├─ app.jsx
│ │ │ │ ├─ app.less
│ │ │ │ └─ routes.jsx
│ │ │ ├─ Login
│ │ │ │ ├─ login.jsx
│ │ │ │ └─ login.less
│ │ │ └─ Main
│ │ │ ├─ home.jsx
│ │ │ ├─ home.less
│ │ │ └─ index.jsx
│ │ └─ static
│ │ └─ README.md
│ └─ cyber-react-mfe-sub
│ ├─ README.md
│ ├─ config.js
│ ├─ favicon.ico
│ ├─ index.html
│ ├─ jsconfig.json
│ ├─ package.json
│ ├─ src
│ │ ├─ actions
│ │ │ ├─ App
│ │ │ │ └─ app.js
│ │ │ ├─ Common
│ │ │ │ └─ index.js
│ │ │ └─ Main
│ │ │ └─ index.js
│ │ ├─ components
│ │ │ └─ Loading
│ │ │ ├─ index.jsx
│ │ │ └─ index.less
│ │ ├─ conf
│ │ │ └─ config.js
│ │ ├─ images
│ │ │ ├─ Exit_icon.png
│ │ │ ├─ admin_icon.png
│ │ │ ├─ change_Password_icon.png
│ │ │ ├─ delete_icon.png
│ │ │ ├─ enterprise_icon.png
│ │ │ ├─ export_icon.png
│ │ │ ├─ icons
│ │ │ │ ├─ iconfont.css
│ │ │ │ ├─ iconfont.eot
│ │ │ │ ├─ iconfont.less
│ │ │ │ ├─ iconfont.svg
│ │ │ │ ├─ iconfont.ttf
│ │ │ │ └─ iconfont.woff
│ │ │ ├─ login_bg.png
│ │ │ ├─ login_title_bg.png
│ │ │ ├─ logo.png
│ │ │ ├─ reset_password_icon.png
│ │ │ ├─ user_management_icon16.png
│ │ │ ├─ user_management_icon24.png
│ │ │ ├─ warning_red_icon.png
│ │ │ └─ warning_yellow_icon.png
│ │ ├─ index.jsx
│ │ ├─ middlewares
│ │ │ ├─ error.js
│ │ │ ├─ loading.js
│ │ │ ├─ promise.js
│ │ │ └─ thunk.js
│ │ ├─ reducers
│ │ │ ├─ App
│ │ │ │ └─ app.js
│ │ │ ├─ Common
│ │ │ │ └─ index.js
│ │ │ └─ Main
│ │ │ └─ index.js
│ │ ├─ router.jsx
│ │ ├─ store.js
│ │ ├─ utils
│ │ │ ├─ api.js
│ │ │ ├─ cef-query.js
│ │ │ ├─ eventBus.js
│ │ │ ├─ hybrid-console.js
│ │ │ ├─ injectReducer.js
│ │ │ ├─ mock-data.js
│ │ │ ├─ query-string.js
│ │ │ ├─ storage.js
│ │ │ ├─ validate.js
│ │ │ └─ websocket.js
│ │ └─ views
│ │ ├─ App
│ │ │ ├─ app.jsx
│ │ │ └─ app.less
│ │ ├─ Common
│ │ │ ├─ header.jsx
│ │ │ ├─ header.less
│ │ │ ├─ logo.svg
│ │ │ ├─ menu-tree.jsx
│ │ │ └─ menu-tree.less
│ │ └─ Main
│ │ ├─ home.jsx
│ │ ├─ home.less
│ │ ├─ index.jsx
│ │ ├─ operator-detail.jsx
│ │ ├─ operator-detail.less
│ │ ├─ operator-list.jsx
│ │ └─ operator-list.less
│ └─ static
│ └─ README.md
├─ vendor
│ ├─ 1.0.2
│ │ ├─ dev
│ │ │ ├─ manifest-1.0.2.json
│ │ │ └─ vendor-1.0.2.js
│ │ └─ prod
│ │ ├─ manifest.min-1.0.2.json
│ │ └─ vendor.min-1.0.2.js
│ ├─ 1.0.3
│ │ ├─ dev
│ │ │ ├─ manifest-1.0.3.json
│ │ │ └─ vendor-1.0.3.js
│ │ └─ prod
│ │ ├─ manifest.min-1.0.3.json
│ │ └─ vendor.min-1.0.3.js
│ ├─ 1.0.4
│ │ ├─ dev
│ │ │ ├─ manifest-1.0.4.json
│ │ │ └─ vendor-1.0.4.js
│ │ └─ prod
│ │ ├─ manifest.min-1.0.4.json
│ │ └─ vendor.min-1.0.4.js
│ └─ 1.0.5
│ ├─ dev
│ │ ├─ manifest-1.0.5.json
│ │ └─ vendor-1.0.5.js
│ └─ prod
│ ├─ manifest.min-1.0.5.json
│ └─ vendor.min-1.0.5.js
└─ yarn.lock