forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-samples
executable file
·34 lines (30 loc) · 1.05 KB
/
compile-samples
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
#!/bin/bash
# A wee little script to compile samples in a package directory.
#
# Normally, samples are only compiled when doing 'pack.sh', if you are iterating
# on them you can use this script for quicker feedback.
#
# This could maybe have been an 'npm run' script, but it's not self-contained
# (needs the "decdk" package to compile against and runs jsii-rosetta from the
# repo root) so that didn't feel right. For now this is what we have.
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
dirs="${@:-$PWD}"
for dir in $dirs; do
(
cd $dir
if [[ ! -f package.json ]]; then
echo "Run this against a directory with package.json in it (got: $PWD)" >&2
exit 1
fi
# Run jsii
npm run build
# Run rosetta against decdk dir, failing on compilation errors
node --experimental-worker $scriptdir/../node_modules/.bin/jsii-rosetta \
--directory $scriptdir/../packages/decdk \
--compile \
--output /dev/null \
--verbose \
--fail
)
done