$ npm run setup
Initializes a new project with this boilerplate. Deletes the react-boilerplate
git history, installs the dependencies and initializes a new repository.
Note: This command is self-destructive, once you've run it the init script is gone forever. This is for your own safety, so you can't delete your projects history irreversibly on accident.
$ npm start
Starts the development server and makes your application accessible at localhost:3000
. Changes in the application code will be hot-reloaded.
To change the port the app is accessible at pass the -p
option to the command with --
. E.g. to make the app visible at localhost:5000
, run the following:
$ npm start -- -p 5000
$ npm run build
Gets your application ready for deployment. Optimizes and minifies all files, and generates a folder called build
. build
includes all files you need for your application. Upload the contents of build
to your web server to see it live!
See the testing documentation for detailed information as to how testing works! If you just want the commands and know how to write tests already, look below!
$ npm run test
Tests your application with the unit tests specified in the *test.js
files throughout the application. This'll run the tests in Chrome, but you can choose different browsers.
To choose the browser to run your unit tests in (Chrome is run by default), run one of the following commands:
$ npm run test:firefox
$ npm run test:safari
Windows only!
$ npm run test:ie
To watch changes to your application and rerun tests whenever a file changes run
$ npm run test:watch
$ npm run pagespeed
With the development server running (i.e. while $ npm start
is running in another tab), enter this command to run Google PageSpeed Insights and get a performance check right in your terminal!
$ npm run serve
This will run a server that's accessible on the entire world and shows the version of the app that's in the build
folder. Useful for testing on different devices in different locations!
Note: This assumes you have done a build with
npm run build
before. The changes you make in your application won't be reflected in the application unless you runnpm run build
again.
Lint your JavaScript and CSS with this command.
$ npm run lint
Want to lint your JavaScript and CSS seperately?
$ npm run lint:js
$ npm run lint:css
Note: CSS Linting uses Stylelint default configuration with a few custom extends. To edit the custom extends open
.stylelintrc