rsnext/scripts/check-examples.sh
Oscar Busk 971b17f1e9
Add ci script to check examples (#28009)
* Add ci script to check examples

* Install moreutils for `sponge` command.

It's not very pretty, but I'm not sure how to replace sponge in a good way in the shell script

* Prettier names in the workflow

* Move "check-examples" into build_test_deploy workflow

* Start breaking the jq script into multiple lines

* Add checks for cleanups in vercel/next.js#27121

* Run the `check-examples.sh` script to cleanup all remaining examples.
2021-08-14 13:34:40 -05:00

20 lines
558 B
Bash
Executable file

#!/bin/bash
for folder in examples/* ; do
if [ -f "$folder/package.json" ]; then
cp -n packages/create-next-app/templates/default/gitignore $folder/.gitignore;
cat $folder/package.json | jq '
.private = true |
del(.license, .version, .name, .author, .description)
' | sponge $folder/package.json
fi
if [ -f "$folder/tsconfig.json" ]; then
cp packages/create-next-app/templates/typescript/next-env.d.ts $folder/next-env.d.ts
fi
done;
if [[ ! -z $(git status -s) ]];then
echo "Detected changes"
git status
exit 1
fi