Skip to content

Instantly share code, notes, and snippets.

@devxom
Forked from SharpEdgeMarshall/entrypoint.sh
Created July 16, 2019 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devxom/1b16f3c470663a649c58f1d848e2585f to your computer and use it in GitHub Desktop.
Save devxom/1b16f3c470663a649c58f1d848e2585f to your computer and use it in GitHub Desktop.
Monkeypatch yarn issue #761
#!/bin/bash
# Monkeypatching yarn issue #761 installing with --production flag without devDependencies
if [ -n $NODE_ENV ] && [ "$NODE_ENV" == "production" ] || [ "$NODE_ENV" == "staging" ]
then
# Backup package.json and remove devDep
cp package.json original_package.json
jq 'del(.devDependencies)' package.json > tmp.json && mv tmp.json package.json
#Install
yarn --production
#Restore package.json
mv original_package.json package.json
else
yarn
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment