yarnstart

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

Paketo Yarn Start Cloud Native Buildpack

gcr.io/paketo-buildpacks/yarn-start

The Yarn Start CNB sets the start command for the given application. The start command is generated from the contents of package.json. For example, given a package.json with the following content:

{
  "scripts": {
    "prestart": "<prestart-command>",
    "poststart": "<poststart-command>",
    "start": "<start-command>"
  }
}

The start command will be <prestart-command> && <start-command> && <poststart-command>.

Integration

This CNB sets a start command, so there's currently no scenario we can imagine that you would need to require it as dependency.

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh --version <version-number>

This will create a buildpackage.cnb file under the build directory which you can use to build your app as follows:

pack build <app-name> -p <path-to-app> -b <path/to/node-engine.cnb> -b \
<path/to/yarn.cnb> -b <path/to/yarn-install.cnb> -b build/buildpackage.cnb

Graceful shutdown and signal handling

You can add signal handlers in your app to support graceful shutdown and program interrupts. If running a node server is the start command, the buildpack runs the node server as the init process, and thus it ignores any signal with the default action. As a result, the process will not terminate on SIGINT or SIGTERM unless it is coded to do so. You can also use docker's --init flag to wrap your node process with an init system that will properly handle signals.

Specifying a project path

To specify a project subdirectory to be used as the root of the app, please use the BP_NODE_PROJECT_PATH environment variable at build time either directly (ex. pack build my-app --env BP_NODE_PROJECT_PATH=./src/my-app) or through a project.toml file. This could be useful if your app is a part of a monorepo.

buildpack.yml Configurations

There are no extra configurations for this buildpack based on buildpack.yml.

Documentation

Index

Constants

View Source
const (
	Node        = "node"
	NodeModules = "node_modules"
)

Variables

This section is empty.

Functions

func Build

func Build(pathParser PathParser, logger scribe.Logger) packit.BuildFunc

func Detect

func Detect(projectPathParser PathParser) packit.DetectFunc

Types

type PathParser added in v0.0.5

type PathParser interface {
	Get(path string) (projectPath string, err error)
}

type ProjectPathParser added in v0.0.5

type ProjectPathParser struct{}

ProjectPathParser provides a mechanism for determining the proper working directory for the build process.

func NewProjectPathParser added in v0.0.5

func NewProjectPathParser() ProjectPathParser

NewProjectPathParser creates an instance of a ProjectPathParser.

func (ProjectPathParser) Get added in v0.0.5

func (p ProjectPathParser) Get(path string) (string, error)

Get will resolve the absolute path of the directory specified by the $BP_NODE_PROJECT_PATH environment variable. It assumes that $BP_NODE_PROJECT_PATH is relative to the provided path argument.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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