File tree Expand file tree Collapse file tree 7 files changed +33
-25
lines changed
test/generators/container Expand file tree Collapse file tree 7 files changed +33
-25
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const Generator = require('yeoman-generator');
3
3
const walk = require ( 'esprima-walk' ) ;
4
4
const utils = require ( '../app/utils' ) ;
5
5
6
- module . exports = class extends Generator {
6
+ class ActionGenerator extends Generator {
7
7
constructor ( args , opts ) {
8
8
super ( args , opts ) ;
9
9
this . argument ( 'name' , { type : String , required : true } ) ;
@@ -127,3 +127,5 @@ module.exports = class extends Generator {
127
127
this . attachToApp ( appPath , baseName ) ;
128
128
}
129
129
} ;
130
+
131
+ module . exports = ActionGenerator ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- let generator = require ( 'yeoman-generator' ) ;
2
+ const Generator = require ( 'yeoman-generator' ) ;
3
3
4
- module . exports = generator . Base . extend ( {
5
-
6
- constructor : function ( ) {
7
- generator . Base . apply ( this , arguments ) ;
4
+ class AppGenerator extends Generator {
8
5
6
+ constructor ( args , opts ) {
7
+ super ( args , opts ) ;
9
8
this . option ( 'skip-install' ) ;
10
- } ,
11
-
12
- install : function ( ) {
9
+ }
13
10
11
+ install ( ) {
14
12
if ( ! this . options [ 'skip-install' ] ) {
15
13
this . installDependencies ( { bower : false } ) ;
16
14
}
17
15
18
16
// Run the base react-webpack generator, then run the dispatcher
19
17
this . composeWith (
20
- 'react-webpack' ,
18
+ 'generator- react-webpack' ,
21
19
{
22
20
options : {
23
21
'skip-install' : this . options [ 'skip-install' ]
@@ -38,4 +36,6 @@ module.exports = generator.Base.extend({
38
36
this . npmInstall ( [ 'redux' , 'react-redux' ] , { 'save' : true } ) ;
39
37
} ) ;
40
38
}
41
- } ) ;
39
+ } ;
40
+
41
+ module . exports = AppGenerator ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- let generator = require ( 'yeoman-generator' ) ;
2
+ const Generator = require ( 'yeoman-generator' ) ;
3
3
4
- module . exports = generator . Base . extend ( {
4
+ module . exports = class ComponentGenerator extends Generator {
5
5
6
- constructor : function ( ) {
6
+ constructor ( ) {
7
7
generator . Base . apply ( this , arguments ) ;
8
8
this . argument ( 'name' , { type : String , required : true } ) ;
9
- } ,
10
-
11
- writing : function ( ) {
9
+ }
12
10
11
+ writing ( ) {
13
12
// Build options
14
13
let opts = { } ;
15
14
@@ -19,9 +18,9 @@ module.exports = generator.Base.extend({
19
18
20
19
this . composeWith ( 'react-webpack' , {
21
20
options : opts ,
22
- args : [ this . name ]
21
+ args : [ this . options . name ]
23
22
} , {
24
23
local : require . resolve ( 'generator-react-webpack/generators/component' )
25
24
} ) ;
26
25
}
27
- } ) ;
26
+ } ;
Original file line number Diff line number Diff line change 2
2
const Generator = require ( 'yeoman-generator' ) ;
3
3
const utils = require ( '../app/utils' ) ;
4
4
5
- module . exports = class extends Generator {
5
+ class ContainerGenerator extends Generator {
6
6
7
7
constructor ( args , opts ) {
8
8
super ( args , opts ) ;
@@ -26,3 +26,5 @@ module.exports = class extends Generator {
26
26
) ;
27
27
}
28
28
} ;
29
+
30
+ module . exports = ContainerGenerator ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const path = require('path');
4
4
const walk = require ( 'esprima-walk' ) ;
5
5
const utils = require ( '../app/utils' ) ;
6
6
7
- module . exports = class extends Generator {
7
+ class ReducerGenerator extends Generator {
8
8
constructor ( args , opts ) {
9
9
super ( args , opts ) ;
10
10
this . argument ( 'name' , { type : String , required : true } ) ;
@@ -147,3 +147,5 @@ module.exports = class extends Generator {
147
147
this . attachToApp ( appPath , baseName ) ;
148
148
}
149
149
} ;
150
+
151
+ module . exports = ReducerGenerator ;
Original file line number Diff line number Diff line change 2
2
const Generator = require ( 'yeoman-generator' ) ;
3
3
const fs = require ( 'fs' ) ;
4
4
5
- module . exports = class extends Generator {
5
+ class RootGenerator extends Generator {
6
6
7
+ /*
7
8
constructor(args, opts) {
8
- super ( args , opts ) ; // eslint-disable-line prefer-rest-params
9
- this . argument ( 'name' , { type : String , required : true } ) ;
9
+ super(args, opts);
10
10
}
11
+ */
11
12
12
13
writing ( ) {
13
14
/* Some base functionality needs to be overwritten, so we force yeoman to do
@@ -59,3 +60,5 @@ module.exports = class extends Generator {
59
60
) ;
60
61
}
61
62
} ;
63
+
64
+ module . exports = RootGenerator ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ describe('react-webpack-redux:container', () => {
17
17
. on ( 'end' , callback ) ;
18
18
}
19
19
20
- describe ( 'When creating a new action ' , ( ) => {
20
+ describe ( 'When creating a new container ' , ( ) => {
21
21
22
22
it ( 'should create the container file' , ( done ) => {
23
23
createGeneratedContainer ( 'TestContainer' , ( ) => {
You can’t perform that action at this time.
0 commit comments