From 1ed40efb08fb025407120a2a4f469c74c9e56790 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 30 Dec 2024 17:42:56 +0100 Subject: [PATCH] feat: only format when package.json exists --- scripts/sync.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/sync.sh b/scripts/sync.sh index aee2054..1aaf71a 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -271,13 +271,17 @@ function create_workspace { } function format { - header "FORMATTING" - local -r repo_path=$1 - ( - cd "$repo_path" - npm ci --legacy-peer-deps - npx prettier --write "*.md" .github - ) + header "FORMATTING" + local -r repo_path=$1 + if [ ! -f "$repo_path/package.json" ]; then + echo "Skipping formatting as package.json does not exist in $repo_path" + return + fi + ( + cd "$repo_path" + npm ci --legacy-peer-deps + npx prettier --write "*.md" .github + ) } function install_dependencies_on_ci {