forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
align-version.sh
executable file
·28 lines (23 loc) · 1.04 KB
/
align-version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#------------------------------------------------------------------------
# updates all package.json files to the version defined in lerna.json
# this is called when building inside our ci/cd system
#------------------------------------------------------------------------
set -euo pipefail
scriptdir=$(cd $(dirname $0) && pwd)
# go to repo root
cd ${scriptdir}/..
files="./package.json $(npx lerna ls -p -a | xargs -n1 -I@ echo @/package.json)"
${scriptdir}/align-version.js ${files}
# validation
marker=$(node -p "require('./scripts/resolve-version').marker.replace(/\./g, '\\\.')")
# Get a list of all package.json files. None of them shouldn contain 0.0.0 anymore.
# Exclude a couple of specific ones that we don't care about.
package_jsons=$(find . -name package.json |\
grep -v node_modules |\
grep -v packages/decdk/test/fixture/package.json |\
grep -v .github/actions/prlinter/package.json)
if grep -l "[^0-9]${marker}" $package_jsons; then
echo "ERROR: unexpected version marker ${marker} in a package.json file"
exit 1
fi