Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds bootstrap scripts #341

Merged
merged 2 commits into from
Dec 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
]
},
"scripts": {
"bootstrap": "./scripts/bootstrap.sh",
"update": "./scripts/install-modules.sh",
"test": "jest",
"test-watch": "jest --watch",
"test-coverage": "jest --coverage",
Expand Down
8 changes: 8 additions & 0 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

silly, but can we add 🔥 and ✅ ? haha

source scripts/remove-modules.sh
source scripts/install-modules.sh

cd packages/kyt-cli && npm link && printf "\n👍 linked kyt-cli\n"

printf "\n✅ Strapped\n"
8 changes: 8 additions & 0 deletions scripts/get-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

PACKAGES=( "" )
ROOT=`pwd`

for DIR in packages/*; do
[[ -d $DIR ]] && PACKAGES+=("$DIR")
done
15 changes: 15 additions & 0 deletions scripts/install-modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

source scripts/get-packages.sh

printf "\n🔥 Installing packages\n"

# Installs node modules for packages/*.
for i in "${PACKAGES[@]}"; do :
cd "${ROOT}/${i}"
echo "👍 Installing package ${ROOT}/${i}/package.json"
npm i 2>&1
cd "${ROOT}"
done

printf "\n✅ Done installing packages\n"
19 changes: 19 additions & 0 deletions scripts/remove-modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

source scripts/get-packages.sh

printf "\n🔥 Removing node modules\n"

# Removes packages/*/node_modules directories.
# Runs all commands in parallel/background.
for i in "${PACKAGES[@]}"; do
NMODS="${ROOT}/${i}/node_modules"
if [ -d "${NMODS}" ]; then
echo "👍 Removing ${NMODS}"
rm -rf "${NMODS}" 2>&1 &
fi
done

wait

printf "\n✅ Done removing node modules\n"