Skip to content

Commit

Permalink
Simplify documentation for Making your buildpack configurable
Browse files Browse the repository at this point in the history
Signed-off-by: linghengqian <linghengqian@outlook.com>
  • Loading branch information
linghengqian committed Sep 22, 2024
1 parent db64ef4 commit 97200cd
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ if [[ ! -f package.json ]]; then
fi

# ======= ADDED =======
plan=${CNB_BUILD_PLAN_PATH}
version=3.1.3

if [[ -f .node-js-version ]]; then
version=$(cat .node-js-version | tr -d '[:space:]')
version=$(< .node-js-version tr -d '[:space:]')
fi

echo "provides = [{ name = \"node-js\" }]" > "$plan"
echo "requires = [{ name = \"node-js\", metadata = { version = \"$version\" } }]" >> "$plan"
cat > "${CNB_BUILD_PLAN_PATH}" << EOL
provides = [{ name = "node-js" }]
requires = [{ name = "node-js", metadata = { version = "$version" } }]
EOL
# ======= /ADDED =======
```

Expand Down Expand Up @@ -72,7 +73,7 @@ else
fi

# 4. MAKE node-js AVAILABLE DURING LAUNCH and CACHE the LAYER
cat > "${CNB_LAYERS_DIR}/node-js.toml" << EOL
cat > "${CNB_LAYERS_DIR}/node-js.toml" << EOL
[types]
cache = true
launch = true
Expand All @@ -82,7 +83,7 @@ EOL

# ========== ADDED ===========
# 5. SET DEFAULT START COMMAND
cat >> "${CNB_LAYERS_DIR}/launch.toml" << EOL
cat > "${CNB_LAYERS_DIR}/launch.toml" << EOL
[[processes]]
type = "web"
command = ["node", "app.js"]
Expand Down

0 comments on commit 97200cd

Please sign in to comment.