-
Notifications
You must be signed in to change notification settings - Fork 18
/
init.sh
executable file
·44 lines (33 loc) · 1.19 KB
/
init.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
#!/bin/bash
# Initializes the dagger browser given the build directory of project of where to search for component graph files.
# If the build directory is not provided, the sample will be compiled and used an example.
# Usage: ./init.sh [build_dir]
set -eu
MANIFEST_FILENAME=ComponentsManifest.json
CLASSINFO_FILENAME=ClassInfo.json
main() {
local build_dir=${1:-}
# if component manifest is not provided, then we build the sample
if [ -z ${build_dir:-} ]; then
echo "Build directory is not provided. Compiling the sample..."
pushd plugin
./gradlew assemble
popd
build_dir=plugin/sample/build
fi
# Build ComponentstManifest.json
./scripts/mkmanifest.sh $build_dir browser/public/$MANIFEST_FILENAME
# TODO: Generate the class info file
local class_info_file="build/ClassInfo.json"
echo '{}' >|"$class_info_file"
# Copy it to the right location
cp -fR $class_info_file browser/public/$CLASSINFO_FILENAME
# Install dependencies
echo "Checking for any updated dependenecies..."
pushd browser
npm install
popd
echo "Init completed. Run a Browser:"
echo " cd browser; npm run start"
}
main $@