A boilerplate for Sails apps with a React frontend.
- Sails v0.12.2
- React v15.0.1
- Babel with ES2015
- React Router
- sails-hook-autoreload
- Sass
- Autoprefixer
- React Hot Loader
- Karma
- Mocha
- Mocha-Istanbul
- Enzyme
git clone https://github.com/markmur/sails-react-webpack.git
cd sails-react-webpack
npm installThere are multiple ways to run the project in development as sails and webpack-dev-server run independently. The easiest way is to use Foreman (npm install -g foreman) and run:
nf startThis will start all processes listed in the Procfile.
To view your app, go to http://localhost:3000 in your browser.
Wepack builds the bundle files on postinstall and sails is lifted the same way it's always lifted in production:
sails lift --prodYou can also manually run webpack with npm run dist.
You need karma-cli installed globally
$ npm install -g karma-cliTo watch the files and test files
$ karma startTo run once
$ npm run test:uiYou can play around with the Karma configuration at karma.conf.js.
Runs mocha_istanbul with Grunt.
To run
$ npm testbehind the npm scenes it simply runs
$ grunt testTests run with pre-push every time you try to push any code.
Note that Sails cannot be lifted for the Unit Tests to run successfully.