-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
transform.sh
executable file
·64 lines (56 loc) · 2.04 KB
/
transform.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# To run this script in development, first build the following packages:
# packages/@aws-cdk/assert
# packages/aws-cdk-lib
# tools/individual-pkg-gen
set -euo pipefail
scriptdir=$(cd $(dirname $0) && pwd)
# Creates a symlink in each individual package's node_modules folder pointing
# to the root folder's node_modules/.bin. This allows Yarn to find the executables
# it needs (e.g., jsii-rosetta) for the build.
#
# The reason Yarn doesn't find the executables in the first place is that they are
# not dependencies of each individual package -- nor should they be. They can't be
# found in the lerna workspace, either, since it only includes the individual
# packages. For potential alternatives to try out in the future, see
# https://github.com/cdklabs/cdk-ops/issues/1636
createSymlinks() {
find "$1" ! -path "$1" -type d -maxdepth 1 \
-exec mkdir -p {}/node_modules \; \
-exec ln -sf "${scriptdir}"/../node_modules/.bin {}/node_modules \;
}
runtarget="build"
run_tests="true"
skip_build=""
while [[ "${1:-}" != "" ]]; do
case $1 in
-h|--help)
echo "Usage: transform.sh [--skip-test/build]"
exit 1
;;
--skip-test|--skip-tests)
run_tests="false"
;;
--skip-build)
skip_build="true"
;;
*)
echo "Unrecognized options: $1"
exit 1
;;
esac
shift
done
if [ "$run_tests" == "true" ]; then
runtarget="$runtarget+test"
fi
export NODE_OPTIONS="--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}"
individual_packages_folder=${scriptdir}/../packages/individual-packages
# copy & build the packages that are individually released from 'aws-cdk-lib'
cd "$individual_packages_folder"
../../tools/@aws-cdk/individual-pkg-gen/bin/individual-pkg-gen
createSymlinks "$individual_packages_folder"
if [ "$skip_build" != "true" ]; then
TRANSFORM_CONCURRENCY=${TRANSFORM_CONCURRENCY:-8}
PHASE=transform yarn lerna run --stream --concurrency ${TRANSFORM_CONCURRENCY} $runtarget
fi