Skip to content

endurance21/GSOC-20-WrapUp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

Project Overview

This project aimed at -

  • Revamping the current modules system from require.js to ESModules .

  • Writing Audio Nodes in ES6 classes way rather than older function constructor way .

  • Revamping Testing Architecture of the codebase .

The New Module system

Javascript has a struggling history of module sytems , from IIFE to ESM 2015 we have come a long way to finally own a native module support ! [ here is a great tutorial for the same ]. Earlier p5.js-sound library was dependent on require.js for making the codebase modular , which was very cumbersome to maintain and scale , However , now we have been shifted to ESM .

Perks of having native ESM -->

  • More cleaner way to write modules ( export/import keywords instead of require()).
  • Named exports has always been great feature of ESM .
  • Modules can be loaded from a URL, which is not there in Commonjs .

[ More on ESM Modules ]

This is not it !, Many browsers does not support many ES6 features such as export/import , classes , arrow functions .. etc , and here we needed the backward compatiblity , and BABEL (JS TRANSPILER ) is here to save the day , which with help of WEBPACK ( module bundler ) ships the final code in older verion of ES ! YES you heard it right , we write code in NODE.JS env with modern JS syntax but at the end of the day we ship the code in older ES versions to ensure compatiblity in all browsers !

[ More On BABEL ]

[ More On WEBPACK ]

[ THIS PR SUCCESSFULLY REVAMPED THE CODEBASE TO THE NEW MODULE SYSTEM ]

Class Based Audio Nodes

The introduction of es6 classes into the JS world , was a great relief for developers out there , though its a syntactic sugar for constructor functions yet it abstracts out the protypal approach under the hood ,leaving a cleaner interface to the developers .

[ More on ES6 CLASSES ]

when it comes to AUDIO GRAPHS , where one node is connected to so many other nodes and inherit property from its parent nodes , a more robust and cleaner implementation of Nodes was required and ES6 classes rocked the way .

Following PR Revamped the p5.sound's AUDIO NODES ( a wrapper over WEB AUDIO API's AUDIO NODES ) to use ES6 Classes

[ #502 #503 #508 #509 #514 #515 #516 #517 #518 #519 #520 #521 #522 #523 #524 #525 #526 #527 #528 #530 #531 #532 #533 #534 #535 #536 #537 #538 #539 ]

New Testing architecture

Unit automated testings are fun and helps ship the errorless code to the end users . Testing Frameworks like mocha , assertion library chai , stubbing helpers like sinon helped achieve the same , however we were still using require.js mdoule format and chached mocha.js , chai.js ,sinon.js file that not only increased the size of the codebase but also very tidious to update them ,

With THIS PR i sucessfully revamped the module System to ESM and removed those chached file and made them downloadable using NPM , Moreover i have added following unit tests to some of uncovered AUDIO NODES and modules .

[ Unit tests for p5.master ]

[ Unit tests for helper methods ]

[ Unit test for p5.Gain ]

PS - This one was more of my second gsoc proposal , however i completed the goals of 1st proposal early and decided to make that happen too .

Off GSOC Tasks

  • [ pre commit hooks ] while completing my gsoc tasks , i enjoyed helping jason and kyle in adding pre-commit hooks in the codebase .

  • [ p5.js file ] Most of out unit tests and examples required p5.js to work with , and it was chached too into the codebase which not only was bulking the codebase but also making it hard to update , I removed the cached p5.js file and used NPM to download it , however after download by default it was present inside the node_modules folder , which was a serious issue beacause our unit tests and examples used /lib/p5.js reference to the p5.js file , i decided to copy the p5.js file from node_modules folder to /lib/p5.js on project setup using POSTINSTALL NPM SCRIPT .

Also i loved dicussing the issues of others related to the library and reviewing the code was self rewarding .

Acknowldegements

I am extremly grateful to Processing Foundation and GSOC team to let me live my dream here .I would like to thank my amazing mentors Jason Sigal and Kyle James along with all my family members , friends for their unmeasured support and motivation throughout this amazing GSOC period .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published