diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index cfce0f7..0000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -.git -logs -node_modules diff --git a/.jshintignore b/.eslintignore similarity index 100% rename from .jshintignore rename to .eslintignore diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..7bec680 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,8 @@ +{ + "extends": "eslint-config-egg", + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } + } +} \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 649e9bf..0000000 --- a/.jshintrc +++ /dev/null @@ -1,33 +0,0 @@ -{ - "indent": 2, - "latedef": "nofunc", - "newcap": true, - "curly": true, - "eqeqeq": true, - "eqnull": true, - "strict": true, - "undef": true, - "unused": true, - "laxcomma": false, - "asi": false, - "boss": false, - "expr": true, - "sub": true, - "quotmark": "single", - "loopfunc": false, - "lastsemic": true, - "funcscope": false, - "esnext": true, - "noyield": true, - "browser": true, - "nonstandard": true, - "devel": true, - "node": true, - "mocha": true, - "validthis": true, - "globals": { - "define": false - } -} - - diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 48052a9..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:4.2.1 - -WORKDIR / - -COPY . /feedit_server - -WORKDIR /feedit_server - -RUN npm install - -EXPOSE 8080 - -CMD ["./node_modules/.bin/pm2", "start deploy.json"] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 3e05571..0000000 --- a/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 xdf - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index 12efe1d..0000000 --- a/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -current_version = $$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') -npm_bin= $$(npm bin) - -all: test -clean: - @rm -rf ./node_modules -install: clean - @npm install -status: - @${npm_bin}/pm2 status -deploy: - @${npm_bin}/pm2 start deploy.json -docker: - @docker-compose up -jshint: - @${npm_bin}/jshint . -.PHONY: test diff --git a/deploy.json b/deploy.json deleted file mode 100644 index 844534a..0000000 --- a/deploy.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "apps": [{ - "name": "feedit_server", - "script": "index.js", - "args": [], - "exec_mode": "cluster", - "instances": 1, - "exec_interpreter": "node" - }] -} diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index c1e31d4..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,21 +0,0 @@ -feedit-master: - container_name: "feedit_master" - restart: "UNLESS-STOP" - image: feedit-master - links: - - mongo:mongo - environment: - - DB_SERVICE=mongo - - DB_PORT=27017 - - DB_NAME=feedit_dev - volumes: - - /etc/localtime:/etc/localtime:ro - command: bash -c "./node_modules/.bin/pm2 start deploy.json && ./node_modules/.bin/pm2 logs" - -mongo: - container_name: "feedit_mongo" - restart: always - image: mongo - volumes: - - /var/mongo/data/db:/data/db - - /etc/localtime:/etc/localtime:ro diff --git a/index.js b/index.js deleted file mode 100644 index 496a1d2..0000000 --- a/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var server = require('./lib/server'); - -server.init(); diff --git a/lib/logger.js b/lib/logger.js deleted file mode 100644 index 1b82bef..0000000 --- a/lib/logger.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -var logger = require('xlogger'); - -module.exports = logger.Logger({ - closeFile: true -}); diff --git a/package.json b/package.json index e5e8913..5adb74b 100644 --- a/package.json +++ b/package.json @@ -5,40 +5,44 @@ "keywords": [ "server" ], - "main": "index.js", "repository": { "type": "git", "url": "https://github.com/feedit/feedit_server.git" }, "dependencies": { - "co": "~3.1.0", - "co-body": "~1.1.0", - "koa": "~0.13.0", - "koa-logger": "~1.2.2", - "koa-qs": "~2.0.0", - "koa-router": "~3.7.0", - "koa-safe-jsonp": "~0.3.0", - "koa-session": "~3.0.0", - "koa-static": "~1.4.7", - "mongo-export": "~0.3.1", - "mongoose": "4.3.5", + "egg": "^2.0.0", + "egg-i18n": "^2.0.0", + "egg-scripts": "^2.4.0", + "egg-sequelize": "^4.1.0", "nunjucks": "^3.0.1", - "xlogger": "^1.0.5", - "xutil": "^1.0.2" + "xutil": "^1.0.2", + "sqlite3": "^4.0.2" }, "devDependencies": { - "co-mocha": "*", - "istanbul": "*", - "jshint": "*", - "pm2": "1.0.0" + "egg-bin": "^4.3.6", + "egg-ci": "^1.8.0", + "egg-mock": "^3.13.1", + "eslint": "^4.12.1", + "eslint-config-egg": "^5.1.1", + "husky": "^1.3.1" }, "scripts": { - "test": "make test", - "jshint": "make jshint" + "start": "npm run db:migrate && eggctl start --port=9200 --title=egg-server-datahub", + "stop": "eggctl stop --title=egg-server-datahub", + "dev": "npm run db:migrate && egg-bin dev", + "debug": "egg-bin debug", + "test": "npm run lint && npm run db:migrate && npm run test-local", + "test-local": "egg-bin test", + "cov": "npm run db:migrate && egg-bin cov", + "lint": "eslint . --fix", + "db:migrate": "sequelize db:migrate", + "db:migrate:undo": "sequelize db:migrate:undo", + "migration:create": "sequelize migration:create --name" + }, + "husky": { + "hooks": { + "pre-commit": "npm run lint" + } }, - "precommit": [ - "jshint" - ], - "homepage": "https://github.com/feedit/feedit_server", "license": "MIT" }