@@ -56,16 +56,13 @@ const spinner = new ora( { text: '' } );
5656
5757// Create the production build and print the deployment instructions.
5858async function build ( webpackConfig ) {
59- // Start the build.
60- console . log ( '\n' ) ;
61- spinner . start ( `${ chalk . dim ( 'Building and compiling blocks...' ) } ` ) ;
62-
6359 // Compiler Instance.
6460 const compiler = await webpack ( webpackConfig ) ;
65- spinner . succeed ( ) ;
6661
6762 // Run the compiler.
6863 compiler . watch ( { } , ( err , stats ) => {
64+ clearConsole ( ) ;
65+
6966 if ( err ) {
7067 return console . log ( err ) ;
7168 }
@@ -80,10 +77,19 @@ async function build( webpackConfig ) {
8077 if ( messages . errors . length > 1 ) {
8178 messages . errors . length = 1 ;
8279 }
83- // Formatted errors.
80+
81+ // Clear success messages.
8482 clearConsole ( ) ;
83+
84+ // Formatted errors.
8585 console . log ( '\n❌ ' , chalk . black . bgRed ( ' Failed to compile. \n' ) ) ;
8686 const logErrors = console . log ( '\n👉 ' , messages . errors . join ( '\n\n' ) ) ;
87+ console . log ( '\n' ) ;
88+ spinner . start (
89+ chalk . dim (
90+ 'Watching for changes... let\'s fix this... (Press CTRL + C to stop).'
91+ )
92+ ) ;
8793 return logErrors ;
8894 }
8995
@@ -103,16 +109,17 @@ async function build( webpackConfig ) {
103109 return console . log ( messages . warnings . join ( '\n\n' ) ) ;
104110 }
105111
106- clearConsole ( ) ;
112+ // Start the build.
113+ console . log ( `\n${ chalk . dim ( 'Let\'s build and compile the files...' ) } ` ) ;
107114 console . log ( '\n✅ ' , chalk . black . bgGreen ( ' Compiled successfully! \n' ) ) ;
108115 console . log (
109- chalk . dim ( ' Watching for changes... (Press CTRL + C to stop). \n\n' )
110- ) ;
111- return console . log (
112- chalk . dim ( ' Note that the development build is not optimized. \n' ) ,
113- chalk . dim ( 'To create a production build, use' ) ,
116+ chalk . dim ( ' Note that the development build is not optimized. \n' ) ,
117+ chalk . dim ( ' To create a production build, use' ) ,
114118 chalk . green ( 'npm' ) ,
115- chalk . white ( 'run build' )
119+ chalk . white ( 'run build\n' )
120+ ) ;
121+ return spinner . start (
122+ `${ chalk . dim ( 'Watching for changes... (Press CTRL + C to stop).' ) } `
116123 ) ;
117124 } ) ;
118125}
0 commit comments