2017-08-12 19:05:25 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2017-09-30 17:05:45 -04:00
|
|
|
# Usage
|
|
|
|
# ---------------
|
|
|
|
# 1. Clone second version of Bootstrap in sibling directory named `bs-docs`.
|
|
|
|
# 2. Within `bs-docs` copy, switch to `gh-pages` branch.
|
|
|
|
# 3. Pull latest, re-bundle, re-npm.
|
|
|
|
# 4. Run script.
|
2017-08-12 19:05:25 -04:00
|
|
|
|
|
|
|
red=$'\e[1;31m'
|
|
|
|
green=$'\e[1;32m'
|
|
|
|
blue=$'\e[1;34m'
|
|
|
|
magenta=$'\e[1;35m'
|
|
|
|
cyan=$'\e[1;36m'
|
|
|
|
end=$'\e[0m'
|
|
|
|
|
|
|
|
# Get current version from package.json
|
|
|
|
current_version=$(node -p "require('./package.json').version")
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
printf "\n${red}⚠️ Shipping aborted. You must specify a version.\n${end}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Pulling latest changes, just to be sure
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Pulling latest changes...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n\n${end}"
|
2017-08-12 19:05:25 -04:00
|
|
|
git pull origin v4-dev
|
|
|
|
|
|
|
|
# Update version number
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Updating version number...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n${end}"
|
2017-08-12 19:05:25 -04:00
|
|
|
npm run release-version $current_version $1
|
|
|
|
|
|
|
|
# Compile latest CSS and JS
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Compile latest CSS and JS...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n${end}"
|
2017-08-12 19:05:25 -04:00
|
|
|
npm run dist
|
|
|
|
|
2017-11-23 03:22:54 -05:00
|
|
|
# Generate the SRI hashes
|
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Generate the SRI hashes...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n${end}"
|
|
|
|
npm run release-sri
|
|
|
|
|
2017-08-12 19:05:25 -04:00
|
|
|
# Compress the dist files
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Compressing the dist files...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n${end}"
|
2017-08-12 19:05:25 -04:00
|
|
|
npm run release-zip
|
|
|
|
|
|
|
|
# Compile the docs
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Compile hosted documentation...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n${end}"
|
2017-08-12 19:05:25 -04:00
|
|
|
npm run docs-github
|
|
|
|
|
|
|
|
# Copy the contents of the built docs site over to `bs-docs` repo
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${magenta}=======================================================${end}"
|
|
|
|
printf "\n${magenta}Copy it over...${end}"
|
|
|
|
printf "\n${magenta}=======================================================\n${end}"
|
|
|
|
cp -rf _gh_pages/. ../bs-docs/
|
|
|
|
printf "\nDone!\n"
|
2017-08-12 19:05:25 -04:00
|
|
|
|
2017-09-30 17:05:45 -04:00
|
|
|
printf "\n${green}=======================================================${end}"
|
|
|
|
printf "\n${green}Success, $1 is ready to review and publish.${end}"
|
|
|
|
printf "\n${green}=======================================================\n\n${end}"
|