@@ -51,54 +51,76 @@ $ npm start # Compile and launch
51
51
| ------------------| -----------|
52
52
| ` start ` | 服务启动在3000端口,代码热替换开启。|
53
53
| ` compile ` | 编译程序到dist目录下(默认目录~ /dist)。|
54
- | ` dev ` | 与 ` npm start ` 相同, 但是启动nodemon守护进程。|
55
- | ` dev:no-debug ` | 与 ` npm run dev ` 但是禁用devtool(开发工具)。|
54
+ | ` dev ` | 与` npm start ` 相同, 但是启动nodemon守护进程。|
55
+ | ` dev:no-debug ` | 与` npm run dev ` 但是禁用devtool(开发工具)。|
56
56
| ` test ` | 开启Karam测试并生成覆盖率报告。|
57
57
| ` test:dev ` | 开启Karma测试并监听改变随时重新测试,但是生成覆盖率报告。|
58
58
| ` deploy ` | 启动代码检查,测试,如果成功,编译到dist目录下。|
59
- | ` deploy:dev ` | 与 ` deploy ` 相同,但是` NODE_ENV ` 值为 "development"。|
60
- | ` deploy:prod ` | 与 ` deploy ` 相同,但是` NODE_ENV ` 值为 "production"。|
59
+ | ` deploy:dev ` | 与` deploy ` 相同,但是` NODE_ENV ` 值为 "development"。|
60
+ | ` deploy:prod ` | 与` deploy ` 相同,但是` NODE_ENV ` 值为 "production"。|
61
61
| ` lint ` | 检查所有.js文件是否规范。|
62
62
| ` lint:fix ` | 检查所有.js文件是否规范并修复它们。 [ 更多] ( http://eslint.org/docs/user-guide/command-line-interface.html#fix ) .|
63
63
64
64
## 程序目录
65
65
66
+ 这个项目的结构使用的是** fractal** ,方法的分组主要是依照特性而不是文件类型。注意,这个目录结构只是一个指引,并不一定要按这个来。这种结构谐在让程序更容易扩展,想了解更多请[ 点击这里] ( https://github.com/justingreenberg ) 。
67
+
68
+
66
69
```
67
70
.
68
- ├── bin # Build/Start scripts
69
- ├── blueprints # Blueprint files for redux-cli
70
- ├── build # All build-related configuration
71
- │ └── webpack # Environment-specific configuration files for webpack
72
- ├── config # Project configuration settings
73
- ├── server # Koa application (uses webpack middleware )
74
- │ └── main.js # Server application entry point
75
- ├── src # Application source code
76
- │ ├── main.js # Application bootstrap and rendering
77
- │ ├── components # Reusable Presentational Components
78
- │ ├── containers # Reusable Container Components
79
- │ ├── layouts # Components that dictate major page structure
80
- │ ├── static # Static assets (not imported anywhere in source code )
81
- │ ├── styles # Application-wide styles (generally settings)
82
- │ ├── store # Redux-specific pieces
83
- │ │ ├── createStore.js # Create and instrument redux store
84
- │ │ └── reducers.js # Reducer registry and injection
85
- │ └── routes # Main route definitions and async split points
86
- │ ├── index.js # Bootstrap main application routes with store
87
- │ ├── Root.js # Wrapper component for context-aware providers
88
- │ └── Home # Fractal route
89
- │ ├── index.js # Route definitions and async split points
90
- │ ├── assets # Assets required to render components
91
- │ ├── components # Presentational React Components
92
- │ ├── container # Connect components to actions and store
93
- │ ├── modules # Collections of reducers/constants/actions
94
- │ └── routes ** # Fractal sub-routes (** optional )
95
- └── tests # Unit tests
71
+ ├── bin # 启动脚本
72
+ ├── blueprints # redux-cli的蓝图
73
+ ├── build # 所有打包配置项
74
+ │ └── webpack # webpack的指定环境配置文件
75
+ ├── config # 项目配置文件
76
+ ├── server # Koa 程序 (使用 webpack 中间件 )
77
+ │ └── main.js # 服务端程序入口文件
78
+ ├── src # 程序源文件
79
+ │ ├── main.js # 程序启动和渲染
80
+ │ ├── components # 可复用的直观组件( Presentational Components)
81
+ │ ├── containers # 可复用的容器组件
82
+ │ ├── layouts # 主页结构
83
+ │ ├── static # 静态文件(不要到处imported源文件 )
84
+ │ ├── styles # 程序样式
85
+ │ ├── store # Redux指定块
86
+ │ │ ├── createStore.js # 创建和使用redux store
87
+ │ │ └── reducers.js # Reducer注册和注入
88
+ │ └── routes # 主路由和异步分割点
89
+ │ ├── index.js # 用store启动主程序路由
90
+ │ ├── Root.js # 为上下文providers包住组件
91
+ │ └── Home # 不规则路由
92
+ │ ├── index.js # 路由定义和代码异步分割
93
+ │ ├── assets # 组件引入的静态资源
94
+ │ ├── components # 直观React组件
95
+ │ ├── container # 连接actions和store
96
+ │ ├── modules # reducers/constants/actions的集合
97
+ │ └── routes ** # 不规则子路由 (** 可选择的 )
98
+ └── tests # 单元测试
96
99
```
97
100
98
- ## Thank You
101
+ ## 样式
102
+
103
+ 所有的css和sass都支持[ CSS Modules] ( https://github.com/css-modules/css-modules ) 。只在被引入,都会经过[ PostCSS] ( https://github.com/postcss/postcss ) 压缩,加前缀。在生产环境下会提取到一个css文件下。
104
+
105
+ ## 服务端
106
+
107
+ 这个项目的服务端使用Koa。需要注意的是,只有一个目的那就是提供了` webpack-dev-middleware ` 和 ` webpack-hot-middleware ` (代码热替换)。使用自定义的Koa程序替换[ webpack-dev-server] ( https://github.com/webpack/webpack-dev-server ) ,让它更容易实现universal 渲染和为了不使这个包过于庞大。
99
108
100
- 如果没有社区的话,这个项目是不可能诞生的, 感谢所有为这个项目做出贡献的人
109
+ ## 打包优化
110
+
111
+ Babel被配置[ babel-plugin-transform-runtime] ( https://www.npmjs.com/package/babel-plugin-transform-runtime ) 可以让代码更优化。另外,在生产环境,我们使用[ react-optimize] ( https://github.com/thejameskyle/babel-react-optimize ) 来优化React代码。
112
+
113
+ 在生产环境下,webpack会导出一个css文件并压缩Javascript,并把js模块优化到最好的性能。
114
+
115
+ ## 谢谢大家
116
+
117
+ 如果没有大家的贡献,这个项目是不可能诞生的, 感谢所有为这个项目做出贡献的人
101
118
102
119
This program is inspired by [ davezuko] ( https://github.com/davezuko/react-redux-starter-kit )
103
120
121
+ * [ Justin Greenberg] ( https://github.com/justingreenberg ) - For all of your PR's, getting us to Babel 6, and constant work improving our patterns.
122
+ * [ Roman Pearah] ( https://github.com/neverfox ) - For your bug reports, help in triaging issues, and PR contributions.
123
+ * [ Spencer Dixin] ( https://github.com/SpencerCDixon ) - For your creation of [ redux-cli] ( https://github.com/SpencerCDixon/redux-cli ) .
124
+ * [ Jonas Matser] ( https://github.com/mtsr ) - For your help in triaging issues and unending support in our Gitter channel.
125
+
104
126
Thank you all the time
0 commit comments