**DEPRECATED & UNMAINTAINED** The payments frontend interface
Note This project is no longer maintained.
Note Sauce Labs tests are only run on PRs from the main repo or commits to master.
This project comprises all styles, behaviour and interfaces for mozilla/payments.
Run tasks with
| Task name | Description | | ------------ | --------------- | | build | build all CSS/JS files for deployment | | serve | watch CSS/JS for changes; serves static files via
webpackdev server to enable hot module reloading | | test | run tests locally | | test-sauce | run full Sauce Labs test suite | | watch-email | watch email-specific static files for changes; updates CSS/JS on change | | watch-static | watch files for changes; updates CSS/JS on change |
To get the right paths for the email CSS and rebuild files as they change run:
DEV=1 grunt watch-email
Install grunt-cli globally with
npm install -g grunt-cli. Then run
npm installto install the local deps needed for development.
Dependencies are automatically kept up-to-date using greenkeeper.
We're aiming to only use npm packaged deps rather than bower. This is to be able to track dep versions in one place.
Normally built artifacts aren't committed. However, to manage dep changes more tightly, production libs (JS, CSS + fonts) are committed to the tree.
JS libs are committed from
node_modulesas webpack knows how to find deps in
Whilst this creates noise it does help ensure deps in the browser are identical and can't get mangled by a broken deps installation.
Unfortunately some deps only work with bower. For these cases, make sure
bower.jsonhas the package name and version, run
bower install, and commit the distributed files to
public/bower_components. Hopefully these cases will be rare.
If you're using payments-env to run the complete payments system then you'll want to use
grunt watch-staticon your host to watch for file changes. In other words, start docker to run all the things but keep a shell open on the host machine just to compile static assets for the docker VM to serve.
If you run the webpack-dev-server you can get hot module reloading. This turns on a feature where the code automatically updates in the browser as you change the code in your editor.
For example run
grunt serveto run the webpack-dev-server.
And then visit:
You should find that changes to the react modules are reflected immediately without refresh. Read on if you want to also interact with the API server.
If you are running the full stack with payments-env then you'll also be able to interact with the API when using hot reloading.
First, create an
127.0.0.1 pay.webpackso that you can access your webpack server on a predictable host.
To see the purchase interface with hot module loading enabled visit the example site at:
To see the management interface:
grunt eslintcommand which is self-contained.
You'll need the packages listed below installed globally:
npm install -g eslint babel-eslint eslint-plugin-react
Using syntastic, the following snippet turns on eslint selectively for projects with a .eslintrc.
To run the tests locally run:
grunt test. This will run the unit tests against Firefox.
The tests are run only on Firefox when a PR is submitted. When that code is landed on master, Travis will run the tests on Sauce Labs.
If you're a member of the payments team and you want to get Sauce Labs coverage for a PR - push the branch to the main
mozilla/payments-uirepo and make a PR from that.
First Sign-up for a Sauce Labs 'Open Sauce' account to get your keys.
Then you'll need to export the SauceLabs username and access key as env vars:
export SAUCE_USERNAME= export SAUCE_ACCESS_KEY=
Then you should find you can run:
grunt karma:sauceand run all the tests on SauceLabs.
The styleguide is based on the styles and templates that live in the tree.
It can be build statically with the
The styleguide is published here.
grunt styleguide(defaults to running on localhost:4001).
We're using grunt-i18n-abide to run the extraction commands.
Because we're using React we need to operate on the compiled JS file. This also means we aren't running extraction on un-used code.
To run an extraction, checkout out the payments-l10n repository so that it has the same parent directory as payments-ui (
../payments-l10nfrom the current location). Then do the following:
npm install grunt webpack abideExtract