Commit ef3544af authored by larowlan's avatar larowlan

Issue #2982680 by greg.1.anderson, mbaynton, Mixologic, jibran, webflo,...

Issue #2982680 by greg.1.anderson, mbaynton, Mixologic, jibran, webflo, Mile23, phenaproxima, AaronMcHale, Charlie ChX Negyesi, nicksanta: Add composer-ready project templates to Drupal core
parent 3f4d4031
{
"name": "drupal/legacy-project",
"description": "Project template for Drupal 8 projects with composer following drupal/drupal layout",
"type": "project",
"license": "GPL-2.0-or-later",
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.2",
"drupal/core-recommended": "^8.8",
"drupal/core-composer-scaffold": "^8.8",
"drupal/core-vendor-hardening": "^8.8"
},
"require-dev": {
"drupal/dev-dependencies": "^8.8"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"composer-scaffold": {
"locations": {
"web-root": "./"
}
},
"installer-paths": {
"core": ["type:drupal-core"],
"libraries/{$name}": ["type:drupal-library"],
"modules/contrib/{$name}": ["type:drupal-module"],
"profiles/contrib/{$name}": ["type:drupal-profile"],
"themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"]
}
}
}
Composer-Ready Project Templates
================================
Thanks for using these Drupal project templates.
You can participate in its development on Drupal.org, through our issue system:
https://www.drupal.org/project/issues/drupal
You can get the full Drupal repo here:
https://www.drupal.org/project/drupal/git-instructions
You can browse the full Drupal repo here:
https://git.drupalcode.org/drupal
What does it do?
----------------
These project templates serve as a starting point for creating a
Composer-managed Drupal site. Once you have selected a template project and
created your own site, you will take ownership of your new project files.
Thereafter, future updates will be done with Composer.
There are two project templates to choose from:
1) drupal/recommended-project: The recommended project creates a new Drupal site
with a "relocated document root". This means that the files "index.php" and the
"core" directory and so on are placed inside a subfolder named "web" rather than
being placed next to "composer.json" and the "vendor" directory at the project
root. This layout is recommended because it allows you to configure your web
server to only provide access to files inside the "web" directory. Keeping the
vendor directory outside of the web server's document root is better for
security.
2) drupal/legacy-project: The legacy project creates a new Drupal site that has
the same layout used in Drupal 8.7.x and earlier. The files "index.php", the
"core" directory and so on are placed directly at the project root next to
"composer.json" and the "vendor" directory. The Vendor Hardening plugin is used
to ensure the security of this configuration for the Apache and Microsoft IIS
web servers. Use the legacy project layout only if there is some reason why you
cannot use the recommended project layout.
How do I set it up?
-------------------
Use Composer to create a new project using the desired starter template:
composer -n create-project drupal/recommended-project:^8.8 my-project
Add new modules and themes with `composer require`:
composer require drupal/devel:^1
All of your modules and themes can be updated along with Drupal core via:
composer update
To update only Drupal core without any modules or themes, use:
composer update drupal/core-recommended --with-dependencies
These template projects use drupal/core-composer-scaffold to place the scaffold
files. This plugin allows the top-level composer.json file for a Drupal site to
transform the scaffold files in different ways, e.g. to append new entries to
the end of robots.txt and so on. For documentation on how scaffolding works, see
https://git.drupalcode.org/project/drupal/tree/8.8.x/composer/Plugin/Scaffold
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 8 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.2",
"drupal/core-recommended": "^8.8",
"drupal/core-composer-scaffold": "^8.8"
},
"require-dev": {
"drupal/dev-dependencies": "^8.8"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"composer-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"]
}
}
}
......@@ -48,3 +48,7 @@ build:
# Run nightwatch testing.
# @see https://www.drupal.org/project/drupal/issues/2869825
nightwatchjs:
container_command.drupal_project_templates:
commands:
- "sudo -u www-data ${SOURCE_DIR}/core/tests/scripts/test_composer_project_templates.sh"
halt-on-fail: true
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# @todo: convert to a build test after #2984031 is in.
#/ Usage: ./drupal_project_templates.sh
#/ Description: Container command to check default composer templates.
#/ Options:
#/ --help: Display this help message
usage() { grep '^#/' "$0" | cut -c4- ; exit 0 ; }
expr "$*" : ".*--help" > /dev/null && usage
info() { echo "[INFO] $*" ; }
fatal() { echo "[FATAL] $*" ; exit 1 ; }
assertScaffold() {
if [ -f $1/autoload.php ]
then
info "autoload.php file found."
else
fatal "No autoload.php file found."
fi
if [ -f $1/core/authorize.php ]
then
info "authorize.php file found."
else
fatal "No authorize.php file found."
fi
}
info "Starting script"
SOURCE_DIR=$(realpath $(dirname $0))/../../..
info "Installing recommended project composer template"
composer --working-dir="${SOURCE_DIR}/composer/Template/RecommendedProject" install --no-suggest --no-progress --no-interaction
info "Recommended project composer template installed successfully."
assertScaffold "${SOURCE_DIR}/composer/Template/RecommendedProject/web"
info "Installing legacy project composer template"
composer --working-dir="${SOURCE_DIR}/composer/Template/LegacyProject" install --no-suggest --no-progress --no-interaction
info "Legacy project composer template installed successfully."
assertScaffold "${SOURCE_DIR}/composer/Template/LegacyProject"
info "Script complete!"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment