Skip to content

Commit 745d959

Browse files
authored
Point Composer users to package-command when wp package is missing (#1111)
1 parent 383417a commit 745d959

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎.github/workflows/testing.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@ jobs:
1414
test:
1515
uses: wp-cli/.github/.github/workflows/reusable-testing.yml@main
1616

17+
package-command-guidance:
18+
permissions:
19+
contents: read
20+
name: Guidance for `wp package` without dev dependencies
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out source code
24+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25+
with:
26+
persist-credentials: false
27+
28+
- name: Set up PHP environment
29+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
30+
with:
31+
php-version: 'latest'
32+
coverage: none
33+
34+
- name: Install without dev dependencies
35+
run: composer install --no-dev --no-interaction --prefer-dist
36+
37+
- name: Check that `wp package` points at package-command
38+
run: |
39+
if vendor/bin/wp package > stdout.txt 2> stderr.txt; then
40+
echo 'Expected `wp package` to fail without wp-cli/package-command.'
41+
exit 1
42+
fi
43+
44+
cat stderr.txt
45+
grep -qF 'composer require wp-cli/package-command' stderr.txt
46+
1747
minimum-php-guard:
1848
name: Minimum PHP guard - PHP ${{ matrix.php }}
1949
runs-on: ubuntu-22.04

‎composer.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
"extra": {
6565
"branch-alias": {
6666
"dev-main": "2.12.x-dev"
67+
},
68+
"command-hints": {
69+
"package": "The 'package' command is bundled with the WP-CLI Phar, but is an optional dependency of Composer-based installations. Run `composer require wp-cli/package-command` to add it, or manage WP-CLI packages as regular Composer dependencies of your project instead."
6770
}
6871
},
6972
"autoload-dev": {

‎composer.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)