From 12b4df3067afc703b7585debdcc348a7bfd2df65 Mon Sep 17 00:00:00 2001 From: Davor Gajic Date: Wed, 29 Nov 2023 13:50:09 +0100 Subject: [PATCH] add the builder to the buildpack --- build.go | 18 ++++++++++++++++++ run/main.go | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 build.go diff --git a/build.go b/build.go new file mode 100644 index 0000000..09d4ce9 --- /dev/null +++ b/build.go @@ -0,0 +1,18 @@ +package enable + +import ( + "os" + + "github.com/paketo-buildpacks/packit/v2" + "github.com/paketo-buildpacks/packit/v2/scribe" +) + +func Build(logger scribe.Emitter) packit.BuildFunc { + return func(context packit.BuildContext) (packit.BuildResult, error) { + if os.Getenv("BP_INCLUDE_NODEJS_RUNTIME") == "true" { + logger.Title("%s %s", context.BuildpackInfo.ID, context.BuildpackInfo.Version) + logger.Process("NodeJS was configured for execution at runtime") + } + return packit.BuildResult{}, nil + } +} diff --git a/run/main.go b/run/main.go index 31aa98d..ee812aa 100644 --- a/run/main.go +++ b/run/main.go @@ -10,5 +10,5 @@ import ( func main() { logger := scribe.NewEmitter(os.Stdout).WithLevel(os.Getenv("BP_LOG_LEVEL")) - packit.Detect(enable.Detect(logger)) + packit.Run(enable.Detect(logger), enable.Build(logger)) }