From f133e9d9a0ced4737b2cc88ad873b04f357b755d Mon Sep 17 00:00:00 2001 From: Johan de Klerk <johan@shiplogic.com> Date: Thu, 17 Nov 2022 09:53:33 +0200 Subject: [PATCH] Copy nested stack to handler folder --- mage_helpers/cdk.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mage_helpers/cdk.go b/mage_helpers/cdk.go index 6f0ce01..11aef4a 100644 --- a/mage_helpers/cdk.go +++ b/mage_helpers/cdk.go @@ -7,7 +7,9 @@ import ( "io/ioutil" "os" "os/exec" + "path/filepath" "strconv" + "strings" ) func CDKCompileTypeScript(cdkDir string) error { @@ -223,6 +225,24 @@ func CDKSynthDebug(cdkDir string, env string, handler string, appName string, pr return err } + // Copy nested stack to handler_api folder + + err = filepath.Walk(cdkDir+"/cdk.out/", func(path string, info os.FileInfo, err error) error { + if strings.Contains(path, "nested.template.json") { + + filename := filepath.Base(path) + err := Copy(path, "./core/"+handler+"/"+filename) + if err != nil { + return err + } + } + + return nil + }) + if err != nil { + return err + } + return nil } -- GitLab