diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..171e8a3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.gitignore +README.md +node_modules/ +dist/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ae5e241 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:carbon-alpine +WORKDIR /www +COPY . /www +VOLUME ./:/www +RUN npm install +CMD npm run build && npm start diff --git a/README.md b/README.md index 9f8ab26..08aa888 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

-> The node version of github-profile-summary which is inspired by tipsy' [github-profile-summary](https://github.com/tipsy/github-profile-summary) +> The node version of github-profile-summary which is inspired by tipsy's [github-profile-summary](https://github.com/tipsy/github-profile-summary) Site: https://gh-profile-summary.teamsz.xyz @@ -13,8 +13,7 @@ Site: https://gh-profile-summary.teamsz.xyz - Vue - Chart.js - Koa -- Github graphql api -- now.sh +- GitHub GraphQL API ## Screenshot @@ -22,13 +21,34 @@ Site: https://gh-profile-summary.teamsz.xyz ![](https://user-images.githubusercontent.com/12621342/35951697-89e3338e-0cb7-11e8-9986-dc258f257b97.png) -### Share system & Save your profile as Image +### Share system & save your profile as an image ![](https://user-images.githubusercontent.com/12621342/35951773-d1c9cf50-0cb7-11e8-80b2-08ae7d876533.png) +## Setup + +First, generate a token over at: https://github.com/settings/tokens + +Then you need to create a `.env` file in the project folder. + +The `.env` file looks like this: + +```env +GH_TOKEN = Your token here +JWT_SECRET = Any string +KOA_PORT = 8888 +HTTPS = false +``` + +> KOA_PORT can be any available port that you like. + +**If you set `HTTPS = true`, then the websocket will connect via port 443. This is particularly useful for https production.** + ## Local run -> You need to have node environment! +### Node.js + +> You need to have a node environment! ### Install @@ -38,38 +58,45 @@ cd node-github-profile-summary npm install # or yarn ``` -### Setup +### Run -First generate a token at https://github.com/settings/tokens +```bash +npm run build +npm start +``` -Then You need to create a `.env` file in the project folder. +**Notice:** `8888` is the `KOA_PORT` in the `.env` file. -The `.env` file looks like: +Access the application via: http://localhost:8888 -```env -GH_TOKEN=Your token here -JWT_SECRET=Any string -KOA_PORT=8888 -HTTPS=false -``` +Done. + +### Docker -> KOA_PORT can be any port you like which is available. +> You need to have a docker environment! -**If you set `HTTPS=true`, then the websocket will connect the 443 port, it's useful for https production.** +### Build + +```bash +docker build -t github-profile . +``` ### Run ```bash -npm run build -npm start +docker run -it --rm --name github-profile -p 8888:8888 github-profile ``` -And then open the link `http://localhost:8888`, Done. +**Notice:** `8888` is the `KOA_PORT` in the `.env` file. + +Access the application via: http://localhost:8888 + +Done. ## TODOS - More useful charts -- Docker support +- ~~Docker support~~ - ... @@ -77,6 +104,4 @@ And then open the link `http://localhost:8888`, Done. [MIT](http://opensource.org/licenses/MIT) -Copyright (c) 2018 Molunerfinn - - +Copyright (c) 2019 Molunerfinn diff --git a/now.json b/now.json index 4a67628..9e9da67 100644 --- a/now.json +++ b/now.json @@ -1,4 +1,5 @@ { + "version": 1, "env": { "GH_TOKEN": "@gh-summary-token", "JWT_SECRET": "@jwt-secret" diff --git a/package.json b/package.json index e4d5751..091f555 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "chalk": "^2.0.1", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.28.0", + "dotenv": "^5.0.1", "eslint": "^4.15.0", "eslint-config-standard": "^10.2.1", "eslint-friendly-formatter": "^3.0.0", diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 68a90f1..881fa24 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -333,7 +333,7 @@ export default { width calc(100% - 56px) word-wrap: break-word line-height: 20px - padding-left 4px + padding-right 4px &.small-text font-size 16px &-status diff --git a/yarn.lock b/yarn.lock index 5cfd362..a0d3dd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2282,6 +2282,10 @@ dotenv@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d" +dotenv@^5.0.1: + version "5.0.1" + resolved "http://registry.npm.taobao.org/dotenv/download/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef" + duplexer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"