Skip to content

Instantly share code, notes, and snippets.

@unicornware
Created February 5, 2021 16:25
Show Gist options
  • Save unicornware/347bd72d7604b3190e8adbf7b95af898 to your computer and use it in GitHub Desktop.
Save unicornware/347bd72d7604b3190e8adbf7b95af898 to your computer and use it in GitHub Desktop.
Vercel Ignored Build Step - Next.js, Storybook, & Serverless Function API Monorepo
#!/bin/bash
# Vercel Ignored Build Step
# If the following workflow exists with "0", the build will be skipped.
# If a code "1" or greater is returned, then a new deployment will be built.
# See: https://vercel.com/docs/platform/projects#ignored-build-step
# Common files to check for changes in the root of each package
COMMON_FILES="package.json tsconfig.json vercel.json"
# Check for changes in `packages/core`
CORE_PACKAGE="../core/src ../core/package.json ../core/tsconfig.json ../core/tsconfig.prod.json"
# Check for changes in root package
ROOT_PACKAGE="../../scripts ../../.vercelignore ../../babel.config.json ../../lerna.json ../../package.json ../../tsconfig.json ../../yarn.lock"
if [[ "$@" == "api" ]]; then
git diff HEAD^ HEAD --quiet api lib $COMMON_FILES $CORE_PACKAGE $ROOT_PACKAGE
elif [[ "$@" == "app" ]]; then
git diff HEAD^ HEAD --quiet plugins public scripts src babel.config.js next.config.js postcss.config.js robots-txt.config.js tsconfig.dev.json tsconfig.prod.json ../system/src/**/* ../system/src/index.ts ../system/package.json ../system/tsconfig.prod.json $COMMON_FILES $CORE_PACKAGE $ROOT_PACKAGE
elif [[ "$@" == "system" ]]; then
git diff HEAD^ HEAD --quiet .storybook src babel.config.js postcss.config.js tsconfig.app.json webpack.common.js $COMMON_FILES $CORE_PACKAGE $ROOT_PACKAGE
else
git diff HEAD^ HEAD --quiet $COMMON_FILES $ROOT_PACKAGE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment