@@ -19,17 +19,18 @@ const ANGULAR_CONF_FILE = './angular.json';
1919export default ( options : Schema ) : Rule => {
2020 options . name = toAscii ( options . name ) || 'blog' ;
2121 options . slug = toAscii ( options . slug ) || 'id' ;
22+ options . route = toAscii ( options . route ) || options . name ;
2223 options . sourceDir = options . sourceDir || options . name ;
2324 return chain ( [
24- addPost ( options , options . sourceDir ) ,
25- updateScullyConfig ( options . sourceDir , options ) ,
25+ addPost ( options ) ,
26+ updateScullyConfig ( options ) ,
2627 addModule ( options ) ,
2728 ] ) ;
2829} ;
2930
30- const addPost = ( options : Schema , target : string ) => ( tree : Tree , context : SchematicContext ) => {
31+ const addPost = ( options : Schema ) => ( tree : Tree , context : SchematicContext ) => {
3132 const nameDasherized = strings . dasherize ( options . name ) ;
32- const targetDirName = strings . dasherize ( target ) ;
33+ const targetDirName = strings . dasherize ( options . sourceDir ) ;
3334 const date = new Date ( ) ;
3435 // format yyyy-mm-dd
3536 const fullDay = date . toISOString ( ) . substring ( 0 , 10 ) ;
@@ -43,7 +44,7 @@ const addPost = (options: Schema, target: string) => (tree: Tree, context: Schem
4344 }
4445} ;
4546
46- const updateScullyConfig = ( target : string , options : Schema ) => ( tree : Tree , context : SchematicContext ) => {
47+ const updateScullyConfig = ( options : Schema ) => ( tree : Tree , context : SchematicContext ) => {
4748 const scullyJs = getFileContents ( tree , SCULLY_CONF_FILE ) ;
4849 if ( ! scullyJs ) {
4950 context . logger . error ( `No scully configuration file found ${ SCULLY_CONF_FILE } ` ) ;
@@ -52,7 +53,7 @@ const updateScullyConfig = (target: string, options: Schema) => (tree: Tree, con
5253 name : options . name ,
5354 slug : options . slug ,
5455 type : 'contentFolder' ,
55- sourceDir : target ,
56+ sourceDir : options . sourceDir ,
5657 route : options . route ,
5758 } ) ;
5859
0 commit comments