ResonantGeo components are Vue files using pug for html templating and
stylus for CSS styling. The code is linted according to airbnb's
eslint configuration.
Unit testing is handled by karma which executes test specs present
in the test/specs
directory. These files are mocha specs using
chai assertions and @vue/test-utils
for mounting isolated components. Sinon is also globally
available in the test environment for mocking and stubbing.
ResonantGeo requires at least node version 8 and uses yarn to manage dependencies and development scripts. Ensure you have a recent version of yarn installed by running
npm install -g yarn
then generate the node_modules
directory
yarn
Running yarn test
will execute all tests (lint and unit) and generate code coverage information.
In case of test failures, you can run yarn unit:debug
and open http://localhost:9876/debug.html
in a browser. This will enable you to set break points and debug the test specs as the are run in a
live browser. Note that on CI the tests are executed in phantomjs and do not have all the features
of a real browser (including webgl).
All components live in the src/components
directory as .vue
files. New components should follow
the naming guidelines in the Vue style guide. The component
should be imported and exported from the index.js
file in it's directory. All components exported
in this way will be automatically registered when instantiating the plugin.
Components should not contain direct calls to vuex stores, routes, or make ajax requests. All
inputs to the component should be through props that are treated as read-only. Components should
communicate to it's parent via events. Two-way data binding can be simulated, when necessary, by
emitting update:<prop name>
events that the parent can bind to using the
.sync
modifier.
ResonantGeo uses semantic release to
automatically generate releases on github and publish to npm. This relies on commit messages following
a special format.
To help users generate these messages correctly, we recommend installing
commitizen and making commits using the git cz
command in
place of git commit
. ResonantGeo contains a commit message linter that runs as a post commit
hook. This linter can be run manually with the command yarn commitlint
.