So you want to learn about the internals of Cobudget's user interface? Sweet!
There are three entry points that are bundled to the client:
- ./src/index.js: this is the entry point for
browserify
which traverses, transforms, and bundles our Javascript into a singlebuild/scripts/index.js
. - ./src/index.sass: this is the entry point for
sass
which traverses, transforms, and bundles our Sass into a singlebuild/styles/index.css
. - ./src/index.html: this is the file delivered to the client on page fetch, which references the above JS and CSS bundles.
Everything is a module. The purpose of this is to isolate chunks of code that are not related (loose coupling) and group chunks of code that are related (tight cohesion). All the modules can found in ./src/node_modules. All the code related to a module (Javascript, Sass styling, Html templates, etc) should be in that module's directory.
Each module is a proper Node module with a package.json which describes the entry point (the file that will be required on require('module')
) and any browserify transforms that should be applied.
The top-level module is the app module. This module registers all the Node modules with Angular's own module format (which means most modules load each other through Angular's Dependency Injection system) as well as performs any high-level configuration. An important set of configurations are the ui-router routes, which determine the nested page hierarchy.
Each route module, which combines a match url, template, controller, and styles, exports the format expected by ui-router's $stateProvider.state
function. In order to handle nested views, including a top-level layout, some routes are abstract
routes which are not navigated to but provide a shell for child views.
Each model module, which describes an instance of a type of data, exports a extension of ampersand-state
, typically starting with base-model
.
Each store module, which describes how to interact with the Cobudget API for a type of data, exports a singleton which extends restful-store
.
Each directive module exports the format expected of an Angular directive.
Each modal module exports the format expected of an Angular Bootstrap modal.
The configuration data for various environments is located in ./config, which due to the config module, is accessible in any other module using CommonJS modules as require('config')
or using Angular modules as config
.
We use Gulp, see ./Gulpfile.coffee for more info.
We use Protractor and Testling-style tests, see README for how to run.