@@ -12,8 +12,9 @@ import (
1212)
1313
1414type BuildOpts struct {
15- Dir string
16- Verbose bool
15+ Dir string
16+ Verbose bool
17+ DistPath string
1718}
1819
1920func verifyEnvironment (verbose bool ) error {
@@ -130,6 +131,33 @@ func verifyTsunamiDir(dir string) error {
130131 return nil
131132}
132133
134+ func verifyDistPath (distPath string ) error {
135+ if distPath == "" {
136+ return fmt .Errorf ("distPath cannot be empty" )
137+ }
138+
139+ // Check if directory exists
140+ info , err := os .Stat (distPath )
141+ if err != nil {
142+ if os .IsNotExist (err ) {
143+ return fmt .Errorf ("distPath directory %q does not exist" , distPath )
144+ }
145+ return fmt .Errorf ("error accessing distPath directory %q: %w" , distPath , err )
146+ }
147+
148+ if ! info .IsDir () {
149+ return fmt .Errorf ("distPath %q is not a directory" , distPath )
150+ }
151+
152+ // Check for index.html file
153+ indexPath := filepath .Join (distPath , "index.html" )
154+ if err := CheckFileExists (indexPath ); err != nil {
155+ return fmt .Errorf ("index.html check failed in distPath %q: %w" , distPath , err )
156+ }
157+
158+ return nil
159+ }
160+
133161func TsunamiBuild (opts BuildOpts ) error {
134162 if err := verifyEnvironment (opts .Verbose ); err != nil {
135163 return err
@@ -139,6 +167,10 @@ func TsunamiBuild(opts BuildOpts) error {
139167 return err
140168 }
141169
170+ if err := verifyDistPath (opts .DistPath ); err != nil {
171+ return err
172+ }
173+
142174 // Create temporary directory
143175 tempDir , err := os .MkdirTemp ("" , "tsunami-build-*" )
144176 if err != nil {
0 commit comments