Skip to content

Commit

Permalink
More improvements for 10.3 (#192)
Browse files Browse the repository at this point in the history
* Adds Default Content module to --dev and documents it

* Upgrades PHP to 8.3

* Moves recipe folder above webroot

* fixes composer.json oomph composer installer conflicts

---------

Co-authored-by: “Kerry <“kmurphychi@gmail.com”>
  • Loading branch information
thejimbirch and “Kerry authored Jul 2, 2024
1 parent 5b2abd7 commit 76bb29b
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 32 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ PANTHEON_UUID: &PANTHEON_UUID "xxx"
THEME_NAME: &THEME_NAME "saplings_child"
THEME_PATH: &THEME_PATH "web/themes/custom/saplings_child"
CYPRESS_NODE_VERSION: &CYPRESS_NODE_VERSION "20.11.0" # Matches NVMRC file.
CYPRESS_CIMG_PHP: &CYPRESS_CIMG_PHP "cimg/php:8.2-browsers"
CYPRESS_CIMG_PHP: &CYPRESS_CIMG_PHP "cimg/php:8.3-browsers"
THEME_NODE_VERSION: &THEME_NODE_VERSION "20.11.0" # Matches NVMRC file.
CIMG_PHP: &CIMG_PHP "cimg/php:8.2" # This is the version of PHP set in pantheon.yml/docksal.env.
CIMG_PHP_TAG: &CIMG_PHP_TAG "8.2.15"
CIMG_PHP_TAG_MAJOR: &CIMG_PHP_TAG_MAJOR "8.2" # This is the version of PHP set in pantheon.yml/docksal.env.
CIMG_PHP: &CIMG_PHP "cimg/php:8.3" # This is the version of PHP set in pantheon.yml/docksal.env.
CIMG_PHP_TAG: &CIMG_PHP_TAG "8.3.8"
CIMG_PHP_TAG_MAJOR: &CIMG_PHP_TAG_MAJOR "8.3" # This is the version of PHP set in pantheon.yml/docksal.env.

defaults: &defaults
docker:
- image: quay.io/pantheon-public/build-tools-ci:8.x-php8.2
- image: quay.io/pantheon-public/build-tools-ci:8.x-php8.3
working_directory: ~/example_drops_8_composer
environment:
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
Expand Down
2 changes: 1 addition & 1 deletion .docksal/commands/recipe-apply
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}"

cd ${DOCROOT_PATH}

php core/scripts/drupal recipe recipes/contrib/"$@"
php core/scripts/drupal recipe ../recipes/"$@"

drush cr
22 changes: 1 addition & 21 deletions .docksal/commands/recipe-configure
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,14 @@ unpack_command='fin recipe-unpack org/recipe-name'

#-------------------------- Execution ------------------------------

# Configure Composer Patches.
fin composer config allow-plugins.cweagans/composer-patches true
fin composer require cweagans/composer-patches

# Add Drupal core patch for recipes to composer.json and update core.
composer config extra.patches --merge --json '{"drupal/core": {"Allow recipes to be applied": "https://git.drupalcode.org/project/distributions_recipes/-/raw/patch/recipe.patch"}}'
fin composer update drupal/core

# Configure the location recipes go when required.
fin composer config allow-plugins.oomphinc/composer-installers-extender
fin composer config extra.installer-types --merge --json '["drupal-recipe"]'
fin composer config extra.installer-paths --merge --json '{"web/recipes/contrib/{$name}": ["type:drupal-recipe"]}'
# Saplings also requires a custom theme to be required.
fin composer config extra.installer-types --merge --json '["drupal-custom-theme"]'
fin composer config extra.installer-paths --merge --json '{"web/themes/custom/{$name}": ["type:drupal-custom-theme"]}'
fin composer require oomphinc/composer-installers-extender
fin composer config extra.installer-paths --merge --json '{"/recipes/{$name}": ["type:drupal-recipe"]}'

# Requires Drupal Recipe Unpack.
fin composer config allow-plugins.ewcomposer/unpack true
fin composer config repo.recipe-unpack vcs https://gitlab.ewdev.ca/yonas.legesse/drupal-recipe-unpack.git
fin composer require ewcomposer/unpack:1.x-dev@dev

# Update .gitignore
echo -e "\n${yellow} Update your .gitignore file manually and add the following: ${NC}"
echo -e "/web/recipes/.gitignore"
echo -e "/web/recipes/contrib/"
echo -e "${green}${divider}${NC}"

# Complete
echo -e "\n${yellow} ${party} Your project is now ready to apply recipes! ${reverseparty}${NC}"
echo -e "Run ${yellow}${require_command}${NC} to require a recipe."
Expand Down
2 changes: 1 addition & 1 deletion .docksal/docksal.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DOCKSAL_STACK=pantheon
# Lock images versions for LAMP services
# This will prevent images from being updated when Docksal is updated
DB_IMAGE='docksal/mariadb:10.6'
CLI_IMAGE='docksal/cli:php8.2'
CLI_IMAGE='docksal/cli:php8.3'
# Docksal configuration.

# DOCROOT where the project is served will either be web for . (dot)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ setting this repository up for the first time.
reasoning behind it.
- [Testing](docs/TESTING.md) - Details about all the testing available in this
project.
- [Creating Default Content](docs/DEFAULT_CONTENT.md) - Instructions on how to
use the Default Content module to create default content for a recipe.


## Theme Commands and Setup Documentation
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
"ewcomposer/unpack": "dev-master",
"joachim-n/composer-manifest": "^1.0",
"kanopi/shrubs": "^0.2.5",
"oomphinc/composer-installers-extender": "2.0.0",
"pantheon-systems/drupal-integrations": "^10",
"rvtraveller/qs-composer-installer": "^1.1"
"oomphinc/composer-installers-extender": "^2.0.0",
"pantheon-systems/drupal-integrations": "^10"
},
"require-dev": {
"drupal/coder": "^8.3",
"drupal/core-dev": "^10.3",
"drupal/default_content": "^2.0@alpha",
"drupal/devel": "^5.1",
"palantirnet/drupal-rector": "^0.20.3"
},
Expand Down
46 changes: 46 additions & 0 deletions docs/DEFAULT_CONTENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Creating Default Content

Instructions on how to use the Default Content module to create default content
for a recipe.

## Enable the Default Content module.

The module is required in the dev section. It is not required in production.

fin drush en -y default_content

## Exporting content

Content can be exported to a module or recipe, but we want to export to a recipe
so we do not need the default_content module on production. We can apply a
recipe to import the content.

1. Create a recipe at `[project-root]/recipes/[recipe-name]`

The recipe only needs to have a folder with it's name and a recipe.yml with

```
name: 'Example'
description: 'Demo content for example.'
type: 'Content'
```

2. Create a `/content` folder in that recipe.

3. Export the content you want.

`drush dcer [entity_type] [bundle or ID] --folder=../recipes/[recipe-name]/content`

dcer gets all the dependencies of the entity you are exporting.

### Available [entity_type]s:

* node
* menu_link_content
* taxonomy_term
* media
* user

4. Disable the module when done.

fin drush pmu -y default_content
2 changes: 1 addition & 1 deletion pantheon.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_version: 1
web_docroot: true
php_version: 8.2
php_version: 8.3
database:
version: 10.6
drush_version: 10
Expand Down
Empty file added recipes/.gitkeep
Empty file.

0 comments on commit 76bb29b

Please sign in to comment.