Skip to content

Instantly share code, notes, and snippets.

@SharpEdgeMarshall
Last active July 16, 2019 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SharpEdgeMarshall/77f7875ddb3327523ce0e40477153bc9 to your computer and use it in GitHub Desktop.
Save SharpEdgeMarshall/77f7875ddb3327523ce0e40477153bc9 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