influxdb/ui/README.md

63 lines
1.9 KiB
Markdown
Raw Normal View History

# Enterprise UI
2016-09-09 23:10:54 +00:00
Here lies a collection of React components used in the Enterprise web app.
2016-09-09 23:10:54 +00:00
Currently they're organized per "page", with each separate directly having it's own components/containers folders, index.js, etc. For example:
2016-09-09 23:10:54 +00:00
/ui
/overview
/components
/containers
index.js
/chronograf
/components
/containers
2016-09-09 23:10:54 +00:00
index.js
## Getting started
2016-09-09 23:10:54 +00:00
This project uses Node v5.
2016-09-09 23:10:54 +00:00
It depends on at least one private Node module.
In order to successfully `npm install`, you'll need an [npm authentication token](http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules).
2016-09-09 23:10:54 +00:00
There are two ways to get an npm token.
2016-09-09 23:10:54 +00:00
1. You can copy someone else's token (have them give you a copy of their `~/.npmrc`).
This is fine for most cases, and it's probably necessary for CI machines.
2. You can create an npm account and coordinate with Mark R to join the `influxdata` npm org.
You probably don't need this if you aren't ever going to create/publish a private Node module.
2016-09-09 23:10:54 +00:00
### Development
2016-09-09 23:10:54 +00:00
First, in the `ui/` folder run `npm install`.
2016-09-09 23:10:54 +00:00
run `npm run build:dev` to start the webpack process which bundles the JS into `assets/javascripts/generated/`.
2016-09-09 23:10:54 +00:00
### Tests
2016-09-09 23:10:54 +00:00
We use mocha, sinon, chai, and React's TestUtils library.
2016-09-09 23:10:54 +00:00
Run tests against jsdom from the command line:
2016-09-09 23:10:54 +00:00
```
npm run test # single run
npm run test:watch # re-run tests on file changes
2016-09-09 23:10:54 +00:00
```
Run tests in the browser:
2016-09-09 23:10:54 +00:00
```
# This starts a webpack process that you'll need to leave running.
# It rebuilds your tests on each file change.
npm run test:browser
# open http://localhost:7357/spec/test.html
2016-09-09 23:10:54 +00:00
```
### Production
2016-09-09 23:10:54 +00:00
As before, `npm install` first.
Then `npm run build` to generate a production build into the `assets/javascripts/generated/` folder.
2016-09-09 23:10:54 +00:00
If you want to run tests against the production build, `npm run test` will build the test files and run the tests in a headless Phantom browser.