Difference between revisions of "Bower"

From OpenEMR Project Wiki
Line 4: Line 4:
:#*Use bower to collect and organize the front-end assets.
:#*Use bower to collect and organize the front-end assets.
:#Migrate all the front-end assets(of which there are multiple versions of many of the front-end assets) to most current version.
:#Migrate all the front-end assets(of which there are multiple versions of many of the front-end assets) to most current version.
:#Ability to install all front assets via bower (if ever decide to not include them in the codebase).
==More Details==
==More Details==
:Assets that are collected via bower are stored at '''public/assets'''; note this location is flexible since we are not sure where we will be storing these in the future as migrate to MVC architecture.
:Assets that are collected via bower are stored at '''public/assets'''; note this location is flexible since we are not sure where we will be storing these in the future as migrate to MVC architecture.

Revision as of 09:14, 17 July 2016

Overview

End Goals

  1. Centralize and organize all front-end assets in one flexible path (ie. can move entire path to the assets without breaking scripts).
    • Use bower to collect and organize the front-end assets.
  2. Migrate all the front-end assets(of which there are multiple versions of many of the front-end assets) to most current version.
  3. Ability to install all front assets via bower (if ever decide to not include them in the codebase).

More Details

Assets that are collected via bower are stored at public/assets; note this location is flexible since we are not sure where we will be storing these in the future as migrate to MVC architecture.
  • The path is set to a global ($GLOBALS['assets_static_relative']) here in the codebase(so the path will be easy to change in the future) and also would need to be changed in the .bowerrc file):
  • Incorporating the versions in the paths of the libraries.

ignoredDependencies setting in .bowerrc file.

Using "ignoredDependencies" in .bowerrc file to ignore sub-dependencies which makes things messy(would bring in paths without versions of which would be a redundant library).
  • datatables
  • jquery
  • imagesloaded
  • react

TODO

https://github.com/openemr/openemr/commit/b455e35df495dc343f35fb99f42978d2ed07d7b2
  • already have moment.js
  • migrate validate

Add New Asset

Bower Method (preferred)

  1. Add entry to the bower.json file.
  2. 'bower install' command
  3. Remove .gitignore and .gitattributes files(if they are present) from the installed package.
  4. Remove any scripts that may cause vulnerability (such as example scripts that allow file uploading); note this is very unlikely to be the case, but good to check.
  5. Add to below list of assets (and document there if removed any files).

Manual Method (only if bower method is not supported by package)

  1. If there is no bower support and package is not a supported git repo, then will need to bring in manually. See below shortcut.js-2-01-B asset for example.
  2. Remove .gitignore and .gitattributes files(if they are present) from the installed package.
  3. Remove any scripts that may cause vulnerability (such as example scripts that allow file uploading); note this is very unlikely to be the case, but good to check.
  4. Add to below list of assets (and document there if removed any files).

Current Assets

AnythingSlider-1-9-4 (pending Ray's optho form)

  • Removed .gitignore and .gitattributes files.

bootstrap-3-3-4 (pending Ray's optho form)

Chart.js-2-1-3 (pending Ray's optho form)

  • Removed .gitignore file.

datatables-1-10-11 (pending Kevin's EDI project)

datatables-fixedcolumns-3-2-1 (pending Kevin's EDI project)

  • This is an extension for datatables-1-10-11.

datatables-fixedheader-3-1-1 (pending Kevin's EDI project)

  • This is an extension for datatables-1-10-11.

datatables-scroller-1-4-1 (pending Kevin's EDI project)

  • This is an extension for datatables-1-10-11.

font-awesome-4-6-3

  • Removed .gitignore file.

jquery-min-*

  • Contain the jquery library files. This is brought in via bower by direct html download since the old versions are not available in repo (need to be built) and only 1 file is needed for these numerous different versions of jquery.

jquery-panelslider-0-1-1 (pending Ray's optho form)

jquery-ui-1-10-4 (pending Kevin's EDI project)

jquery-ui-1-11-4 (pending Ray's optho form)

  • Removed .gitignore file.

knockout-2-2-1

  • Removed .gitignore file.

literallycanvas-0-4-13

moment-2-13-0

pure-0-5-0 (pending Ray's optho form)

qtip2-2-2-1 (pending Ray's optho form)

react-15-1-0

shortcut.js-2-01-B (pending Ray's optho form)

  • Not supported by bower, so brought in manually to the manual-added-packages sub-directory.
  • In future, can likely bring this in via bower via http method.

undone.js-0-0-1 (pending Ray's optho form)

  • Removed .gitignore and .gitattributes files.

Questions

Development is ongoing for this project:
  • Ideal directory for this stuff (this is why we have made it flexible so can easily change this in the future)
  • Ideal syntax of the bower openemr package

Forum