@@ -41,26 +41,26 @@ async function setup_theme(themeName) {
4141 try {
4242 // Check if theme name is in kebab-case
4343 if ( ! isKebabCase ( themeName ) ) {
44- console . error (
45- chalk . orange ( 'Theme name must be in kebab-case (example-theme-name). ')
44+ console . log (
45+ chalk . red ( '\nTheme name must be in kebab-case (example-theme-name')
4646 ) ;
47- return ;
47+ return false ;
4848 }
4949
5050 // Ensure the current working directory ends with wp-themes
5151 const cwd = process . cwd ( ) ;
5252 if ( ! cwd . endsWith ( 'wp-themes' ) ) {
53- console . error (
54- chalk . orange ( 'This command needs to be run inside a wp-themes folder.')
53+ console . log (
54+ chalk . red ( '\nThis command needs to be run inside a wp-themes folder.')
5555 ) ;
56- return ;
56+ return false ;
5757 }
5858
5959 // Check if theme directory already exists
6060 const newThemePath = path . join ( '.' , themeName ) ;
6161 if ( fs . existsSync ( newThemePath ) ) {
62- console . error ( chalk . orange ( 'A theme with this name already exists.') ) ;
63- return ;
62+ console . log ( chalk . red ( '\nTA theme with this name already exists.') ) ;
63+ return false ;
6464 }
6565
6666 // Fetch the latest release URL from GitHub API
@@ -99,7 +99,9 @@ async function setup_theme(themeName) {
9999 fs . unlinkSync ( 'theme-redone.zip' ) ;
100100
101101 console . log (
102- 'Theme has been set up. Please activate the theme from the WordPress admin panel.'
102+ chalk . green (
103+ 'Theme has been set up. Please activate the theme from the WordPress admin panel.'
104+ )
103105 ) ;
104106
105107 // Read package.json and extract Node version
@@ -114,7 +116,8 @@ async function setup_theme(themeName) {
114116 'Then, run "npm i" and "composer i" from the theme root directory.'
115117 ) ;
116118 } catch ( error ) {
117- console . error ( chalk . orange ( `Error setting up theme: ${ error . message } ` ) ) ;
119+ console . error ( chalk . red ( `Error setting up theme: ${ error . message } ` ) ) ;
120+ return false ;
118121 }
119122}
120123
0 commit comments