refactor(node): avoid duplicate detection log messages (#649)

* refactor(node): remove duplicate log messages in Nx package resolution

Generated-by: aiautocommit

* refactor(node): prevent duplicate custom start log messages

- Move the custom start command log message from `isSPA` to `Plan` so it runs once during provider planning rather than during SPA checks.
- Add log message for Nx app resolution in the build step.

Generated-by: aiautocommit
This commit is contained in:
Michael Bianco
2026-07-27 12:58:03 -06:00
committed by GitHub
parent 961af4b126
commit 3a92acc8df
3 changed files with 7 additions and 7 deletions
+6
View File
@@ -93,6 +93,11 @@ func (p *NodeProvider) Plan(ctx *generate.GenerateContext) error {
}
isSPA := p.isSPA(ctx)
if !isSPA && !ctx.Env.IsConfigVariableTruthy("NO_SPA") && p.hasCustomStartCommand(ctx) {
// it's easy for a user to trip over this wire and not understand that it would impact SPA deployment since using the start script
// is somewhat if a railpack-convention, so let's make it clear to them.
ctx.Logger.LogInfo("Custom start command detected, skipping Caddy start")
}
miseStep := ctx.GetMiseStepBuilder()
p.InstallMisePackages(ctx, miseStep)
@@ -219,6 +224,7 @@ func (p *NodeProvider) Build(ctx *generate.GenerateContext, build *generate.Comm
}
} else if _, projectName, ok := p.resolveNxDeployPackage(ctx); ok {
// TODO this `resolveNxDeployPackage` logic feels messy, we should refactor this a bit
ctx.Logger.LogInfo("Using Nx app %s", projectName)
// Nx infers targets from plugins; root package.json often has no build script
build.AddCommands([]plan.Command{
+1 -4
View File
@@ -132,7 +132,6 @@ func (p *NodeProvider) resolveNxDeployPackage(ctx *generate.GenerateContext) (*W
for _, pkg := range packages {
if matchesNxAppSelector(pkg, selector) {
name := nxProjectName(pkg)
ctx.Logger.LogInfo("Using Nx app %s (RAILPACK_NX_APP=%s)", name, selector)
return pkg, name, true
}
}
@@ -143,9 +142,7 @@ func (p *NodeProvider) resolveNxDeployPackage(ctx *generate.GenerateContext) (*W
if len(packages) == 1 {
pkg := packages[0]
name := nxProjectName(pkg)
ctx.Logger.LogInfo("Using Nx app %s", name)
return pkg, name, true
return pkg, nxProjectName(pkg), true
}
names := make([]string, 0, len(packages))
-3
View File
@@ -31,9 +31,6 @@ func (p *NodeProvider) isSPA(ctx *generate.GenerateContext) bool {
// If there is a custom start command, we don't want to deploy with Caddy as an SPA
if p.hasCustomStartCommand(ctx) {
// it's easy for a user to trip over this wire and not understand that it would impact SPA deployment since using the start script
// is somewhat if a railpack-convention, so let's make it clear to them.
ctx.Logger.LogInfo("Custom start command detected, skipping Caddy start")
return false
}