Web editor for P5.js, modified for workshops at Digital Playground.
Go to file
Cassie Tarakajian 001abce896 add license 2017-10-15 22:36:46 -07:00
client update highlighted line styles 2017-10-12 17:13:27 -04:00
server fix lingering linting errors 2017-10-15 20:27:05 -07:00
static update p5-interceptor 2017-09-06 11:56:32 -04:00
.babelrc change dev/production babel configuration 2016-07-22 13:14:26 -04:00
.eslintignore start to add eslint, add repository to package.json 2016-06-22 19:59:12 -04:00
.eslintrc start to make nav accessible 2017-09-14 14:52:40 -04:00
.gitignore FINALLY fix #52, this will not work with redirecting to https when authenticating but we will cross that bridge when we get there 2016-11-29 15:51:16 -05:00
.gitmodules Move the interceptor code to a git module (#200) 2016-11-23 13:35:12 -05:00
.travis.yml add travis ci integration 2017-10-15 20:36:19 -07:00
CODE_OF_CONDUCT.md create contributing guide, move code of conduct to separate file, add issue template 2017-10-15 22:04:56 -07:00
ISSUE_TEMPLATE.md create contributing guide, move code of conduct to separate file, add issue template 2017-10-15 22:04:56 -07:00
LICENSE add license 2017-10-15 22:36:46 -07:00
PULL_REQUEST_TEMPLATE.md add pull request template 2017-10-15 22:14:12 -07:00
README.md create contributing guide, move code of conduct to separate file, add issue template 2017-10-15 22:04:56 -07:00
backup.sh update instructions for backup.sh 2016-11-16 14:52:27 -05:00
contributing.md create contributing guide, move code of conduct to separate file, add issue template 2017-10-15 22:04:56 -07:00
ecosystem.json update pm2 to use clusering mode 2017-04-07 00:01:58 -04:00
fetch-examples.js Fetch examples from p5 website repo (#203) 2016-12-01 18:57:50 -05:00
index.html #142 add webpack configuration to decrease loading speed 2016-11-08 18:11:12 -05:00
index.js #142 add webpack configuration to decrease loading speed 2016-11-08 18:11:12 -05:00
nodemon.json add nodemon, remove .env from being tracked 2016-06-22 18:48:45 -04:00
package.json add travis ci integration 2017-10-15 20:36:19 -07:00
webpack.config.dev.js Fix CSS loader + Improve visual for code folding 2017-07-18 15:57:40 -04:00
webpack.config.prod.js enable sourcemap 2017-05-18 17:41:25 -04:00

README.md

p5.js Web Editor

This project is currently in development! It will be announced when there is a (public) beta release.

Development Installation

  1. Fork this repository.
  2. Clone the forked repostory and cd into it
  3. $ git submodule init
  4. $ npm install
  5. Install MongoDB and make sure it is running
  6. Create a file called .env in the root of this directory that looks like
API_URL=/api
MONGO_URL=mongodb://localhost:27017/p5js-web-editor
PORT=8000
SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production
AWS_ACCESS_KEY=<your-aws-access-key>
AWS_SECRET_KEY=<your-aws-secret-key>
AWS_REGION=<your-aws-region>
S3_BUCKET=<your-s3-bucket>
GITHUB_ID=<your-github-client-id>
GITHUB_SECRET=<your-github-client-secret>

If you don't care about being able to upload media files to S3 or Login with Github, you can drop in the file exactly how it is. Or, if you don't want to do that, just ask me to send you mine. Refer to this gist for creating an S3 bucket for testing, or if you don't want to do that, I can add you to one of my S3 buckets.

  1. $ npm run fetch-examples - this downloads the example sketches into a user called 'p5'
  2. $ npm start
  3. Navigate to http://localhost:8000 in your browser
  4. Install the React Developer Tools.
  5. Open and close the Redux DevTools using ctrl+h, and move them with ctrl+w

Testing SSL on your local machine

Please refer to this gist. This allows you to access the editor using both HTTP and HTTPS. Don't worry about this unless you need to make changes or test HTTPS behavior.

The automatic redirection to HTTPS is turned off by default in development. If you need to test this behavior, put FORCE_TO_HTTPS=true in your .env file.

Production Installation

  1. Clone this repostory and cd into it
  2. $ git submodule init
  3. $ npm install
  4. Install MongoDB and make sure it is running
  5. Create a file called .env in the root of this directory that looks like
API_URL=/api
MONGO_URL=mongodb://localhost:27017/p5js-web-editor
PORT=8000
SESSION_SECRET=make_this_a_long-random_string_like_maybe_126_characters_long
AWS_ACCESS_KEY=<your-aws-access-key>
AWS_SECRET_KEY=<your-aws-secret-key>
AWS_REGION=<your-aws-region>
S3_BUCKET=<your-s3-bucket>
GITHUB_ID=<your-github-client-id>
GITHUB_SECRET=<your-github-client-secret>
EMAIL_SENDER=<email-address-to-send-from>
MAILGUN_KEY=<mailgun-api-key>
MAILGUN_DOMAIN=<mailgun-domain>
EMAIL_VERIFY_SECRET_TOKEN=whatever_you_want_this_to_be_it_only_matters_for_production

For production, you will need to have real Github and Amazon credentions. Refer to this gist for creating an S3 bucket for testing.

  1. $ npm run fetch-examples - this downloads the example sketches into a user called 'p5'
  2. $ npm run build
  3. $ npm run start:prod

For Production Setup with PM2

  1. $ npm install -g pm2
  2. $ pm2 start ecosystem.json

Accessibility Guidelines

Here is guide on how to use the accessible editor

The code for the p5.js web editor adheres to web accessibility standards. The following guidelines will help to ensure that accessibility continues to be a priority as development continues.

Code Structure

  • Screen Readers are an assistive technology for vision loss which helps users to navigate a web page. They are able to prioritize content based on the semantic meaning of HTML tags. Therefore, it is important to use specific tags, such as nav, ul, li, section, and so on. div is the least screen reader friendly tag. For example, here is the semantic meaning of the body tag
  • All buttons/links/windows need to be accessible by the keyboard ( By tabbing, pressing space etc.)
  • In cases where tags are not screen reader friendly, we can take advantage of tabIndex. Using tabIndex ensures that all elements are accessible via keyboard. code example
  • When opening a new window or pop up window, ensure the keyboard focus also moves to the new window. code example

Labeling

  • When creating button icons, images, or something without text (this does not include an HTML5 <button>), use aria-labels. code example
  • All <table>s need to have a summary attribute. This will ensure user is given context to what the table is. code example
  • uls and navs menus need to include a title. code example

For more information on accessibility see the teach access tutorial

Contributing

See CONTRIBUTING.md.

Tooling and Style Overview

The p5.js Web Editor is built on a MERN stack - MongoDB, Express, React/Redux, and Node. For a reference to the file structure format I am using, please look at the Mern Starter and this comment.

This project uses an in-development p5.js interceptor library for accessibility as git submodule. Every time you run npm install, it will update the interceptor to HEAD, so it is important to do this often.

This project does not use CSS Modules, but uses Sass. I like to follow BEM rules for CSS naming conventions, write OOSCSS with placeholders and mixins, and follow the 7-1 Pattern for Sass.

I'm using ES6 and transpiling to ES5 using Babel. For reference to the JavaScript style guide, see the Airbnb Style Guide, React ESLint Plugin.

The ESLint configuration is based on a few popular React/Redux boilerplates. Open to suggestions on this. If in development, you're getting annoyed with ESLint, you can remove it from webpack.config.dev.js in the JavaScript loader, or disable any line from eslint by commenting at the end of the line // eslint-disable-line.

AWS information

This project is currently hosted on an EC2 instance and uses S3 for media hosting.

Backups on the MongoDB are also hosted on an S3 bucket, based on the following gist. The backup script runs nightly via a cronjob at 8AM UTC/3AM EST/12AM PST. Backups are deleted after 30 days.