Gatsby & WordPress - 2.2.5. - Bedrock and Composer

by Jack Pritchard

Hey! This post's a little over two years old now, so some of what's here might be out of date. Still worth a read, but if anything really matters to you, it's worth double-checking against a newer source too.

Bedrock & Composer

All of the installation processes are well documented on the official Bedrock website - https://roots.io/bedrock/docs/installing-bedrock/

Our Composer File

https://github.com/whatjackhasmade/whatjackhasmade.co.uk/blob/master/composer.json

{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
"homepage": "https://roots.io/bedrock/",
"authors": [
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",
"homepage": "https://github.com/swalkinshaw"
},
{
"name": "Ben Word",
"email": "ben@benword.com",
"homepage": "https://github.com/retlehs"
}
],
"keywords": ["bedrock", "composer", "roots", "wordpress", "wp", "wp-config"],
"support": {
"issues": "https://github.com/roots/bedrock/issues",
"forum": "https://discourse.roots.io/category/bedrock"
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "composer",
"url": "https://pivvenit.github.io/acf-composer-bridge/composer/v2/wordpress-muplugin/"
},
{
"type": "package",
"package": {
"name": "pristas-peter/wp-graphql-gutenberg",
"version": "1.0.0",
"source": {
"url": "https://github.com/pristas-peter/wp-graphql-gutenberg.git",
"type": "git",
"reference": "master"
}
}
},
{
"type": "package",
"package": {
"name": "pristas-peter/wp-graphql-gutenberg-acf",
"version": "1.0.0",
"source": {
"url": "https://github.com/pristas-peter/wp-graphql-gutenberg-acf.git",
"type": "git",
"reference": "master"
}
}
},
{
"type": "package",
"package": {
"name": "wp-graphql/wp-graphiql",
"version": "1.0.0",
"source": {
"url": "https://github.com/wp-graphql/wp-graphiql.git",
"type": "git",
"reference": "master"
}
}
},
{
"type": "package",
"package": {
"name": "ashhitch/wp-graphql-yoast-seo",
"version": "1.0.0",
"source": {
"url": "https://github.com/ashhitch/wp-graphql-yoast-seo.git",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"php": ">=7.1",
"advanced-custom-fields/advanced-custom-fields-pro": "^5.8.1",
"composer/installers": "^1.7",
"oscarotero/env": "^1.2.0",
"roots/wordpress": "5.2.4",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "1.0.0",
"vlucas/phpdotenv": "^3.4.0",
"wp-graphql/wp-graphql": "^0.3.6",
"wp-graphql/wp-graphql-acf": "^0.2.0",
"wp-graphql/wp-graphiql": "1.0.0",
"ashhitch/wp-graphql-yoast-seo": "1.0.0",
"pristas-peter/wp-graphql-gutenberg": "1.0.0",
"pristas-peter/wp-graphql-gutenberg-acf": "1.0.0",
"wpackagist-plugin/amazon-s3-and-cloudfront": "^2.1.0",
"wpackagist-plugin/disable-gutenberg": "^1.9",
"wpackagist-plugin/duplicate-post": "^3.2.3",
"wpackagist-plugin/regenerate-thumbnails": "^3.1.0",
"wpackagist-plugin/timber-library": "^1.12.0",
"wpackagist-plugin/wordpress-seo": "^10.1.3",
"wpackagist-plugin/wp-jamstack-deployments": "^0.3.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4.2",
"roave/security-advisories": "dev-master"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": [
"type:wordpress-muplugin",
"wp-graphql/wp-graphql",
"wp-graphql/wp-graphql-acf",
"wp-graphql/wp-graphiql",
"ashhitch/wp-graphql-yoast-seo",
"pristas-peter/wp-graphql-gutenberg",
"pristas-peter/wp-graphql-gutenberg-acf",
"wpackagist-plugin/amazon-s3-and-cloudfront",
"wpackagist-plugin/disable-gutenberg",
"wpackagist-plugin/duplicate-post",
"wpackagist-plugin/regenerate-thumbnails",
"wpackagist-plugin/timber-library",
"wpackagist-plugin/wordpress-seo",
"wpackagist-plugin/wp-jamstack-deployments"
],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "web/wp"
},
"scripts": {
"post-root-package-install": ["php -r \"copy('.env.example', '.env');\""],
"test": ["phpcs"]
}
}
These are the exact dependency versions from 2019 (PHP 7.1, WordPress 5.2.4, WPGraphQL 0.3.6, ACF Pro 5.8.1). All of these have had major releases since — treat this as a historical snapshot of the approach, not a version spec to install today.