summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/install-phpcs.sh24
-rwxr-xr-xtools/update-vendor.sh30
2 files changed, 54 insertions, 0 deletions
diff --git a/tools/install-phpcs.sh b/tools/install-phpcs.sh
new file mode 100755
index 0000000..63ae7b2
--- /dev/null
+++ b/tools/install-phpcs.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Fetch PHP_CodeSniffer and the WordPress standard into .phpcs/.
+#
+# Not a dependency of the plugin: nothing here ships, and a bare checkout lints
+# with `php -l` alone. Run this once to get the full WordPress review that
+# `make lint` will then include.
+
+set -eu
+
+root=$(cd "$(dirname "$0")/.." && pwd)
+target="$root/.phpcs"
+
+mkdir -p "$target"
+
+docker run --rm -v "$target":/app -w /app composer:2 sh -c '
+ composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true &&
+ composer require --dev --no-interaction --quiet \
+ squizlabs/php_codesniffer \
+ wp-coding-standards/wpcs \
+ dealerdirect/phpcodesniffer-composer-installer
+'
+
+printf 'phpcs installed in .phpcs/ — `make lint` will use it\n'
diff --git a/tools/update-vendor.sh b/tools/update-vendor.sh
new file mode 100755
index 0000000..33dc824
--- /dev/null
+++ b/tools/update-vendor.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Refresh the two bundled dependencies from their own repositories.
+#
+# Neither is installed at runtime: a WordPress site is deployed by copying
+# files and never runs `composer install` or `bun install`, so both live in
+# this repository and are updated deliberately, by running this.
+#
+# Usage: tools/update-vendor.sh [path-to-cepis-php] [path-to-cepis-autofill]
+
+set -eu
+
+root=$(cd "$(dirname "$0")/.." && pwd)
+php_src=${1:-../cepis-php}
+js_src=${2:-../cepis-autofill}
+
+[ -d "$php_src/src" ] || { printf 'no PHP client at %s\n' "$php_src" >&2; exit 1; }
+[ -d "$js_src" ] || { printf 'no widget at %s\n' "$js_src" >&2; exit 1; }
+
+printf 'refreshing lib/cepis from %s\n' "$php_src"
+rm -f "$root"/lib/cepis/*.php
+cp "$php_src"/src/*.php "$root/lib/cepis/"
+
+printf 'building the widget in %s\n' "$js_src"
+( cd "$js_src" && make build >/dev/null )
+
+printf 'refreshing assets/js/cepis-autofill.min.js\n'
+cp "$js_src/dist/cepis-autofill.min.js" "$root/assets/js/cepis-autofill.min.js"
+
+printf 'done — review the diff and bump CEPIS_WOO_VERSION if anything changed\n'