ProTipHQ / ProTip

A browser extension for tipping, donations, and peer-to-peer crowd-funding
https://protip.is
GNU General Public License v3.0
95 stars 15 forks source link

Use compiled module based depedencies #17

Closed bnvk closed 4 years ago

bnvk commented 6 years ago

Currently, ProTip loads JS and CSS files that are committed to the repository directly and then statically linked with <link> or <script> tags in the <head> of the HTML files.

Since commit 5becbd26641e1e7f4d072f5de09d212524b20382 introduced Gulp and package.json we will be migrating to assets to being installed via package manager and compiled on build task.

bnvk commented 6 years ago

The currently statically linked dependencies I will be replacing with modules are:

Dependency Current Version Module Version
bigi.min.js ??? bigi 1.4.2
bitcoinjs-lib.min.js 3.1.1 bitcoinjs-lib 3.3.2
bootstrap css + js 3.3.2 bootstrap 4.0.0
browser-polyfill.js 0.2.1 webextension-polyfill 0.2.1
cryptojs.min.js 3.1.2 cryptojslib 3.1.2
date.js 1.2.3 dateformat 3.0.3
font-awesome.min.js 4.3.0 font-awesome 4.7.0
jquery-2.1.3.min.js 2.1.3 jquery 3.3.1
jquery.validate.min.js 1.13.1 jquery-validation 1.17.0
promise.min.js ??? promise 8.0.1
qrcode.js ??? qrcode-generator 1.3.1
switchery css + js ??? switchery 0.0.2
underscore-min.js 1.5.0 lodash 4.17.5
ydn-db.min.js ??? ydn.db 1.3.0

The remaining JS lib files not in NPM are from BitcoinWallet by Andrew Toth:

lib/currency-manager.js
lib/preferences.js
lib/util.js
lib/wallet.js

BitcoinWallet has not had any commits since 2014 and is not in the NPM registry. I'm not sure the best path forward with these, but it might be to create a NPM module.

However, to resolve #18 it might be prudent to see if there are other JS libs that do what Toth's code does, but already SegWit enabled instead of upgrading Toth's codebase.

bnvk commented 6 years ago

Having made a bunch of progress refactoring things- all original code and assets for ProTip now live in /src directory. Upon running development instructions to build and package, there will be the following directory structure.

/dist
/extension
/node_modules
/src

The majority of the modules (listed above) get compiled via browserify into bundle.js file. However, some CSS & JS modules still get loaded via <head> of the site, these get copied over using gulp-npm-dist and the gulp libs command.