()
| 11 | const app = process.argv[2] || path.basename(path.resolve()) |
| 12 | |
| 13 | const stepCheck = () => { |
| 14 | // no app name (directory) was passed in via args |
| 15 | if (!app) { |
| 16 | return abortBuild() |
| 17 | } |
| 18 | |
| 19 | // get all file names changed in last commit |
| 20 | // const fileNameList = childProcess |
| 21 | // .execSync("git diff --name-only HEAD~1") |
| 22 | // .toString() |
| 23 | // .trim() |
| 24 | // .split("\n"); |
| 25 | |
| 26 | // This modification checks against the previous successful deploy commit SHA, which is provided by vercel now. (https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables) |
| 27 | const fileNameList = childProcess |
| 28 | .execSync(`git diff ${process.env.VERCEL_GIT_PREVIOUS_SHA} HEAD --name-only ./`) |
| 29 | .toString() |
| 30 | .trim() |
| 31 | .split('\n') |
| 32 | |
| 33 | // check if any files in the app, or in any shared packages have changed |
| 34 | const shouldBuild = fileNameList.some(file => file.startsWith(`script-hub`) || file.startsWith('preview')) |
| 35 | |
| 36 | if (shouldBuild) { |
| 37 | return continueBuild() |
| 38 | } |
| 39 | |
| 40 | return abortBuild() |
| 41 | } |
| 42 | |
| 43 | stepCheck() |
no test coverage detected