File tree 7 files changed +160
-0
lines changed
7 files changed +160
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "env": {
3
+ "browser": false,
4
+ "amd": false,
5
+ "es6": true,
6
+ "node": true,
7
+ "mocha": true
8
+ },
9
+ "rules": {
10
+ "comma-dangle": 1,
11
+ "quotes": [ 1, "single" ],
12
+ "no-undef": 1,
13
+ "global-strict": 0,
14
+ "no-extra-semi": 1,
15
+ "no-underscore-dangle": 0,
16
+ "no-console": 0,
17
+ "no-unused-vars": 1,
18
+ "no-trailing-spaces": [1, { "skipBlankLines": true }],
19
+ "no-unreachable": 1,
20
+ "no-alert": 0
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ let generator = require ( 'yeoman-generator' ) ;
4
+
5
+ module . exports = generator . Base . extend ( {
6
+
7
+ constructor : function ( ) {
8
+ generator . Base . apply ( this , arguments ) ;
9
+
10
+ this . option ( 'skip-install' ) ;
11
+ } ,
12
+
13
+ install : function ( ) {
14
+
15
+ if ( ! this . options [ 'skip-install' ] ) {
16
+ this . installDependencies ( { bower : false } ) ;
17
+ }
18
+
19
+ // Run the base react-webpack generator, then run the dispatcher
20
+ this . composeWith (
21
+ 'react-webpack' ,
22
+ {
23
+ options : {
24
+ 'skip-install' : this . options [ 'skip-install' ]
25
+ }
26
+ } ,
27
+ {
28
+ local : require . resolve ( 'generator-react-webpack' ) ,
29
+ link : 'strong'
30
+ }
31
+ ) . on ( 'end' , ( ) => {
32
+
33
+ // Run the create dispatcher method
34
+ this . composeWith ( 'react-webpack-alt:dispatcher' , {
35
+ options : { } ,
36
+ args : [ 'Dispatcher' ]
37
+ } ) ;
38
+ } ) ;
39
+ }
40
+ } ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ let generator = require ( 'yeoman-generator' ) ;
3
+
4
+ module . exports = generator . NamedBase . extend ( {
5
+
6
+ constructor : function ( ) {
7
+ generator . NamedBase . apply ( this , arguments ) ;
8
+ } ,
9
+
10
+ writing : function ( ) {
11
+ this . fs . copyTpl (
12
+ this . templatePath ( 'Dispatcher.js' ) ,
13
+ this . destinationPath ( `src/components/${ this . name } .js` )
14
+ ) ;
15
+ }
16
+ } ) ;
Original file line number Diff line number Diff line change
1
+ var Alt = require ( 'alt' ) ;
2
+ var alt = new Alt ( ) ;
3
+
4
+ module . exports = alt ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " generator-react-webpack-alt" ,
3
+ "version" : " 0.0.1" ,
4
+ "description" : " Yeoman generator for ReactJS and Webpack with Alt.js" ,
5
+ "keywords" : [
6
+ " yeoman-generator" ,
7
+ " reactjs" ,
8
+ " webpack" ,
9
+ " alt.js" ,
10
+ " scaffold" ,
11
+ " front-end"
12
+ ],
13
+ "homepage" : " https://github.com/weblogixx/generator-react-webpack-alt" ,
14
+ "bugs" : " https://github.com/weblogixx/generator-react-webpack-altissues" ,
15
+ "author" : {
16
+ "name" : " Christian Schilling" ,
17
+
18
+ "url" : " https://github.com/weblogixx"
19
+ },
20
+ "main" : " generators/action/index.js" ,
21
+ "repository" : {
22
+ "type" : " git" ,
23
+ "url" : " git://github.com/weblogixx/generator-react-webpack-alt.git"
24
+ },
25
+ "scripts" : {
26
+ "test" : " mocha"
27
+ },
28
+ "dependencies" : {
29
+ "yeoman-generator" : " ^0.20.3" ,
30
+ "yeoman-welcome" : " ^1.0.1" ,
31
+ "generator-react-webpack" : " https://github.com/weblogixx/generator-react-webpack.git#rewrite"
32
+ },
33
+ "devDependencies" : {
34
+ "chai" : " ^3.2.0" ,
35
+ "mocha" : " ^2.3.2"
36
+ },
37
+ "engines" : {
38
+ "node" : " >=4.0.0" ,
39
+ "iojs" : " >=1.1.0"
40
+ },
41
+ "license" : " MIT"
42
+ }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ let path = require ( 'path' ) ;
3
+ let assert = require ( 'yeoman-generator' ) . assert ;
4
+ let helpers = require ( 'yeoman-generator' ) . test
5
+
6
+ describe ( 'react-webpack-alt:dispatcher' , ( ) => {
7
+
8
+ let generatorDispatcher = path . join ( __dirname , '../../../generators/dispatcher' ) ;
9
+
10
+ /**
11
+ * Return a newly generated dispatcher with given name
12
+ * @param {String } name
13
+ * @param {Function } callback
14
+ */
15
+ function createGeneratedDispatcher ( name , callback ) {
16
+ helpers . run ( generatorDispatcher )
17
+ . withArguments ( [ name ] )
18
+ . on ( 'end' , callback ) ;
19
+ }
20
+
21
+ it ( 'should create the new ALT dispatcher when invoked' , ( done ) => {
22
+
23
+ createGeneratedDispatcher ( 'Dispatcher' , ( ) => {
24
+
25
+ assert . file ( [
26
+ 'src/components/Dispatcher.js'
27
+ ] ) ;
28
+ assert . fileContent ( 'src/components/Dispatcher.js' , 'var Alt = require(\'alt\');' ) ;
29
+
30
+ done ( ) ;
31
+ } ) ;
32
+ } ) ;
33
+
34
+ } ) ;
Original file line number Diff line number Diff line change
1
+ --reporter spec
2
+ --recursive
You can’t perform that action at this time.
0 commit comments