@@ -11,7 +11,7 @@ class Init extends BaseCommand
1111{
1212 protected $ group = 'Codeigniter Vite ' ;
1313 protected $ name = 'vite:init ' ;
14- protected $ description = 'Initialize codeigniter vite module ' ;
14+ protected $ description = 'Initialize codeigniter vite package ' ;
1515
1616 /**
1717 * @var string
@@ -34,7 +34,7 @@ public function __construct()
3434 public function run (array $ params )
3535 {
3636 # Module start.
37- CLI ::write ('Initializing Codeigniter Vite Plugin 🔥⚡ ' , 'white ' , 'cyan ' );
37+ CLI ::write ('Initializing Codeigniter Vite 🔥⚡ ' , 'white ' , 'cyan ' );
3838 CLI ::newLine ();
3939
4040 # Set framework.
@@ -114,7 +114,7 @@ private function updateEnvFile()
114114 $ envFile = ROOTPATH . '.env ' ;
115115
116116 # For backup.
117- $ backupFile = 'env-BACKUP- ' . time ();
117+ $ backupFile = is_file ( $ envFile ) ? 'env-BACKUP- ' . time () : null ;
118118
119119 # Does exist? if not, generate it =)
120120 if (is_file ($ envFile ))
@@ -134,10 +134,13 @@ private function updateEnvFile()
134134 copy ($ this ->path . 'Config/env.default ' , ROOTPATH . '.env ' );
135135 }
136136
137- # set the backup file.
138- $ envContent = file_get_contents (ROOTPATH . '.env ' );
139- $ backupUpdate = str_replace ('VITE_BACKUP_FILE= ' , "VITE_BACKUP_FILE=' $ backupFile' " , $ envContent );
140- file_put_contents ($ envFile , $ backupUpdate );
137+ # set the backup name in the current one.
138+ if ($ backupFile )
139+ {
140+ $ envContent = file_get_contents (ROOTPATH . '.env ' );
141+ $ backupUpdate = str_replace ('VITE_BACKUP_FILE= ' , "VITE_BACKUP_FILE=' $ backupFile' " , $ envContent );
142+ file_put_contents ($ envFile , $ backupUpdate );
143+ }
141144
142145 # Define framework.
143146 if ($ this ->framework !== 'none ' )
0 commit comments