mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:33:30 +02:00
Add a "compact" script to the buildpack to reduce final image size. Realized that webpack was always required even though it's a devDep; made it so that it doesn't have to be loaded.
This commit is contained in:
27
buildpack/buildpacks/node/bin/compact
Executable file
27
buildpack/buildpacks/node/bin/compact
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e # fail fast
|
||||
set -o pipefail # don't ignore exit codes when piping output
|
||||
# set -x # enable debugging
|
||||
|
||||
# Configure directories
|
||||
build_dir=$1
|
||||
cache_dir=$2
|
||||
env_dir=$3
|
||||
|
||||
bp_dir=$(cd $(dirname $0); cd ..; pwd)
|
||||
|
||||
# Load some convenience functions like status() and indent()
|
||||
source $bp_dir/bin/common.sh
|
||||
|
||||
# Output npm debug info on error
|
||||
trap cat_npm_debug_log ERR
|
||||
|
||||
# Run subsequent node/npm commands from the build path
|
||||
cd $build_dir
|
||||
|
||||
# Run twice as we may be able to remove a few more dependencies
|
||||
# on the second run
|
||||
status "Pruning development dependencies"
|
||||
npm prune --production --userconfig $build_dir/.npmrc 2>&1 | indent
|
||||
npm prune --production --userconfig $build_dir/.npmrc 2>&1 | indent
|
||||
Reference in New Issue
Block a user