mirror of
https://github.com/react-webpack-generators/generator-react-webpack.git
synced 2025-12-08 18:01:59 +00:00
Merge pull request #110 from atmk-za/master
Added architecture option for Alt (http://alt.js.org)
This commit is contained in:
commit
0560d4763c
@ -24,6 +24,9 @@ ActionGenerator.prototype.createActionFile = function createActionFile() {
|
||||
case 'reflux':
|
||||
actionTemplate = 'RefluxAction';
|
||||
break;
|
||||
case 'alt':
|
||||
actionTemplate = 'AltAction';
|
||||
break;
|
||||
}
|
||||
|
||||
console.log('Creating ' + this.architecture + ' action');
|
||||
|
||||
@ -72,11 +72,12 @@ ReactWebpackGenerator.prototype.askForArchitecture = function() {
|
||||
this.prompt({
|
||||
type : 'list',
|
||||
name : 'architecture',
|
||||
message : 'Would you like to use one of those architectures?',
|
||||
message : 'Would you like to use one of these architectures?',
|
||||
choices: [
|
||||
{name:'No need for that, thanks',value:false},
|
||||
{name:'Flux',value:'flux'},
|
||||
{name:'ReFlux',value:'reflux'}
|
||||
{name:'ReFlux',value:'reflux'},
|
||||
{name:'Alt',value:'alt'}
|
||||
],
|
||||
default : false
|
||||
}, function(props) {
|
||||
|
||||
@ -27,3 +27,9 @@ MainGenerator.prototype.createDispatcher = function createDispatcher() {
|
||||
this.appTemplate('Dispatcher', 'dispatcher/' + this.scriptAppName + 'Dispatcher');
|
||||
}
|
||||
};
|
||||
|
||||
MainGenerator.prototype.createAltjsFile = function createAltjsFile() {
|
||||
if(this.env.options.architecture=='alt') {
|
||||
this.appTemplate('alt', 'alt');
|
||||
}
|
||||
};
|
||||
|
||||
@ -26,6 +26,9 @@ StoreGenerator .prototype.createStoreFile = function createStoreFile() {
|
||||
case 'reflux':
|
||||
storeTemplate = 'RefluxStore';
|
||||
break;
|
||||
case 'alt':
|
||||
storeTemplate = 'AltStore';
|
||||
break;
|
||||
}
|
||||
|
||||
console.log('Creating ' + this.architecture + ' store');
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
"flux": "^2.0.1",
|
||||
"events": "^1.0.2",
|
||||
"object-assign": "^2.0.0", <% } if (architecture === 'reflux') {%>
|
||||
"reflux": "^0.2.7", <% } %>
|
||||
"reflux": "^0.2.7", <% } if (architecture === 'alt') { %>
|
||||
"alt": "^0.16.5", <% } %>
|
||||
"react": "~0.12.2",
|
||||
"normalize.css": "~3.0.3"
|
||||
},
|
||||
|
||||
11
templates/javascript/AltAction.js
Normal file
11
templates/javascript/AltAction.js
Normal file
@ -0,0 +1,11 @@
|
||||
var alt = require('../alt');
|
||||
|
||||
<% if (es6) { %>class <%= classedName %> {
|
||||
|
||||
}; <% }
|
||||
else { %>var <%= classedName %> = alt.createActions(function () {
|
||||
|
||||
}); <% } %>
|
||||
|
||||
<% if (es6) { %>export default alt.createActions(<%= classedName %>); <% }
|
||||
else { %>module.exports = <%= classedName %>; <% } %>
|
||||
21
templates/javascript/AltStore.js
Normal file
21
templates/javascript/AltStore.js
Normal file
@ -0,0 +1,21 @@
|
||||
var alt = require('../alt');
|
||||
|
||||
<% if (es6) { %>class <%= classedName %> {
|
||||
constructor() {
|
||||
|
||||
this.bindListeners({
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
} <% }
|
||||
else { %>var <%= classedName %> = alt.createStore({
|
||||
|
||||
bindListeners: {
|
||||
|
||||
}
|
||||
|
||||
}); <% } %>
|
||||
|
||||
<% if (es6) { %>export default alt.createStore(<%= classedName %>, '<%= classedName %>'); <% }
|
||||
else { %>module.exports = <%= classedName %>; <% } %>
|
||||
4
templates/javascript/alt.js
Normal file
4
templates/javascript/alt.js
Normal file
@ -0,0 +1,4 @@
|
||||
var Alt = require('alt');
|
||||
var alt = new Alt();
|
||||
|
||||
module.exports = alt;
|
||||
Loading…
x
Reference in New Issue
Block a user