From 6ee07b7b07cad0ce3a435d07737f7eab5454f921 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright Date: Mon, 30 Dec 2024 10:10:15 +1100 Subject: [PATCH] allow no services --- pkg/project/project.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/project/project.go b/pkg/project/project.go index 99f8231b..9177acf9 100644 --- a/pkg/project/project.go +++ b/pkg/project/project.go @@ -69,10 +69,6 @@ func (p *Project) GetBatchServices() []Batch { func (p *Project) BuildBatches(fs afero.Fs, useBuilder bool) (chan ServiceBuildUpdate, error) { updatesChan := make(chan ServiceBuildUpdate) - if len(p.services) == 0 { - return nil, fmt.Errorf("no services found in project, nothing to build. This may indicate misconfigured `match` patterns in your nitric.yaml file") - } - maxConcurrentBuilds := make(chan struct{}, min(goruntime.NumCPU(), goruntime.GOMAXPROCS(0))) waitGroup := sync.WaitGroup{} @@ -130,10 +126,6 @@ func (p *Project) BuildBatches(fs afero.Fs, useBuilder bool) (chan ServiceBuildU func (p *Project) BuildServices(fs afero.Fs, useBuilder bool) (chan ServiceBuildUpdate, error) { updatesChan := make(chan ServiceBuildUpdate) - if len(p.services) == 0 { - return nil, fmt.Errorf("no services found in project, nothing to build. This may indicate misconfigured `match` patterns in your nitric.yaml file") - } - maxConcurrentBuilds := make(chan struct{}, min(goruntime.NumCPU(), goruntime.GOMAXPROCS(0))) waitGroup := sync.WaitGroup{} @@ -573,6 +565,10 @@ func fromProjectConfiguration(projectConfig *ProjectConfiguration, localConfig * return nil, fmt.Errorf("unable to match service files for pattern %s: %w", serviceMatch, err) } + if len(files) == 0 { + return nil, fmt.Errorf("unable to match service files for pattern %s. This may indicate misconfigured `match` patterns in your nitric.yaml file", serviceMatch) + } + for _, f := range files { relativeServiceEntrypointPath, _ := filepath.Rel(filepath.Join(projectConfig.Directory, baseService.GetBasedir()), f) projectRelativeServiceFile := filepath.Join(projectConfig.Directory, f)