generator-bainx v0.0.6
generator-bainx
Yeoman generator for ES6 React web applications
About Bainx.js
Bainx.js is a combination of existing libraries and tools that allows fast and simple creation of single page web applications using ES6.
Bainx.js is built using React.js with react-router and Twitter Bootstrap CSS.
All of the application code is managed and compiled by Webpack and minified using Uglify.js (when not in debug mode).
NPM is used for the dependency management.
Gulp.js is used as a build-tool.
Testing is done using eslint for linting and code-style and mocha.js with should.js for automated testing.
Standalone reusable components for your Bainx application can be generated using separate Bainx-component generator.
Getting Started
Requirements
For Bainx.js to function properly, you'll need to have following things installed:
Installation
$ npm install -g yo generator-bainx
Usage
$ yo bainx
API
$ yo bainx
Creates a new bainx.js application.
$ yo bainx:component myName
Generates a new inlined React component named myName.
If you want to generate standalone/self-contained and more sophisticated components, look into using Bainx component generator.
$ yo bainx:page myName
Generates a new page named myName and injects it into main app.
The only difference between page and component is that page generates and exports a route.
$ yo bainx:docker
Generates a docker environment for the project with all the requirements included.
$ yo bainx:docker-deploy
Generates a separate docker environment for the project statical deployment via nginx.
To deploy the app using it, you will need to:
1. Compile your app using npm run deploy
command
2. Package it into docker container using docker build -t app-name -f Dockerfile-deploy .
command
3. Run it on docker and forward port 80
Learning Your Way Around
Once installed, you can create a basic application by following the prompts.
$ mkdir HelloWorld
$ cd HelloWorld
$ yo bainx
_-----_
| | .--------------------------.
|--(o)--| | Welcome to the |
`---------´ | breathtaking Bainx |
( _´U`_ ) | generator! |
/___A___\ '--------------------------'
| ~ |
__'.___.'__
´ ` |° ´ Y `
? Your project name: (HelloWorld)
...
To run your application, just type npm start
.
Project Structure
Client:
- /style/ - LESS files
- /src/index.js - App entry point
- /src/app.jsx - React app bootstrapper
- /src/routes.js - Routes for react-router
- /src/app/ - React app definition with react-router setup
- /src/components/ - React components folder
- /src/components/chrome - Application chrome React component
- /src/components/navigation - Application navigation bar React component
- /src/pages/ - React pages folder
- /src/pages/index - Index page that's loaded by default
- /src/pages/other - Other page that's added for convenience
Components (can be generated with bainx:component
):
- /src/components/COMPONENT/index.js - React component definition
- /src/components/COMPONENT/template.jsx - React template
Pages (can be generated with bainx:page
):
- /src/pages/PAGE/index.js - React component and route definition
- /src/pages/PAGE/template.jsx - React template
Misc:
- /gulp/ - Custom Gulp tasks
- /tests/ - Unit and functional tests
- /buildConfig.js - Build config
- /gulpfile.js - Gulp bootstrapper
- /webpack.config.js - Webpack config for development
- /webpack.config.prod.js - Webpack config for production
TODO
Add more docs, subgenerators and a proper test suite.