Skip to content

nx-ignore is too slow somehow #425

@SunStupic

Description

@SunStupic

I'm using nx-ignore in vercel.

The interesting thing is that it takes 2min30s to build my project but 2min50s to ignore my project.

You can see from the screenshot, it only takes 5s to install nx-ignore, but then nx-ignore used 2min50s to ignore my project.

image image

As a comparison, if I skip this step, it will only take 2min30s to build the whole project.

image

Here's the code in my vercel-ignore-build.sh

echo $VERCEL_ENV
echo $VERCEL_PROJECT_NAME
echo $VERCEL_GIT_COMMIT_REF

# When git branch is release-<project-name>, it is a release branch
if [[ $VERCEL_GIT_COMMIT_REF == release-* ]]; then
  # If release branch name matches project name, deploy this project
  if [ $VERCEL_PROJECT_NAME = ${VERCEL_GIT_COMMIT_REF#release-} ]; then
    echo "Triggered by push commit on release branch " $VERCEL_GIT_COMMIT_REF " of project " $VERCEL_PROJECT_NAME.
    exit 1;
  else
    echo "Ignore other project's release branch. Skip build for project " $VERCEL_PROJECT_NAME
    exit 0;
  fi
elif [ $VERCEL_GIT_COMMIT_REF = 'master' ]; then
  echo "Triggered by `master` branch push or PR merge"
  exit 1;
elif [ $VERCEL_ENV = 'production' ]; then
  echo "Triggered by vercel production branch push"
  exit 1;
else
  echo "compare with master branch in preview"

  npx nx-ignore $VERCEL_PROJECT_NAME
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions