react-monk
React-monk is here to help you with the JavaScript fatigue.
Set up quickly a working environment with:
- react
- webpack
- css modules
- babel6
- hot module replacement
- ...
Setup a react monk project
npm init -ynpm install react-monk --save-devnpm install react react-dom --save
You're all set!
Transform module
Create a src/index.js
file with the following content:
;;Component{return <div><h1 className=someClass>Hello World</h1></div>;};
Now run ./node_modules/.bin/react-monk transform src
to publish the code from
src
to lib
directory.
It is ready for npm consuming.
run
./node_modules/.bin/react-monk help transform
for more options.
Serve application
Create a samples/basic.js
file with the following content:
;;;let renderDiv = document;if !renderDivrenderDiv = document;renderDivid = 'app';documentbody;ReactDOM;
Now run ./node_modules/.bin/react-monk serve samples/basic.js
.
Open you browser at http://localhost:1337
to see you sample application.
run
./node_modules/.bin/react-monk help serve
for more options.
Build application
Using the previous samples/basic.js
file, run ./node_modules/.bin/react-monk build samples/basic.js --html 'Sample application'
to generate a bundle in
dist
directory.
run
./node_modules/.bin/react-monk help build
for more options.
Test
Create a src/index-test.js
file with the following content:
;;
Launch mocha tests with ./node_modules/.bin/react-monk test src
run
./node_modules/.bin/react-monk help test
for more options. All unknown options are forwarded to mocha runtime.
Custom config
react-monk extends the existing
- .baberc
- webpack configuration (Not yet implemented, but designed to, ping me if you need it)