-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.sh
31 lines (23 loc) · 822 Bytes
/
generate.sh
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
#!/usr/bin/env bash
HEADER=$'/**\n * Generated stub declarations for WPGraphQL.\n * @see https://wpgraphql.org\n * @see https://github.com/axewp/wp-graphql-stubs\n */'
FILE="wp-graphql-stubs.php"
set -e
test -f "$FILE"
test -d "source/wp-graphql"
# Download dependencies
if [ ! -d vendor ]; then
composer update
fi
# Exclude globals.
"$(dirname "$0")/vendor/bin/generate-stubs" \
--force \
--finder=finder.php \
--header="$HEADER" \
--functions \
--classes \
--interfaces \
--traits \
--out="$FILE"
## Use literal-string type for wpdb::prepare() query statement parameter.
#sed -i -e 's#^.*@param string \+\$query \+Query statement.*$#&\n * @phpstan-param literal-string $query#' "$FILE"
printf '\nnamespace {\n%s\n}\n' "define('WPGRAPHQL_VERSION', '0.0.0');" >>"$FILE"