thepracticaldev / 1pr

I will be accepting up to one pull request per day on this project.
BSD 2-Clause "Simplified" License
145 stars 44 forks source link

1pr

I will be accepting up to one pull request per day on this project.

View the result at thepracticaldev.github.io/1pr.

Build Status Gitter

Project Journal

How to contribute

Project structure

The project's structure is pretty simple.

Coding standards

When contributing, please try to follow the coding standards so we have nice looking code that's easy to follow for everyone.

Editorconfig

Where possible, use an editor (or a plugin for your editor) that supports editorconfig.

The editorconfig file should set your editor to the following settings automatically:

Tab width is not defined in the editorconfig, so each deveveloper can set their editor's tab width to what they're most comfortable with.

Furthermore

For Javascript specifically

Testing

The project contains the files .htmlhintrc, .csslintrc and .jshintrc with configuration for the respective testing utilities.

To install the testing utilities locally, simply install Node.js and then use npm (bundled with Node.js) to install the utilities:


npm install --global htmlhint csslint jshint

HTML validation

Run the HTML validator with:


htmlhint

CSS validation

Run the CSS validator with:


csslint stylesheets

JS validation

Run the Javascript validator with:


jshint scripts

Storing Data

1pr is backed by a Firebase database. This allows you to save and share data armed with just the knowledge of JSON rather than having to understand structuring a database or sql etc..

To set up a test database and add yourself as administrator:

  1. create a Firebase account and project

  2. replace the config details in scripts\database\config.js with the config details shown in the Firebase console

  3. copy the contents of scripts\database\firebase-rules.json into the database rules section of the console

    (Re-do this every time you pull new changes into your fork that change the rules file)

  4. under the authentication section of the console, enable GitHub authentication (follow the instructions there)

  5. (optionally add your github.io subdomain or other domains where you can access your site as an authorised OAuth redirect domain)

  6. serve your files

  7. navigate to your 1pr homepage

  8. click the sign in button in the sidebar to sign in with GitHub and generate a database account for yourself

  9. go to the users panel of the authentication section of the Firebase console and copy the uid for your newly-generated account

  10. go to the data panel of the database section and:

    1. add a node named admins as a child of the root node
    2. click the plus to add a sub-node
    3. copy your uid into the name of that sub-node and add a value of true
    4. click add to save the changes
  11. go back to your 1pr page and refresh.

  12. click the newly-visible Manage Web App link

  13. Click run migrations to apply all database changes to your Firebase database

    (Re-run this every time you pull new changes into your fork that change the database)

To develop with the database: