-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (82 loc) · 2.17 KB
/
Makefile
File metadata and controls
92 lines (82 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Configuration
PLUGIN_SLUG := carousel-kit
PLUGIN_VERSION := 1.0.0
BUILD_DIR := build-dist
ZIP_NAME := $(PLUGIN_SLUG).zip
# Default target
.PHONY: all
all: build zip
# Production Build (Slow, Clean)
# Uses 'npm ci' to wipe node_modules and ensure exact versions.
.PHONY: build
build:
@echo "Installing Composer dependencies (Production)..."
@composer install --no-dev --optimize-autoloader
@echo "Installing NPM dependencies (Clean)..."
@npm ci
@echo "Building assets..."
@npm run build
# Development Build (Fast, Incremental)
# Uses 'npm install' to respect existing node_modules.
.PHONY: dev
dev:
@echo "Installing Composer dependencies..."
@composer install
@echo "Installing NPM dependencies (Incremental)..."
@npm install
@echo "Building assets..."
@npm run build
# Production Build & Zip (Slow, for Releases)
.PHONY: zip
zip: build dist
# Development Build & Zip (Fast, for Testing)
.PHONY: quick-zip
quick-zip: dev dist
# Internal target for creating the distribution package
.PHONY: dist
dist:
@echo "Creating distribution package..."
@rm -rf $(BUILD_DIR)
@mkdir -p $(BUILD_DIR)/$(PLUGIN_SLUG)
@# Copy Files
@rsync -r \
--exclude='.*' \
--exclude='node_modules' \
--exclude='tests' \
--exclude='wp-assets' \
--exclude='phpunit.xml.dist' \
--exclude='phpcs.xml.dist' \
--exclude='phpstan.neon.dist' \
--exclude='babel.config.js' \
--exclude='commitlint.config.js' \
--exclude='jest.config.js' \
--exclude='webpack.config.js' \
--exclude='package.json' \
--exclude='package-lock.json' \
--exclude='blueprint.json' \
--exclude='tsconfig.json' \
--exclude='composer.json' \
--exclude='composer.lock' \
--exclude='Makefile' \
--exclude='CHANGELOG.md' \
--exclude='DEVELOPMENT.md' \
--exclude='src' \
--exclude='$(BUILD_DIR)' \
--exclude='*.zip' \
./ $(BUILD_DIR)/$(PLUGIN_SLUG)/
@echo "Zipping..."
@cd $(BUILD_DIR) && zip -r ../$(ZIP_NAME) $(PLUGIN_SLUG)
@echo "Done! Plugin zip created at $(ZIP_NAME)"
@rm -rf $(BUILD_DIR)
# Clean up
.PHONY: clean
clean:
@rm -f $(ZIP_NAME)
@rm -rf $(BUILD_DIR)
@rm -rf build
@rm -rf node_modules
@rm -rf vendor
# Local GitHub Actions simulation
.PHONY: act
act:
@act -W .github/workflows/release.yml