Skip to content

Commit a62cbcf

Browse files
committed
extract shared copy ignore lists into package-level variables
1 parent b1312a7 commit a62cbcf

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

internal/pkg/create/create.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ import (
4545
"github.com/spf13/afero"
4646
)
4747

48+
// copyIgnoreDirectories are directories to skip when copying a template.
49+
var copyIgnoreDirectories = []string{".git", ".venv", "node_modules"}
50+
51+
// copyIgnoreFiles are files to skip when copying a template.
52+
var copyIgnoreFiles = []string{".DS_Store"}
53+
4854
// CreateArgs are the arguments passed into the Create function
4955
type CreateArgs struct {
5056
AppName string
@@ -337,8 +343,8 @@ func createApp(ctx context.Context, dirPath string, template Template, gitBranch
337343
copyDirectoryOpts := goutils.CopyDirectoryOpts{
338344
Src: template.path,
339345
Dst: dirPath,
340-
IgnoreDirectories: []string{".git", ".venv", "node_modules"},
341-
IgnoreFiles: []string{".DS_Store"},
346+
IgnoreDirectories: copyIgnoreDirectories,
347+
IgnoreFiles: copyIgnoreFiles,
342348
}
343349
if err := goutils.CopyDirectory(copyDirectoryOpts); err != nil {
344350
return slackerror.Wrap(err, "error copying local template")
@@ -403,8 +409,8 @@ func createAppFromSubdir(ctx context.Context, dirPath string, template Template,
403409
return goutils.CopyDirectory(goutils.CopyDirectoryOpts{
404410
Src: subdirPath,
405411
Dst: dirPath,
406-
IgnoreDirectories: []string{".git", ".venv", "node_modules"},
407-
IgnoreFiles: []string{".DS_Store"},
412+
IgnoreDirectories: copyIgnoreDirectories,
413+
IgnoreFiles: copyIgnoreFiles,
408414
})
409415
}
410416

0 commit comments

Comments
 (0)