Skip to content

Commit 50cb189

Browse files
authored
chore: Add NPM duplicate dependency check to canaries (#11333)
1 parent f7c8974 commit 50cb189

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

.circleci/config.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -2512,7 +2512,10 @@ orbs:
25122512
no_output_timeout: 2m
25132513
- run-with-retry:
25142514
label: Install AmplifyJS
2515-
command: npm i -S aws-amplify && npm i -g wait-on serve
2515+
command: |
2516+
npm i -S aws-amplify
2517+
npm i -g wait-on serve
2518+
~/amplify-js/.circleci/duplicates-npm.sh
25162519
- run:
25172520
name: Call Amplify library in code
25182521
command: |

.circleci/duplicates-npm.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# This script detects duplicated Amplify dependencies in the dependency graph (with NPM)
4+
duplicatedDependencies=$(
5+
npm ls -all 2>/dev/null | \
6+
grep -o -e '@\?aws-amplify[^ ]*' | \
7+
sort | uniq | \
8+
sed -E 's/^(@?[^@]+).*$/\1/g' | \
9+
uniq -d | sort
10+
)
11+
12+
if [ ! "$duplicatedDependencies" ]; then
13+
echo "No duplicated Amplify dependencies detected."
14+
else
15+
echo "Duplicated Amplify dependencies detected: $duplicatedDependencies"
16+
false
17+
fi

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"bootstrap": "lerna bootstrap",
1010
"test": "lerna run test --stream",
1111
"test:size": "lerna run test:size",
12-
"test:duplicates": "./scripts/duplicates.sh",
12+
"test:duplicates": "./scripts/duplicates-yarn.sh",
1313
"cypress": "lerna run cypress",
1414
"cypress:open": "lerna run cypress:open",
1515
"coverage": "codecov || exit 0",

scripts/duplicates.sh scripts/duplicates-yarn.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# This script detects duplicated Amplify dependencies in the dependency graph
3+
# This script detects duplicated Amplify dependencies in the dependency graph (with Yarn)
44
duplicatedDependencies=$(
55
yarn list --pattern amplify |
66
grep -o -e '@\?aws-amplify[^ ]*' |

0 commit comments

Comments
 (0)