Skip to content

Commit 9904f04

Browse files
arraypressclaude
andcommitted
Install the kit from source while developing this library
The suite here runs against two fixtures the kit publishes for its dependants: tests/stubs.php, which stands in for the core functions, and tests/SelfReferences.php, which checks that every self:: and $this-> in a trait points at something that exists in the class it ends up part of. Both live in the kit's tests/, which as of today is export-ignored -- so a Composer dist install no longer carries them, and the suite could not boot. That export-ignore is the point: a dist install is what reaches a plugin's vendor directory, and 970 lines of test infrastructure has no business being there. config.preferred-install takes a per-package map, and only the *root* package's config is honoured. So the kit comes from source when this library is the thing being worked on, and from dist when a plugin pulls it in transitively. Confirmed both ways rather than assumed: a throwaway root package requiring this library gets a vendor tree with no tests in it. The CI workflow loses --prefer-dist, which is a command line flag and therefore overrides the config it is meant to respect. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tk8y5eZa3CHVVSM6nVxsJw
1 parent 3b7843b commit 9904f04

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ jobs:
2828
tools: composer:v2
2929

3030
- name: Install dependencies
31-
run: composer install --prefer-dist --no-progress --no-interaction
31+
# No --prefer-dist: it overrides config.preferred-install, and the kit
32+
# is installed from source here so its shared test fixtures
33+
# (stubs.php, SelfReferences.php) are present. They are
34+
# export-ignored, so a dist install does not carry them -- which
35+
# is the point, since a dist install is what reaches a plugin.
36+
run: composer install --no-progress --no-interaction
3237

3338
- name: Lint
3439
run: find src tests -name '*.php' -print0 | xargs -0 -n1 -P4 php -l > /dev/null

‎composer.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"config": {
3030
"optimize-autoloader": true,
3131
"sort-packages": true,
32-
"preferred-install": "dist",
32+
"preferred-install": {
33+
"arraypress/wp-field-kit": "source",
34+
"*": "dist"
35+
},
3336
"allow-plugins": {
3437
"dealerdirect/phpcodesniffer-composer-installer": true
3538
}

0 commit comments

Comments
 (0)