Explorar el Código

Gitbook Auto Published

Willin Wang hace 7 años
padre
commit
7ed658953e
Se han modificado 3 ficheros con 94 adiciones y 0 borrados
  1. 8 0
      README.md
  2. 1 0
      SUMMARY.md
  3. 85 0
      project/user/bdd.md

+ 8 - 0
README.md

@@ -20,3 +20,11 @@ gitbook serve
 ```bash
 gitbook build
 ```
+
+## License
+
+MIT
+
+通过支付宝捐赠:
+
+![qr](https://cloud.githubusercontent.com/assets/1890238/15489630/fccbb9cc-2193-11e6-9fed-b93c59d6ef37.png)

+ 1 - 0
SUMMARY.md

@@ -27,6 +27,7 @@
     - [功能模块设计](project/user/module.md)
     - [数据库设计](project/user/db.md)
     - [缓存设计](project/user/cache.md)
+    - [BDD实践](project/user/bdd.md)
 - [运维](operation/README.md)
   - [SHELL](operation/shell.md)
   - [CI工作流](operation/workflow.md)

+ 85 - 0
project/user/bdd.md

@@ -0,0 +1,85 @@
+# 行为驱动开发实践
+
+本实践项目源码: <https://coding.net/u/willin/p/bdd-practice/git>
+
+## 配置数据库
+
+开启MySQL和Redis服务。
+
+创建数据库 `bdd`。根据`数据库设计`章节创建`user`、`usermeta`两张表。
+
+## 初始化项目
+
+```bash
+git init
+npm init
+```
+
+### 安装ESLint和Babel环境
+
+```bash
+cnpm i --save-dev eslint babel-eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-react
+cnpm i --save babel-register babel-runtime babel-plugin-transform-runtime babel-preset-es2015 babel-preset-es2015-loose babel-preset-stage-1
+```
+
+Tree:
+
+```
+├── .babelrc
+├── .eslintignore
+├── .eslintrc.json
+├── .git
+├── .gitignore
+├── README.md
+├── node_modules
+└── package.json
+
+2 directories, 6 files
+```
+
+参考: <https://github.com/w2fs/best-practice>
+
+创建配置文件。
+
+### 配置ava、nyc
+
+```
+npm install ava nyc --save-dev
+./node_modules/.bin/ava --init
+```
+
+Package.json修改:
+
+```js
+"scripts": {
+  "test": "./node_modules/.bin/nyc ./node_modules/.bin/ava"
+},
+"nyc": {
+  "lines": 95,
+  "functions": 90,
+  "branches": 90,
+  "check-coverage": true,
+  "report-dir": "./.nyc_output",
+  "exclude": [
+    "node_modules",
+    "test",
+    "test{,-*}.js",
+    "**/*.test.js",
+    "**/__tests__/**"
+  ]
+},
+"ava": {
+  "files": [
+    "test/*.js",
+    "test/**/*.js",
+    "!**/_*/*.js",
+    "!**/_*.js"
+  ],
+  "require": [
+    "babel-register"
+  ],
+  "babel": "inherit"
+}
+```
+
+参考项目init代码:  <https://coding.net/u/willin/p/bdd-practice/git/commit/7d97a6cc763049bba38d3c711e0047b73deb42b8>