Skip to content

Commit

Permalink
Add dev utility scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
drien committed Jan 17, 2024
1 parent 8642305 commit 5595170
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions dev/requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Python dependencies are managed with pip-tools. This simplifies adding a new dependency.
# To remove a dependency, remove it from requirements.in and run ./dev/requirements.sh recompile

if [[ "$1" == "recompile"* ]]; then
echo "Rebuilding from requirements.in..."
elif [[ "$1" == "install"* ]]; then
echo "Installing $2..."
echo "$2" >> requirements.in
sort -b requirements.in -o requirements.in
else
echo "Invalid argument. Please use 'install' or 'uninstall'."
exit 1
fi

docker compose run web bash -c "pip-compile --resolver=backtracking requirements.in"
docker compose build web
9 changes: 9 additions & 0 deletions dev/webpack_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

# The webpack container is built with node_modules in /opt/, one directory above /opt/src/ where the repo source code
# is mounted. This script simplifies running `npm` commands inside the webpack container, and copies the resulting
# package files up to the repo level so they can be source controlled.

echo "Running '$@' in webpack container..."
CMD="cd /opt/ && $@ && cp /opt/package*.json /opt/src/"
docker compose run webpack bash -c "$CMD"

0 comments on commit 5595170

Please sign in to comment.