Skip to content

Commit 93923cd

Browse files
authored
fix: CDK bugs (#1411)
1 parent 2c5afe2 commit 93923cd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lwcomponent/catalog.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ func CatalogCacheDir() (string, error) {
3636
return "", errors.Wrap(err, "unable to locate components directory")
3737
}
3838

39-
return filepath.Join(cacheDir, componentCacheDir), nil
39+
path := filepath.Join(cacheDir, componentCacheDir)
40+
41+
if _, err = os.Stat(path); err != nil {
42+
if err = os.MkdirAll(path, os.ModePerm); err != nil {
43+
return "", err
44+
}
45+
}
46+
47+
return path, nil
4048
}
4149

4250
type Catalog struct {
@@ -243,7 +251,11 @@ func NewCatalog(client *api.Client, stageConstructor StageConstructor) (*Catalog
243251
return nil, err
244252
}
245253

246-
rawComponents := response.Data[0].Components
254+
var rawComponents []api.LatestComponentVersion
255+
256+
if len(response.Data) > 0 {
257+
rawComponents = response.Data[0].Components
258+
}
247259

248260
cdkComponents := make(map[string]CDKComponent, len(rawComponents)+len(localComponents))
249261

0 commit comments

Comments
 (0)