forked from loopbackio/loopback-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-docs-site.sh
executable file
·49 lines (37 loc) · 1.39 KB
/
build-docs-site.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
#!/bin/bash
# This script builds/verifies that `docs` is able to be served by `loopback.io`
# site. It runs the following steps:
# 1. Clone `strongloop/loopback.io` github repository into `sandbox`
# 2. Bootstrap `loopback.io` package using `lerna` to use `docs` folder for
# `@loopback/docs` dependency
# 3. Run `npm run build` for `loopback.io` module to make sure jekyll can
# generate the web site successfully
# Set `-e` so that non-zero exit code from any step will be honored
set -e
# Set `-v` (verbose) for travis build
if [ -n "$TRAVIS" ]; then
set -v
fi
# Make sure we use the correct repo root dir
DIR=`dirname $0`
REPO_ROOT=$DIR/..
pushd $REPO_ROOT >/dev/null
# Update README duplicates inside docs/site/readmes
node docs/bin/copy-readmes.js
# Clean up sandbox/loopback.io directory
rm -rf sandbox/loopback.io/
# Shadow clone the `strongloop/loopback.io` github repo
git clone --depth 1 https://github.com/strongloop/loopback.io.git sandbox/loopback.io
# Bootstrap the `loopback.io` package
lerna bootstrap --scope loopback.io-workflow-scripts
pushd $REPO_ROOT/sandbox/loopback.io/ >/dev/null
# Run bundle install for ruby gems required for `loopback.io`
bundle install
# Run npm build script to fetch readme files and generate jekyll site
npm run build
popd >/dev/null
if [ "$1" == "--verify" ]; then
# Clean up sandbox/loopback.io/ if `--verify`
rm -rf sandbox/loopback.io/
fi
popd >/dev/null