build: better ci process and git hook (#157)

* build: remove git hook

* build(lint): add prettier check to lint

* build(ci): new github page deploy process

* build(git): add git hook
This commit is contained in:
EEEEEEYHN
2018-05-18 22:02:24 +08:00
committed by DIYgod
parent d8a369e06b
commit 59c0329d1a
3 changed files with 34 additions and 27 deletions
+10 -13
View File
@@ -2,27 +2,24 @@ language: node_js
node_js: stable
before_install:
install:
- yarn
script:
- npm run lint
before_deploy:
- npm run docs:build
- cd docs/.vuepress/dist
- echo 'rsshub.js.org' > CNAME
after_script:
- |
if git diff --name-only $TRAVIS_COMMIT_RANGE | grep '^docs/'
then
git init
git config user.name "Travis CI"
git config user.email "no-reply@html.love"
git add -A
git commit -m 'deploy'
git push -f "https://${GH_TOKEN}@github.com/DIYgod/RSSHub.git" master:gh-pages
fi
deploy:
provider: pages
skip-cleanup: true
github-token: $GH_TOKEN
local-dir: docs/.vuepress/dist
on:
branch: master
cache:
yarn: true
+6 -14
View File
@@ -7,20 +7,8 @@
"start": "node index.js",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"format": "prettier \"**/*.{js,json,md}\" --write"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
],
"*.{js,json,md}": [
"prettier --write",
"git add"
]
"format": "prettier \"**/*.{js,json,md}\" --write",
"lint": "eslint \"**/*.js\" && prettier-check \"**/*.{js,json,md}\""
},
"repository": {
"type": "git",
@@ -29,6 +17,9 @@
"keywords": [
"RSS"
],
"gitHooks": {
"pre-commit": "npm run lint"
},
"author": "DIYgod",
"license": "MIT",
"bugs": {
@@ -41,6 +32,7 @@
"eslint-plugin-prettier": "^2.6.0",
"lint-staged": "^7.1.0",
"prettier": "^1.12.1",
"prettier-check": "^2.0.0",
"vuepress": "0.8.4",
"yorkie": "^1.0.3"
},
+18
View File
@@ -2018,6 +2018,18 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
md5.js "^1.3.4"
safe-buffer "^5.1.1"
execa@^0.6.0:
version "0.6.3"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.6.3.tgz#57b69a594f081759c69e5370f0d17b9cb11658fe"
dependencies:
cross-spawn "^5.0.1"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"
execa@^0.7.0:
version "0.7.0"
resolved "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
@@ -5092,6 +5104,12 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
prettier-check@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/prettier-check/-/prettier-check-2.0.0.tgz#edd086ee12d270579233ccb136a16e6afcfba1ae"
dependencies:
execa "^0.6.0"
prettier@^1.11.1, prettier@^1.12.1:
version "1.12.1"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.12.1.tgz#c1ad20e803e7749faf905a409d2367e06bbe7325"