Skip to content

Commit

Permalink
separate netlify build tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
cheapsteak committed Nov 19, 2017
1 parent f4901bc commit 3f32ce1
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions scripts/netlify-build.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
#!/bin/sh

mkdir netlify-build
# Make sure to set $BUILD_CONTEXT in the Netlify "Deploy Settings"
echo "Building for Netlify. BUILD_CONTEXT: $BUILD_CONTEXT"

yarn
yarn add gauge --ignore-workspace-root-check # netlify quirk
yarn bootstrap --core

echo "netlify-build docs"
pushd docs
yarn install
popd
yarn docs:build
mv docs/public/* netlify-build/

echo "netlify-build React examples"
pushd examples/cra-kitchen-sink
yarn add tapable # netlify quirk
yarn build-storybook
mv storybook-static ../../netlify-build/cra-kitchen-sink
popd

echo "netlify-build Vue examples"
pushd examples/vue-kitchen-sink
yarn build-storybook
mv storybook-static ../../netlify-build/vue-kitchen-sink
popd
if [ "$BUILD_CONTEXT" = "DOCS" ]; then

echo "netlify-build docs"
pushd docs
yarn install
popd
yarn docs:build
mv docs/public netlify-build

elif [ "$BUILD_CONTEXT" = "CRA" ]; then

echo "netlify-build React examples"
pushd examples/cra-kitchen-sink
yarn add tapable # netlify quirk
yarn build-storybook
mv storybook-static ../../netlify-build
popd

elif [ "$BUILD_CONTEXT" = "VUE" ]; then

echo "netlify-build Vue examples"
pushd examples/vue-kitchen-sink
yarn build-storybook
mv storybook-static ../../netlify-build
popd

else
RED='\033[0;31m'
NOCOLOR='\033[0m'
echo "Unrecognized BUILD_CONTEXT \"${RED}$BUILD_CONTEXT${NOCOLOR}\"" 1>&2

fi

0 comments on commit 3f32ce1

Please sign in to comment.