@@ -42,7 +42,7 @@ const (
42
42
lfsVersionString = "version https://git-lfs.github.com/spec/v1"
43
43
)
44
44
45
- var ignoreInstallDirs = []string {"node_modules/" , "bower_components/" }
45
+ var installDirs = []string {"node_modules/" , "bower_components/" }
46
46
47
47
type uploadType int
48
48
type pointerData struct {
@@ -74,6 +74,7 @@ type DeployOptions struct {
74
74
SiteID string
75
75
Dir string
76
76
FunctionsDir string
77
+ BuildDir string
77
78
LargeMediaEnabled bool
78
79
79
80
IsDraft bool
@@ -190,8 +191,10 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
190
191
largeMediaEnabled = deploy .SiteCapabilities .LargeMediaEnabled
191
192
}
192
193
194
+ ignoreInstallDirs := options .Dir == options .BuildDir
195
+
193
196
context .GetLogger (ctx ).Infof ("Getting files info with large media flag: %v" , largeMediaEnabled )
194
- files , err := walk (options .Dir , options .Observer , largeMediaEnabled )
197
+ files , err := walk (options .Dir , options .Observer , largeMediaEnabled , ignoreInstallDirs )
195
198
if err != nil {
196
199
if options .Observer != nil {
197
200
options .Observer .OnFailedWalk ()
@@ -500,16 +503,10 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl
500
503
}
501
504
}
502
505
503
- var getwd = os .Getwd
504
-
505
- func walk (dir string , observer DeployObserver , useLargeMedia bool ) (* deployFiles , error ) {
506
+ func walk (dir string , observer DeployObserver , useLargeMedia , ignoreInstallDirs bool ) (* deployFiles , error ) {
506
507
files := newDeployFiles ()
507
- cwd , err := getwd ()
508
- if err != nil {
509
- return nil , err
510
- }
511
508
512
- err = filepath .Walk (dir , func (path string , info os.FileInfo , err error ) error {
509
+ err : = filepath .Walk (dir , func (path string , info os.FileInfo , err error ) error {
513
510
if err != nil {
514
511
return err
515
512
}
@@ -521,7 +518,7 @@ func walk(dir string, observer DeployObserver, useLargeMedia bool) (*deployFiles
521
518
}
522
519
rel := forceSlashSeparators (osRel )
523
520
524
- if ignoreFile (rel , dir == cwd ) {
521
+ if ignoreFile (rel , ignoreInstallDirs ) {
525
522
return nil
526
523
}
527
524
@@ -745,14 +742,14 @@ func goFile(filePath string, i os.FileInfo, observer DeployObserver) bool {
745
742
return true
746
743
}
747
744
748
- func ignoreFile (rel string , deployFromBuildDir bool ) bool {
745
+ func ignoreFile (rel string , ignoreInstallDirs bool ) bool {
749
746
if strings .HasPrefix (rel , "." ) || strings .Contains (rel , "/." ) || strings .HasPrefix (rel , "__MACOS" ) {
750
747
return ! strings .HasPrefix (rel , ".well-known/" )
751
748
}
752
- if ! deployFromBuildDir {
749
+ if ! ignoreInstallDirs {
753
750
return false
754
751
}
755
- for _ , ignorePath := range ignoreInstallDirs {
752
+ for _ , ignorePath := range installDirs {
756
753
if strings .HasPrefix (rel , ignorePath ) {
757
754
return true
758
755
}
0 commit comments