You will need to have Node.js installed to run any of the commands below.
If you are a Windows user and are having issues running gulp
commands, please see here: http://stackoverflow.com/questions/24027551/gulp-command-not-found-error-after-installing-gulp
After you have node installed, navigate to the project folder and run npm install && npm run build
. This will install the project dependencies and run the build tasks for the css and javascript.
Folders are organized with the following main folders:
- assets
- documentation
- src
- test
- tools
index.html
Gulpfile.js
assets/
This is where the code that runs the application lives. This folder also contains two folders that are generated as a result of build commands: style
and scripts
. Any changes made to files in these two folders will be overwritten the next time a build command is run. If you need to edit CSS or Javascript files, please edit the files in the src
folder. If you are a content creator, one who is adding Airports, Airlines or Aircraft, your .json
/.geojson
files should be added here just as they always have been.
src/
The application's CSS and Javascript source files. If you are developing Javascript or CSS, the files you want to edit live in this folder.
test/
Application test files. The folder structure here should mirror that of the src
folder. For example, if you want to write some tests for the src/assets/scripts/math/circle.js
file, it should live in test/math/circle.spec.js
. If you are writing any new tests, they should go here. Any test file should have a **/*.spec.js
file extension. Test files are run by folder then globbing pattern, so if you have a support file it should have just a .js
extension. Testing is run via ava with coverage reporting generated by nyc. There are full HTML coverage reports available to view in the coverage/lcov-report
folder.
tools/
Any gulp
task is defined in one of the files in this folder.
Gulpfile.js
This is the entry point for all gulp
tasks. There should never be a process defined in this file, just references to a tasks defined in the tools/tasks
folder. The only exception to this is for root tasks like build
, lint
, watch
, etc. These root tasks are just wrappers for a collections of other tasks.
Available npm
commands:
-
npm run start
Will spool up a small web server using thehttp-server
package. Once the server successfully starts, you can view the app at localhost:3003 in your web browser. -
npm run build
alias forgulp dist && npm run test
. -
npm run test
Will run theava
test suite and output a coverage report in the terminal window. -
npm run report
Will generate a coverage report from the last test run. If only a specific subset of files was tested, the coverage report will reflect that. ex:npm run test -- test/math/
will run all the tests in thetest/math/
directory and generate coverage for only the files tested. Any other file that is not related to the files being tested will be ignored in the coverage report. -
npm run coverage
Runs the entire test suite and generates a coverage report.
All the gulp
commands defined in the Gulpfile are combined tasks, meaning they actually call other tasks defined in the tools/tasks
folder. The main gulp
commands defined in this file are:
-
gulp build
Concat, minify autoprefix CSS toassets/styles/main.min.css
with sourcemaps, transpile and browserify javascript toassets/scripts/bundle.js
with sourcemaps -
gulp dist
Everythinggulp build
does plus runeslint
and output a per-file report of errors and warnings. -
gulp watch Watches for changes for css and javascript files and runs an associated compilation task if a change is detected.