Skip to content

Commit 6388275

Browse files
SANGETSANGET
SANGET
authored and
SANGET
committed
添加 eslint,添加 CI 配置
1 parent 20d9392 commit 6388275

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__test__
2+
test
3+
assets

.eslintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": [
3+
"airbnb",
4+
"eslint:recommended"
5+
],
6+
"parser": "babel-eslint",
7+
"env": {
8+
"node": true,
9+
"es6": true
10+
},
11+
"rules": {
12+
"indent": ["error", 2],
13+
"semi": ["error", "always"],
14+
"no-unused-vars": [
15+
1,
16+
{
17+
"vars": "all", "args": "after-used", "ignoreRestSiblings": false
18+
}
19+
],
20+
"import/prefer-default-export": 0,
21+
"no-console": 0
22+
}
23+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ assets/zips
3838
assets/public/*
3939
assets/_admin/*
4040

41+
runtime/dynamic-routres/for-next
42+
4143
_none

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- 'node'
4+
install:
5+
- npm install
6+
script:
7+
- npm test

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# uke web server
22

3+
[![Build Status](https://travis-ci.org/SANGET/uke-web-server.svg?branch=master)](https://travis-ci.org/SANGET/uke-web-server)
4+
35
两层结构
46

57
- system 系统服务,可以开启新服务
@@ -67,7 +69,16 @@ npm start // 使用 nodemon
6769

6870
### 部署
6971

70-
TODO
72+
把项目压缩,然后 scp 到目标路径,解压并且 npm install,
73+
74+
```shell
75+
# 压缩目录,然后自行 scp 到目标目录,准备好 node 和 pm2 环境
76+
npm run zip
77+
78+
# 在部署服务器上
79+
npm i
80+
npm run deploy
81+
```
7182

7283
-----
7384

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@
1010
"start": "NODE_ENV=development nodemon --watch routers/ --watch system/ --watch dynamic-routres/ --exec npm run start:normal",
1111
"restartServer": "NODE_ENV=production pm2 restart uke-web-server",
1212
"zip": "sh ./zip.sh",
13-
"deploy": "NODE_ENV=production pm2 start ./system/app.js --name 'uke-web-server'"
13+
"deploy": "NODE_ENV=production pm2 start ./system/app.js --name 'uke-web-server'",
14+
"test": "mocha"
1415
},
1516
"repository": {
1617
"type": "git",
1718
"url": "git+https://github.com/SANGET/uke-web-server.git"
1819
},
1920
"devDependencies": {
2021
"@babel/preset-env": "^7.0.0",
22+
"babel-eslint": "^10.0.1",
2123
"debug": "^3.1.0",
24+
"eslint": "^5.6.1",
25+
"eslint-config-airbnb": "^17.1.0",
26+
"eslint-plugin-import": "^2.14.0",
27+
"eslint-plugin-node": "^7.0.1",
2228
"mocha": "^5.2.0",
2329
"nodemon": "^1.18.3"
2430
},

test/test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var assert = require('assert');
2+
3+
describe('Array', function() {
4+
describe('#indexOf()', function() {
5+
it('should return -1 when the value is not present', function() {
6+
assert.equal([1,2,3].indexOf(4), -1);
7+
});
8+
});
9+
});

0 commit comments

Comments
 (0)