diff --git a/CHANGELOG.md b/CHANGELOG.md index d5b1870..c9530b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # nystudio107/craft Change Log -## 2.4.28 - 2021.03.22 +## 2.4.29 - 2021.03.25 +### Added +* Added `make clean` to the Makefile +* Added **Makefile Project Commands** to `README.md` +* Added `make composer xxx` & `make npm xxx` commands + +### Changed +* Remove deprecated `scripts/docker_prod_build.sh` in favor of `make build` + +## 2.4.28 - 2021.03.24 ### Fixed * Fixed an issue with the `webpack-dev-server` version `^4.0.0-beta.1` by moving the `overlay` config setting to `client` (https://github.com/nystudio107/craft/issues/54) diff --git a/Makefile b/Makefile index c628f44..b516e0c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,20 @@ CONTAINER?=$(shell basename $(CURDIR))_php_1 +BUILDCHAIN?=$(shell basename $(CURDIR))_webpack_1 -.PHONY: build dev pulldb restoredb up +.PHONY: build clean composer dev npm pulldb restoredb up build: up - cd scripts/ && ./docker_prod_build.sh + docker exec -it ${BUILDCHAIN} npm run build +clean: + docker-compose down -v + docker-compose up --build +composer: up + docker exec -it ${CONTAINER} composer \ + $(filter-out $@,$(MAKECMDGOALS)) dev: up +npm: up + docker exec -it ${BUILDCHAIN} npm \ + $(filter-out $@,$(MAKECMDGOALS)) pulldb: up cd scripts/ && ./docker_pull_db.sh restoredb: up diff --git a/README.md b/README.md index 6ee5595..77c1fdf 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,22 @@ Build the production assets by typing `make build` to build the critical CSS, fo **N.B.:** Without authorization & credentials (which are private), the `make pulldb` will not work (it just runs `scripts/docker_pull_db.sh`). It's provided here for instructional purposes. +## Makefile Project Commands + +This project uses Docker to shrink-wrap the devops it needs to run around the project. + +To make using it easier, we're using a Makefile and the built-in `make` utility to create local aliases. You can run the following from terminal in the project directory: + +- `make dev` - starts up the local dev server listening on `http://localhost:8000/` +- `make build` - builds the static assets via the webpack 5 buildchain +- `make clean` - shuts down the Docker containers, removes any mounted volumes (including the database), and then rebuilds the containers from scratch +- `make composer xxx` - runs the `composer` command passed in, e.g. `make composer install` +- `make npm xxx` - runs the `npm` command passed in, e.g. `make npm install` +- `make pulldb` - runs the `scripts/docker_pull_db.sh` script to pull a remote database into the database container; the `scripts/.env.sh` must be set up first +- `make restoredb xxx` - runs the `scripts/docker_restore_db.sh` script to restore a local database dump into the database container; the `scripts/.env.sh` must be set up first + +### Other notes + To update to the latest Composer packages (as constrained by the `cms/composer.json` semvers), do: ``` rm cms/composer.lock diff --git a/scripts/docker_prod_build.sh b/scripts/docker_prod_build.sh deleted file mode 100755 index a4d3dad..0000000 --- a/scripts/docker_prod_build.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# Build production assets -# -# Build the production assets inside of the buildchain Docker container -# -# @author nystudio107 -# @copyright Copyright (c) 2020 nystudio107 -# @link https://nystudio107.com/ -# @package craft-scripts -# @since 1.2.2 -# @license MIT - -# Get the directory of the currently executing script -DIR="$(dirname "${BASH_SOURCE[0]}")" - -# Include files -INCLUDE_FILES=( - "common/defaults.sh" - ".env.sh" - ) -for INCLUDE_FILE in "${INCLUDE_FILES[@]}" -do - if [[ ! -f "${DIR}/${INCLUDE_FILE}" ]] ; then - echo "File ${DIR}/${INCLUDE_FILE} is missing, aborting." - exit 1 - fi - source "${DIR}/${INCLUDE_FILE}" -done - -# Temporary db dump path (remote & local) -if [[ -z "${LOCAL_BUILDCHAIN_CONTAINER}" ]]; then - echo "Variable LOCAL_BUILDCHAIN_CONTAINER is missing from .env.sh, aborting." -else - docker exec -it ${LOCAL_BUILDCHAIN_CONTAINER} npm run build -fi - -# Normal exit -exit 0