Documentation
¶
Overview ¶
Package libnodejs provides common capabilities for buildpacks interacting with Node.js ecosystem files and configuraton.
Index ¶
- Constants
- func FindNodeApplication(workingDir string) (string, error)
- func FindProjectPath(workingDir string) (string, error)
- func ResolveNodeVersion(resolver nodeResolver, plan packit.BuildpackPlan) (packit.BuildpackPlanEntry, []packit.BuildpackPlanEntry)
- func ShouldLaunchWithTini() (bool, error)
- type PackageJSON
Constants ¶
const LaunchPointEnvName = "BP_LAUNCHPOINT"
const LaunchWithTiniEnvName = "BP_LAUNCH_WITH_TINI"
const ProjectPathEnvName = "BP_NODE_PROJECT_PATH"
const StartScriptNameEnvName = "BP_NPM_START_SCRIPT"
const VerifyLaunchPointEnvName = "BP_VERIFY_LAUNCHPOINT"
Variables ¶
This section is empty.
Functions ¶
func FindNodeApplication ¶ added in v0.1.0
func FindProjectPath ¶
FindProjectPath will validate that project path exists and is valid relative to the working directory.
func ResolveNodeVersion ¶ added in v0.2.0
func ResolveNodeVersion(resolver nodeResolver, plan packit.BuildpackPlan) (packit.BuildpackPlanEntry, []packit.BuildpackPlanEntry)
func ShouldLaunchWithTini ¶ added in v0.5.0
ShouldLaunchWithTini reports whether BP_LAUNCH_WITH_TINI is set to a true boolean value. Returns false when the variable is unset.
Types ¶
type PackageJSON ¶
type PackageJSON struct {
Engines struct {
Node string `json:"node"`
} `json:"engines"`
Scripts struct {
PostStart string
PreStart string
Start string
}
Dependencies map[string]string `json:"dependencies"`
DevDependencies map[string]string `json:"devDependencies"`
AllScripts map[string]string `json:"scripts"`
}
PackageJSON represents the contents of a package.json file.
func ParsePackageJSON ¶
func ParsePackageJSON(path string) (PackageJSON, error)
ParsePackageJSON parses the contents of a package.json file.
func (PackageJSON) GetVersion ¶ added in v0.1.0
func (pj PackageJSON) GetVersion() string
func (PackageJSON) HasStartScript ¶
func (pj PackageJSON) HasStartScript() bool
HasStartScript indicates the presence of a start script in the package.json file or as defined by .