Last active
April 20, 2022 14:13
-
-
Save bnf/5b59fc06b2b386b9a13ce07c70457bf8 to your computer and use it in GitHub Desktop.
Makefile wrapper for TYPO3 core Gruntfile – location: Build/Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: assets css js install help watch build | |
HAS_DDEV_CONFIG=$(if $(wildcard ../.ddev/config.yaml),1) | |
IS_IN_DDEV_CONTAINER=${IS_DDEV_PROJECT} | |
# Generate "ddev exec" prefix if ddev is configured and not running inside the ddev container | |
COMMAND_PREFIX=$(if $(HAS_DDEV_CONFIG),$(if $(IS_IN_DDEV_CONTAINER),,(ddev exec -s web true >/dev/null || ddev start) && ddev exec -s web -d /var/www/html/Build)) | |
YARN=$(COMMAND_PREFIX) yarn | |
GRUNT=$(COMMAND_PREFIX) node_modules/.bin/grunt | |
TYPESCRIPT_FILES = $(shell find Sources/TypeScript/ -type f -name '*.ts' -not -name '*.d.ts') | |
SASS_FILES = $(shell find Sources/Sass/ -type f -name '*.scss') | |
JAVASCRIPT_FILES = $(subst /TypeScript/,/JavaScript/,$(patsubst Sources/TypeScript/%.ts, ../typo3/sysext/%.js,$(subst /Tests/,/Tests/JavaScript/,$(TYPESCRIPT_FILES)))) | |
CSS_FILES = \ | |
../typo3/sysext/backend/Resources/Public/Css/backend.css \ | |
../typo3/sysext/core/Resources/Public/Css/errorpage.css \ | |
../typo3/sysext/form/Resources/Public/Css/form.css \ | |
../typo3/sysext/dashboard/Resources/Public/Css/dashboard.css \ | |
../typo3/sysext/dashboard/Resources/Public/Css/Modal/style.css \ | |
../typo3/sysext/adminpanel/Resources/Public/Css/adminpanel.css \ | |
../typo3/sysext/linkvalidator/Resources/Public/Css/linkvalidator.css \ | |
../typo3/sysext/workspaces/Resources/Public/Css/preview.css \ | |
../typo3/sysext/t3editor/Resources/Public/Css/t3editor.css | |
DEV_DEPENDENCIES = Makefile Gruntfile.js package.json yarn.lock node_modules/ | |
all: assets | |
assets: css js | |
js: $(JAVASCRIPT_FILES) | |
css: $(CSS_FILES) | |
# Note, grouped target "&:" require gnu make >= 4.3 | |
# Change to ":" to avoid warnings in make < 4.3 | |
# @todo: Fix Gruntfile to rewrite tsconfig.json only if contents are to be changed | |
$(JAVASCRIPT_FILES) &: $(TYPESCRIPT_FILES) types/*.d.ts types/TYPO3/*.d.ts $(DEV_DEPENDENCIES) eslintrc.js #tsconig.json | |
$(GRUNT) scripts | |
$(CSS_FILES) &: $(SASS_FILES) $(DEV_DEPENDENCIES) ../.stylelintrc | |
$(GRUNT) stylelint css | |
node_modules/: yarn.lock | |
$(YARN) install | |
@# Update timestamp | |
test -d node_modules/ && touch node_modules/ | |
watch: assets | |
$(GRUNT) watch | |
# `make build` may be used to force a full rebuild | |
build: | |
$(GRUNT) build | |
clean: | |
$(GRUNT) clear-build | |
help: | |
@echo "Usage: make <all|assets|css|js|build|watch>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regarding the
make
version of < or >= 4.3: that seems to be an actual headache in 2021.Could we make it bail out if an incompatible version is encountered?