forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·38 lines (28 loc) · 848 Bytes
/
build.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
#!/bin/bash
set -euo pipefail
scriptdir=$(cd $(dirname $0) && pwd)
constructs_version="$(node -p "require('./package.json').devDependencies.constructs")"
rm -fr dist/js
echo "collecting all modules..."
outdir=$(node gen.js)
cd ${outdir}
echo "installing dependencies for bundling..."
npm install
echo "compiling..."
tsc
echo "packaging..."
npm pack
tarball=$PWD/monocdk-experiment-*.tgz
echo "verifying package..."
cd $(mktemp -d)
npm init -y
npm install ${tarball} constructs@${constructs_version}
node -e "require('monocdk-experiment')"
unpacked=$(node -p 'path.dirname(require.resolve("monocdk-experiment/package.json"))')
# saving tarball
cd ${scriptdir}
mkdir -p dist/js
cp ${tarball} dist/js
# so this module will also work as a local dependency (e.g. for modules under @monocdk-experiment/*).
rm -fr staging
mv ${unpacked} staging