For more information, please visit our gitbook: http://10.136.225.86:3003/book/drc-starter-kit/
- ๐ Hot reloading
- ๐ Scaffolding
- ๐ Code splitting
- ๐ Redux devtool is supported
- ๐ Integration with lint testing, unit testing and coverage testing
- ๐ Integration with browser compatibility
- ๐ Multi style loader supported
- ๐ Integration complex settings with one file
- ๐ Nice flexibility for extension
- ๐ Using modern plug-ins (React-router, React etc.)
node ^5.0.0
yarn ^0.23.0 or npm ^3.0.0
Now, you can clone our repo by:
git clone http://10.120.137.178/wfatec/AMS-dg5.git
Then, you need to install some dependencies:
cd AMS-DG5;
npm install # Install project dependencies (or `yarn install`)
It's done!
After completing the installation step, you're ready to start the project!
npm start # Start the development server (or `yarn start`)
While developing, you will probably rely mostly on npm start; however, there are additional scripts at your disposal:
Script (also yarn) | Description |
---|---|
npm start | Start compile your project. The default serve url would be: http://localhost:3000 |
npm run quick | Call scaffolding to generate template file |
npm run build | build your project as production (minify, hash etc). The default output root is dist |
npm run test | Testing your codes. This command will run lint testing and unit testing at same time |
npm run test:unit | Run unit testing alone |
npm run test:unit:watch | Run unit testing in watching mode (Trace your changing in testing immediately) |
npm run test:lint | Run lint testing alone |
npm run test:lint:fix | Run lint testing with automatically fixing errors |
npm run test:lint:report | Run lint testing and output result as a report. The default path of report is reports |
npm run test:coverage | Run coverage testing and output report in reports directory |
npm run release | Release your codes with test, build. If passed, the version tag and codes will be pushed into repo |
Besides, there are many options you can attach after your command:
Option | Description |
---|---|
--indir | The entry directory of your main codes in your project. Default is src . |
--main | The file name of the application's entry point. Default is main |
--outdir | The name of the directory in which to emit compiled assets. Default is dist |
--testdir | The name of the testing entry directory. Default is tests |
--reportdir | The name of the testing output report directory. Default is reports |
--template | The template of html. It will be used if the configuration of html is true. Default is index.html |
--port | The port of the server. Default is 3000. |
--publicpath | The base path for all projects assets (relative to the website root). Default is '/' |
--sourcemaps | Whether to generate sourcemaps. Default is false |
--externals | A hash map of keys that the compiler should treat as external to the project. Default is {} |
--globals | A hash map of variables and their values to expose globally. Default is {} |
--outputlint | Whether to output the lint report. Default is false. |
--fixlint | Whether to fix the lint error automatically. Default is false. |
--verbose | Whether to enable verbose logging. Default is false. |
--dsiableless | Whether to disable less loader. Default is false. |
--dsiablecss | Whether to disable css loader. Default is false. |
--dsiablescss | Whether to disable scss loader. Default is false. |
--dsiabletext | Whether to disable text loader. Default is false. |
--dsiableimage | Whether to disable image loader. Default is false. |
--dsiablefont | Whether to disable font loader. Default is false. |
--dsiablehtml | Whether to disable html loader. Default is false. |
--polyfill | Assign the location of polyfill. By default, the babel-polyfill will be used. |
--imagesize | The limit of image size. Default is 8192. |
--fontsize | The limit of font size. Default is 10000. |
--threshold | The setting of the coverage threshold. Default is { statements: 50, branches: 50, functions: 50, lines: 50} |
--vendors | The list of modules to bundle separately from the core application code. |
All of default setting can be modified in project.config.js of root.
The project structure is designed by functionality of Redux-React. For more introduction of this structure can visit the offical website of Redux: connect. If you want to modify the folder structure, please feel free to do that. There is no constraint in project structure of our starter kit.
.
โโโ build # All build-related code
โ |โโ configs # All configuration files
โ โ โโโ jest.config.js # The configuration of Jest
โ โ โโโ postcss.config.js # You can put your settings here to do some post css prefix
โ |โโ lib # All libraries used in scripts
โ โ โโโ logger.js # A logger script for printing pretty log
โ โ โโโ path.js # A path script for handling path issue in script
โ |โโ scaffold # All Scaffold setting files and script files
โ โ โโโ ** # Template of scaffolding
โ โ โโโ start.js # The entry point of scaffold script
โ โ โโโ validate.js # A script for checking if file is exised
โ |โโ scripts # All build-related scripts
โ โ โโโ compile.js # A script for handling code compiling
โ โ โโโ eslint.js # A script for handling lint checking
โ โ โโโ start.js # A script for starting building server
โ |โโ server # Express application that provides webpack middleware
โ โ โโโ main.js # Server application entry point
โ โโโ webpack.config.js # Configuration of webpack
โโโ public # Static public assets (not imported anywhere in source code)
โโโ src # Application source code
โ โโโ actions # All of business logics for components
โ โโโ assets # Fonts, images, svgs, csvs etc. All kinds of files used in pages.
โ โโโ components # Global reusable components
โ โโโ containers # Global reusable container components
โ โโโ hocs # Global reusable higher order components
โ โโโ layouts # Components that dictate major page structure
โ โโโ models # Data structure definition of reducer
โ โโโ reducers # A center to decide how to update state
โ โโโ routes # Main route definitions and async split points
โ โโโ store # Redux-specific pieces
โ โ โโโ createStore.js # Create and instrument redux store
โ โโโ index.html # Main HTML page container for app
โ โโโ main.js # Application bootstrap and rendering
โโโ tests # Unit tests
Allows you to auto-generate boilerplate code for common parts of your application. Feel free to modify or create a new template in build/scaffold
.
To add a unit test, create a .spec.js
file anywhere inside of ./tests
. Jest and webpack will automatically find these files, and Enzyme will be available within your test without the need to import them.
chuck.wu |
chao.wang |