Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic setup, including dispatcher
- Loading branch information
Showing
7 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"env": { | ||
"browser": false, | ||
"amd": false, | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"rules": { | ||
"comma-dangle": 1, | ||
"quotes": [ 1, "single" ], | ||
"no-undef": 1, | ||
"global-strict": 0, | ||
"no-extra-semi": 1, | ||
"no-underscore-dangle": 0, | ||
"no-console": 0, | ||
"no-unused-vars": 1, | ||
"no-trailing-spaces": [1, { "skipBlankLines": true }], | ||
"no-unreachable": 1, | ||
"no-alert": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
let generator = require('yeoman-generator'); | ||
|
||
module.exports = generator.Base.extend({ | ||
|
||
constructor: function() { | ||
generator.Base.apply(this, arguments); | ||
|
||
this.option('skip-install'); | ||
}, | ||
|
||
install: function() { | ||
|
||
if(!this.options['skip-install']) { | ||
this.installDependencies({ bower: false }); | ||
} | ||
|
||
// Run the base react-webpack generator, then run the dispatcher | ||
this.composeWith( | ||
'react-webpack', | ||
{ | ||
options: { | ||
'skip-install': this.options['skip-install'] | ||
} | ||
}, | ||
{ | ||
local: require.resolve('generator-react-webpack'), | ||
link: 'strong' | ||
} | ||
).on('end', () => { | ||
|
||
// Run the create dispatcher method | ||
this.composeWith('react-webpack-alt:dispatcher', { | ||
options: {}, | ||
args: ['Dispatcher'] | ||
}); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
let generator = require('yeoman-generator'); | ||
|
||
module.exports = generator.NamedBase.extend({ | ||
|
||
constructor: function() { | ||
generator.NamedBase.apply(this, arguments); | ||
}, | ||
|
||
writing: function() { | ||
this.fs.copyTpl( | ||
this.templatePath('Dispatcher.js'), | ||
this.destinationPath(`src/components/${this.name}.js`) | ||
); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var Alt = require('alt'); | ||
var alt = new Alt(); | ||
|
||
module.exports = alt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "generator-react-webpack-alt", | ||
"version": "0.0.1", | ||
"description": "Yeoman generator for ReactJS and Webpack with Alt.js", | ||
"keywords": [ | ||
"yeoman-generator", | ||
"reactjs", | ||
"webpack", | ||
"alt.js", | ||
"scaffold", | ||
"front-end" | ||
], | ||
"homepage": "https://github.com/weblogixx/generator-react-webpack-alt", | ||
"bugs": "https://github.com/weblogixx/generator-react-webpack-altissues", | ||
"author": { | ||
"name": "Christian Schilling", | ||
"email": "cs@weblogixx.de", | ||
"url": "https://github.com/weblogixx" | ||
}, | ||
"main": "generators/action/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/weblogixx/generator-react-webpack-alt.git" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"yeoman-generator": "^0.20.3", | ||
"yeoman-welcome": "^1.0.1", | ||
"generator-react-webpack": "https://github.com/weblogixx/generator-react-webpack.git#rewrite" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.2.0", | ||
"mocha": "^2.3.2" | ||
}, | ||
"engines": { | ||
"node": ">=4.0.0", | ||
"iojs": ">=1.1.0" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
let path = require('path'); | ||
let assert = require('yeoman-generator').assert; | ||
let helpers = require('yeoman-generator').test | ||
|
||
describe('react-webpack-alt:dispatcher', () => { | ||
|
||
let generatorDispatcher = path.join(__dirname, '../../../generators/dispatcher'); | ||
|
||
/** | ||
* Return a newly generated dispatcher with given name | ||
* @param {String} name | ||
* @param {Function} callback | ||
*/ | ||
function createGeneratedDispatcher(name, callback) { | ||
helpers.run(generatorDispatcher) | ||
.withArguments([name]) | ||
.on('end', callback); | ||
} | ||
|
||
it('should create the new ALT dispatcher when invoked', (done) => { | ||
|
||
createGeneratedDispatcher('Dispatcher', () => { | ||
|
||
assert.file([ | ||
'src/components/Dispatcher.js' | ||
]); | ||
assert.fileContent('src/components/Dispatcher.js', 'var Alt = require(\'alt\');'); | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--reporter spec | ||
--recursive |