Ayano
About project name
ayano is a character at 《目隐都市的演绎者》
Quik start
npm install -g ayano
ayano init <name>cd <name>npm start
ayano-script
start
ayano-script start //start app with a webpack devServer
ayano has inner webpack config file, you can use --config -c [path]
to use custom config file
build
ayano-script build // build app
ayano has inner webpack config file, you can use --config -c [path]
to use custom config file
outputConfig
ayano-script outputConfig
This command will out put innner config file to current dir
Proxy
Add proxy settings to package.json
, about config, to see webpack devServer proxy
AyanoReact
Start
npm install --save ayano-react
Features
createApp
const options = actions: {} // redux actions, can be a object or function which is handled by redux-thunk reducers: <reducer> // redux reducers pre reducers or combined reducers, history: history // a history to create router -> default is hashHistory routers: path: '/' component: Home // a react-router-dom <Route></Route> component props array const app = ; appstartdocument; app_store // store that is created; app_history // history that is used; app_actions // actions which is bind to dispatch
connectApp
Component { superprops } { <div class="app"></div> } const mapStateToProps = { return app: stateapp } App
- the
connectApp
will auto merge actions which is defined at createApp options and bind dispatch
buildConstants
const constants = // constants is {// POSTS: {// ALL: "@manage/POSTS/ALL",// CREATE_EMPTY: "@manage/POSTS/CREATE_EMPTY"// },// POST: {// SELECT: "@manage/POST/SELECT"// ......// }// }
request
const apis = users: path:'/users' method: 'GET' user: { return `/user/` }// the data is which you pass in method: "GET" host: 'https://xxx.xxx.xx' const rq = ;// @params// path: a path at apis or custom path// data : request data// method: request method// options: advance options // it will request to https://xxx.xxx.xx/users // it will request to https://xxx.xxx.xx/user/122 // it will request to https://xxx.xxx.xx/ayano because '/ayano' is not at apis