11import fs from "fs" ;
22import * as path from "path" ;
3- import { replaceAll } from "../../../util/string.js" ;
3+ import { replaceAll , toSanitized , toSlug } from "../../../util/string.js" ;
44import { fileURLToPath } from "url" ;
55import { Log } from "../../../log/index.js" ;
66
@@ -23,7 +23,7 @@ export const processPlayContent = (play) => {
2323} ;
2424
2525const createPlayDirectory = ( play ) => {
26- const play_directory = `${ PLAY_LIST_DIRECTORY } /${ play . kebab_name } ` ;
26+ const play_directory = `${ PLAY_LIST_DIRECTORY } /${ toSlug ( play . kebab_name ) } ` ;
2727 if ( ! fs . existsSync ( play_directory ) ) {
2828 fs . mkdirSync ( play_directory , { recursive : true } ) ;
2929 }
@@ -50,7 +50,7 @@ const replaceTemplateVar = (play_data, filePath) => {
5050 ) ;
5151 } ) ;
5252 fs . writeFile ( filePath , updated_result , "utf8" , function ( err ) {
53- if ( err ) return Log . log ( err ) ;
53+ if ( err ) return Log . log ( `Error: During file write: ${ err } , ${ play_data } ` ) ;
5454 } ) ;
5555 } ) ;
5656} ;
@@ -80,7 +80,7 @@ const processTemplate = (play, template_type, play_path) => {
8080 if ( template_type === "js" || template_type === "ts" ) {
8181 target_template_name = target_template_name . replace (
8282 "component" ,
83- play . title_name
83+ toSanitized ( play . title_name )
8484 ) ;
8585 }
8686 const file_path = `${ __filename } /${ TEMPLATE_DIRECTORY } /${ file_name } ` ;
0 commit comments