Coder Social home page Coder Social logo

paulodiovani / hacktoberrank Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 17.0 903 KB

Hacktoberfest Rank

Home Page: https://hacktoberrank-challenge.herokuapp.com/

License: MIT License

JavaScript 75.89% HTML 2.03% Vue 22.07%
hacktoberfest challenge nodejs vuejs rank

hacktoberrank's Introduction

Build Status

Hacktober Rank Challenge

Project Description

Hacktober Rank is a rank of participants of the Hacktoberfest. It fetches pull requests from github and list the users with most opened pull requests during the event period: October 1st to October 31.

The rank page lists the rank per year and allows to filter by location.

Contributing

Pull requests are welcome!!

It's a challenge about create a whole project, from beginning to end, should be done through pull requests from other users.

See issue #1 for more details.

Dependencies

  • nodejs >= 10.16.0
  • redis

Project setup

cp .env.example .env

npm install

npm start

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Lints and fixes files

npm run lint

Run your end-to-end tests

npm run test:e2e

Run your unit tests

npm run test:unit

Fetch pull requests script to update database with pull requests

You can run the script using nodejs or configure a cron to run it.

node ./backend/workers/fetch-pull-requests.js [startDate] [endDate]

or

npm run fetch-prs

Check:

hacktoberrank's People

Contributors

adarshlilha avatar arabyalhomsi avatar asagot-ansa avatar ffeliks avatar geektutor avatar hirohaji avatar kamaladenalhomsi avatar lldh avatar nolleto avatar paulodiovani avatar syl1405 avatar thauska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hacktoberrank's Issues

Add .npmrc with default npm registry

Some companies use a custom npm registry set at ~/.npmrc.

To prevent failures on npm install, let's add our own .npmrc to the project.
A simple registry line is enough.

registry=https://registry.npmjs.org/

Error: Cannot find module 'dotenv'

Problem description

Heroku install nod modules with --only=prod option, so it won't install devDependencies.
Since our dotenv is required at index.js, the server fail to load.

Error: Cannot find module 'dotenv'

Proposed solution

One of the options bellow:

  1. Move dotenv to dependencies or
  2. add a try {} catch block around it on backend/index.js

Serve the front-end from the back-end

If we publish to heroku, we need a single webserver, listening to $PORT.

So let's use express static feature to host the front-end build on dist/
Also...

  • change serve-backend script to start
  • add npm run build to prestart script

[Sticky] About Hacktober Rank Challenge

en_US:

@nolleto challenged me to create a whole project, from beginning to end, without writing a single line of code. All features should be done through pull requests from other users. I'm only allowed to:

  • Create issues
  • Comment on issues and pull requests
  • Suggest code improvements on pull requests
  • Write documentation: README, CONTRIBUTING, etc

The challenge will be achieved if it is a working project, published on a web host, on November 1st, 2019.

pr_BR:

@nolleto me desafiou a criar um projeto inteiro, do início ao fim, sem escrever uma única linha de código. Todas funcionalidades deverão ser realizadas através de pull requests de outros usuários. Eu posso apenas:

  • Criar issues
  • Comentar em issues e pull requests
  • Sugerir melhorias de códigos em pull requests
  • Escrever documentação: README, CONTRIBUTING, etc

O desafio será terminado com êxito se resultar num projeto funcional, publicado na internet, até 1º de Novembro de 2019.

Fetch github in a worker to update databse/cache

These issues must be done first:

  • #3 Bootstrat the project
  • #4 Fetch github PRs
  • #5 Add database

Create a worker to run once an hour to update our dabase/cache.

  • The worker must check for duplications and only add new pull requests to database.
  • All web server requests should, then, read from the database and not from the GitHub api.

Booststrap the project

Bootstrap the initial project, which shall include:

  • a working webserver
  • a landing page
  • a test suite (a single dumb passing test is enough)
  • a .gitignore to match the language and framework of choice

The language and framework could be any fairly popular language.
I suggest Ruby or Node.js which are the ones I'm more used to work and will ease my reviews.

Publish project website

Prerequisites

  • #3 must be done first
  • #30 must be done first

Tasks

  • Set everything required to run on the webserver of choice, including config files, replaces static content with environment variables, etc (e.g. app.json)
  • Add example config files (e.g. .env.example)
  • Add instructions to README on how to publish
  • Open a pull request with the changes
  • Publish the pull request branch on a server and add the link on the description

Heroku (http://heroku.com/) is a good choice and easy option.

Fix host and port for front-end

Describe the bug

We need to have a better control over env vars to allow the project to run on a web server.
In short, we need a way to inform the correct backend url.

Changes to do

Update src/api.js and set:

  • host to process.env.VUE_APP_DEFAULT_BACKEND_HOST || 'http://localhost'
  • port to process.env.VUE_APP_DEFAULT_BACKEND_PORT || 8001
  • axios.get(${host}:${port}/api/v1/pulls/${year})
  • add VUE_APP_DEFAULT_BACKEND_HOST to .env.example

Improve fix linter for CI

There are some changes we should do to improve our code lint.

  • do not fix linter errors or warnings
  • do not allow warnings
  • change no-console/no-debugger rules
  • prefer const when not reassign
  • lint tests/ folder as well
  • fix new issues fond

This can be achieved by adding or changing:

// in package.json
"lint": "vue-cli-service lint --no-fix --max-warnings 0 src/ backend/ tests/"
// in .eslintrc.js
rules: {
  'no-console': 'warn',
  'no-debugger': 'warn',
  'prefer-const': 'error',
},

Write README

Add a README describing the project intention and challenge.

Note: See other issues for details.

Remove [bot]s from results

We don't want to list bots in the rank, which usually create auto pull requests to upgrade forks from upstream branches or from repositories outside github.

  • Filter out any username that has a [bot] suffix
    The easiest way is to just add a .filter to the results we get from redis.

    Alternatively, we could filter when fetching from github and not save on redis at all. For this option, check if github search api allows to exclude bots from results or to add an exclude filter for the search.

Enable HTTPS

The current backend works only with HTTP.
We must update to allow https as well.

Note: Heroku won't work without this.

I'm not 100% sure, this is needed.
Heroku should be able to forward https requests to an http backend.

Still researching.

Fetch and list github pull requests

  • #3 must be done first.

Use Github Search API (https://developer.github.com/v3/search/#search-issues-and-pull-requests) to fetch pull requests in the selected period.

The search should filter by date, from October 1st to October 31 for the selected year (it can be fixed to 2019 for start) and group by user. Then sort the results in descending order (more contrubutions to less).

Note that github api has a query limit. Try to get the results in a single request.

Details for searching issues and pull request can be found at https://help.github.com/en/articles/searching-issues-and-pull-requests

Styles improvement

It would be nice to have a new style front-end part.
We had some unfinished work on the following PRs that could be a good start:

Related to #8

Add a simple database to the back-end

  • #3 must be done first

Database will be, for start, just a long-term cache to prevent fetch from github api all the time. Redis would be good enough but we could also use Postgress or MongoDB as alternative.

The database should keep a cache of contributions per user and links to pull requests.
We can simple store username alongside pull request link to allow search/filter/group by user.

Suggested schema:

user: String (github username)
project: String (project name)
pull_request: String (pull request link)

Make front-end pretty

  • #3 must be done first

Add styles to make the front-end landing page pretty.

Optionally add your preferred CSS Framework (Bootstrap, Foundation, Miligram, Bulma...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.