forked from DevinVinson/WordPress-Plugin-Boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 8
/
composer.json
204 lines (204 loc) · 7.94 KB
/
composer.json
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{
"name": "PHP_Package_Name",
"description": "This is a short description of what plugin_title does.",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Your Name",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"composer/installers": true,
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"johnpbloch/wordpress-core-installer": true,
"phpstan/extension-installer": true
},
"platform": {
"php": "7.4"
},
"process-timeout": 0,
"sort-packages": true
},
"autoload-dev": {
"psr-4": {
"Plugin_Package_Name\\": [
"tests/integration",
"tests/unit",
"tests/wpunit"
]
}
},
"repositories": {
"outlandish/wpackagist": {
"type": "composer",
"url": "https://wpackagist.org",
"only": [
"wpackagist-plugin/*",
"wpackagist-theme/*"
]
},
"wordpress/wordpress": {
"url": "https://github.com/WordPress/wordpress-develop",
"type": "git"
}
},
"require": {
"php": ">=7.4",
"alleyinteractive/wordpress-autoloader": "^1.1",
"brianhenryie/bh-wp-logger": "*",
"ext-json": "*"
},
"require-dev": {
"10up/wp_mock": "^1.0",
"antecedent/patchwork": "^2.1",
"brianhenryie/color-logger": "^1.0",
"brianhenryie/composer-fallback-to-git": "^0.6.0",
"brianhenryie/composer-phpstorm": "dev-master",
"brianhenryie/strauss": "*",
"codeception/module-asserts": "^1.0",
"codeception/module-cli": "^1.0",
"codeception/module-db": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-webdriver": "^1.0",
"codeception/util-universalframework": "^1.0",
"cweagans/composer-patches": "^1.7",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"jaschilz/php-coverage-badger": "^2.0",
"johnpbloch/wordpress": "*",
"kporras07/composer-symlinks": "dev-master",
"lucatume/wp-browser": "*",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpcov": "*",
"squizlabs/php_codesniffer": "^3.7",
"szepeviktor/phpstan-wordpress": "^1.3",
"wordpress/wordpress": "*",
"wp-cli/dist-archive-command": "dev-main",
"wp-cli/i18n-command": "^2.4",
"wp-cli/wp-cli-bundle": "*",
"wp-coding-standards/wpcs": "^3.0",
"wpackagist-plugin/document-generator-for-openapi": "*",
"wpackagist-plugin/log-http-requests": "*",
"wpackagist-plugin/query-monitor": "*",
"wpackagist-plugin/user-role-editor": "*",
"wpackagist-plugin/woocommerce": "*",
"wpackagist-plugin/wordpress-importer": "^0.8.1",
"wpackagist-plugin/wp-mail-debugger": "^1.1",
"wpackagist-plugin/wp-rest-api-log": "*",
"wpackagist-theme/storefront": "*",
"wpackagist-theme/twentytwenty": "*",
"wpackagist-theme/twentytwentyfour": "*"
},
"extra": {
"patches": {
"jaschilz/php-coverage-badger": {
"Allow customising the text": "https://github.com/JASchilz/PHPCoverageBadge/pull/1.patch"
},
"wp-cli/dist-archive-command": {
"Add Increment Version": "https://github.com/BrianHenryIE/dist-archive-command/commit/f37c375ba8069c9160d642dd0c00435e0f1c4804.patch"
},
"wp-cli/handbook": {
"Add wp handbook gen-custom for custom commands": "https://github.com/wp-cli/handbook/pull/526.patch"
}
},
"strauss": {
"namespace_prefix": "Plugin_Package_Name\\",
"classmap_prefix": "Plugin_Snake_"
},
"symlinks": {
"wp-content": "wordpress/wp-content",
".": "wp-content/plugins/plugin-slug"
},
"phpstorm": {
"exclude_folders": {
"folders": [
"vendor/php-stubs/woocommerce-stubs",
"vendor/wordpress/wordpress/src",
"vendor/wordpress/wordpress/build",
"wp-content/plugins/plugin-slug",
"wordpress/wp-content"
],
"composer-symlinks": false
}
}
},
"scripts": {
"post-install-cmd": [
"@create-symlinks",
"@configure-phpstorm",
"@prefix-namespaces",
"@sync-composer-wpenv"
],
"post-update-cmd": [
"@create-symlinks",
"@configure-phpstorm",
"@prefix-namespaces",
"@sync-composer-wpenv"
],
"create-symlinks": [
"Kporras07\\ComposerSymlinks\\ScriptHandler::createSymlinks"
],
"configure-phpstorm": [
"BrianHenryIE\\ComposerPhpStorm\\ExcludeFolders::update",
"BrianHenryIE\\ComposerPhpStorm\\PHPUnitRunConfigurations::update"
],
"prefix-namespaces": [
"strauss"
],
"test-coverage": [
"codecept run unit --coverage unit.cov",
"codecept run wpunit --coverage wpunit.cov",
"phpcov merge --clover tests/_output/clover.xml --html tests/_output/html tests/_output;",
"open tests/_output/html/index.html"
],
"cs-fix": [
"phpcbf || true",
"phpcs || true",
"phpstan analyse --memory-limit 1G"
],
"cs-fix-changes": [
"updated_files=$( git status | grep -v 'deleted' | grep '.php$' | cut -c14- | awk '{ printf(\"%s \", $0) }' ); phpcbf $(echo $updated_files); phpcs $(echo $updated_files); phpstan analyse $(echo $updated_files) --memory-limit 1G"
],
"php-compatibility": [
"phpcs -p includes templates vendor-prefixed --standard=PHPCompatibilityWP --runtime-set testVersion 7.4-"
],
"create-plugin-archive": [
"wp i18n make-pot includes languages/$(basename \"$PWD\").pot --domain=$(basename \"$PWD\")",
"wp dist-archive . ./dist-archive --plugin-dirname=$(basename \"$PWD\") --create-target-dir"
],
"generate-openapi": [
"npx wp-env run cli /var/www/html/wp-content/plugins/example-plugin/vendor/bin/wp openapi-generator export-file example-plugin/v1 --destination=./openapi/example-plugin-openapi.json --extract-common-types;",
"cat ./openapi/example-plugin-openapi.json | jq 'del(.servers) | del(.paths.\"/\") | .jsonSchemaDialect = \"https://spec.openapis.org/oas/3.1/dialect/base\"' | sponge ./openapi/example-plugin-openapi.json"
],
"generate-wp-cli-docs": [
"npx wp-env run cli /var/www/html/wp-content/plugins/example-plugin/vendor/bin/wp handbook gen-custom example-plugin --output_dir=docs/wp-cli;"
],
"github-actions": [
"act -P ubuntu-latest=shivammathur/node:latest"
],
"sync-composer-wpenv": [
"for name in $(cat .wp-env.json | jq '.mappings | values[]' | sed -r 's/^\\\"|\\\"$//g'); do [ ! -d $name ] && [ ! -f $name ] && echo $name && jq 'del(.. | select(. ==\"'$name'\"))' .wp-env.json | sponge .wp-env.json; done; exit 0;",
"find wp-content/plugins -type d -depth 1 ! -type l | sort -h | jq -Rn '[inputs]' | jq 'reduce .[] as $item ({}; . + {$item:$item})' | jq '.[] |= \"./\\(.)\"' | jq '. | {mappings: .}' | jq --sort-keys -s '.[] * $existing[]' --slurpfile existing .wp-env.json | sponge .wp-env.json "
]
},
"scripts-descriptions": {
"create-symlinks": "Create sylimks between /wordpress, /wp-content and the root plugin for convenience.",
"configure-phpstorm": "Add directories to PhpStorm's excluded folders list and add PHPUnit run configurations.",
"prefix-namespaces": "Prefix the namespaces of Composer packages using brianhenryie/strauss to avoid conflicts with other plugins.",
"test": "Run PHPUnit tests",
"test-coverage": "Run PHPUnit tests with coverage. Use `XDEBUG_MODE=coverage composer test-coverage` to run, `open ./coverage-report/index.html` to view.",
"cs-fix": "Run PHP Code Beautifier and Fixer",
"cs-fix-changes": "Run @cs-fix on files since the last commmit",
"create-plugin-archive": "Generate i18n .pot and create a plugin .zip using the exclusion list in .distignore",
"php-compatibility": "Run PHPCompatibilityWP",
"github-actions": "Run the GitHub Actions workflow locally using nektos/act"
}
}