Skip to content

Commit

Permalink
Add bootstrap script, simplify fetch script, simplify installation in…
Browse files Browse the repository at this point in the history
…structions
  • Loading branch information
sapegin committed Dec 11, 2017
1 parent 9d33b2e commit 1249648
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 39 deletions.
20 changes: 4 additions & 16 deletions README.md
Expand Up @@ -6,31 +6,19 @@ This is the source of [https://survivejs.com/](https://survivejs.com/).

**You need [git-lfs](https://github.com/git-lfs/git-lfs) to clone this repository.**

First, clone this repository and the book ones:
First, clone this repository:

```
git clone https://github.com/survivejs/site
git clone https://github.com/survivejs/webpack-book site/books/webpack-book
git clone https://github.com/survivejs/react-book site/books/react-book
git clone https://github.com/survivejs/maintenance-book site/books/maintenance-book
```

Then, you need to build each project (it is needed to build the site):
Then, bootstrap the project:

```
cd site/react-book/project_source
npm install
./build_all.js
npm run bootstrap
```

Now going back to the `site` project, you need to install the dependencies:

```
cd ../..
npm install
```

Finally, you can start the development server:
Finally, start the development server:

```
npm start
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -9,6 +9,7 @@
"build": "npm run fetch:books && node ./antwar.bootstrap.js build && npm run sitemap && npm run copy:all",
"deploy": "gh-pages -d build && npm run purge_cf",
"fetch:books": "scripts/fetch-books.sh",
"bootstrap": "scripts/bootstrap.sh",
"sitemap": "cd build && sitemap-static --prefix=https://survivejs.com/ > sitemap.xml",
"lint": "eslint . --ext js --ext jsx --ignore-path .gitignore --cache",
"purge_cf": "node ./utils/purge_cf.js",
Expand Down
25 changes: 25 additions & 0 deletions scripts/bootstrap.sh
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -e # Exit with nonzero exit code if anything fails

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Fetch books repositories
echo
echo "Fetching books repositories..."
"$DIR/fetch-books.sh"

# Build each project (it is needed to build the site)
echo
echo "Building projects..."
cd books/react-book/project_source
npm install
node build_all.js
cd -

echo
echo "Installing dependencies..."
npm install

echo
echo "Done!"
36 changes: 13 additions & 23 deletions scripts/fetch-books.sh
@@ -1,26 +1,16 @@
#!/bin/bash
set -e # Exit with nonzero exit code if anything fails

mkdir -p books
mkdir -p books/maintenance-book
mkdir -p books/react-book
mkdir -p books/webpack-book

cd books/maintenance-book
if [ -d ".git" ]; then git pull;
else git clone -b master https://github.com/survivejs/maintenance-book.git .;
fi
#!/usr/bin/env bash

cd -

cd books/react-book
if [ -d ".git" ]; then git pull;
else git clone -b master https://github.com/survivejs/react-book.git .;
fi
set -e # Exit with nonzero exit code if anything fails

cd -
BOOKS=(maintenance-book react-book webpack-book)

cd books/webpack-book
if [ -d ".git" ]; then git pull;
else git clone -b master https://github.com/survivejs/webpack-book.git .;
fi
# Clone or pull all books
for s in ${BOOKS[*]}; do
if [ -d "books/$s" ]; then
cd "books/$s"
git pull
cd -
else
git clone -b master "https://github.com/survivejs/$s.git" "books/$s"
fi
done

0 comments on commit 1249648

Please sign in to comment.