#!/bin/sh
# Cheap script to bundle for lambda, needs to be replaced with something better.
set -e

# This just makes it easier to find the static assets
rm -rf dist

yarn build:client:prod
yarn build:lambda


# https://github.com/yarnpkg/yarn/issues/696 equivalent of npm prune --production
yarn install --production --ignore-scripts --prefer-offline
# Copy all the hoisted modules into the unhoisted space.
cp -r ../../node_modules/* node_modules
mv node_modules dist/lambda/node_modules

# Package the lambda
cd dist/lambda
zip -r -qdgds 1m lambda.zip *
