libnodejs

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 22

README

libnodejs

Common code shared between Node.js buildpacks

Documentation

Overview

Package libnodejs provides common capabilities for buildpacks interacting with Node.js ecosystem files and configuraton.

Index

Constants

View Source
const LaunchPointEnvName = "BP_LAUNCHPOINT"
View Source
const ProjectPathEnvName = "BP_NODE_PROJECT_PATH"
View Source
const StartScriptNameEnvName = "BP_NPM_START_SCRIPT"
View Source
const VerifyLaunchPointEnvName = "BP_VERIFY_LAUNCHPOINT"

Variables

This section is empty.

Functions

func FindNodeApplication added in v0.1.0

func FindNodeApplication(workingDir string) (string, error)

func FindProjectPath

func FindProjectPath(workingDir string) (string, error)

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)

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 .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL