Skip to content

Commit

Permalink
Verify no mov-ai duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Andre Azevedo Quirino committed Jun 18, 2024
1 parent 2746d7f commit 2bd0c72
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/frontend-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,36 @@ jobs:
npm ci --loglevel verbose
fi

- name: Validate specified deps not duplicated
if: ${{ inputs.custom_deps_not_dup == 'true' }}
run: |
NPM=${{ inputs.pm }}

if test "$NPM" = "npm"; then
alias may_tail="cat -"
else
alias may_tail="tail -n +2"
fi

no_dupes_each() {
local dep
local count
while read dep; do
count="`$NPM list -lp $dep | may_tail | awk -F: '{print $2}' | sort -u | wc -l`"
test $count -eq 1 || return 1
done
return 0
}

dupe_check() {
local prop=$1
jq -r "if .$prop then .$prop|keys[] else empty end" package.json \
| grep "^@mov-ai" | no_dupes_each || exit 1
}

dupe_check dependencies
dupe_check peerDependencies

- name: Build
run: ${{ inputs.pm }} run build

Expand Down

0 comments on commit 2bd0c72

Please sign in to comment.