Skip to content

Commit

Permalink
Init 9.x branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Norman Kämper-Leymann committed Sep 7, 2020
1 parent d4c011e commit 90c6cca
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 48 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ install:
- composer --verbose install

script:
- if [[ $RELEASE = dev ]]; then composer --verbose remove --no-update drupal/console; fi;
- if [[ $RELEASE = dev ]]; then composer --verbose require --no-update drupal/core:8.8.x-dev; composer --verbose require --no-update --dev drupal/core-dev:8.8.x-dev; fi;
- if [[ $RELEASE = dev ]]; then composer --verbose require --no-update drupal/core-recommended:9.0.x-dev; composer --verbose require --no-update --dev drupal/core-dev:9.0.x-dev; fi;
- if [[ $RELEASE = dev ]]; then composer --verbose update; fi;
- ./vendor/bin/drush site-install --verbose --yes --db-url=sqlite://tmp/site.sqlite
- ./vendor/bin/drush runserver $SIMPLETEST_BASE_URL &
Expand Down
52 changes: 22 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
# Composer template for Drupal projects

[![Build Status](https://travis-ci.org/drupal-composer/drupal-project.svg?branch=8.x)](https://travis-ci.org/drupal-composer/drupal-project)
[![Build Status](https://travis-ci.org/drupal-composer/drupal-project.svg?branch=9.x)](https://travis-ci.org/drupal-composer/drupal-project)

This project template provides a starter kit for managing your site
dependencies with [Composer](https://getcomposer.org/).

If you want to know how to use it as replacement for
[Drush Make](https://github.com/drush-ops/drush/blob/8.x/docs/make.md) visit
the [Documentation on drupal.org](https://www.drupal.org/node/2471553).

## Usage

First you need to [install composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
First you need to [install Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).

> Note: The instructions below refer to the [global composer installation](https://getcomposer.org/doc/00-intro.md#globally).
> Note: The instructions below refer to the [global Composer installation](https://getcomposer.org/doc/00-intro.md#globally).
You might need to replace `composer` with `php composer.phar` (or similar)
for your setup.

After that you can create the project:

```
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --no-interaction
composer create-project drupal-composer/drupal-project:9.x-dev some-dir --no-interaction
```

With `composer require ...` you can download new dependencies to your
installation.

```
cd some-dir
composer require drupal/devel:~1.0
composer require drupal/devel
```

The `composer create-project` command passes ownership of all files to the
project that is created. You should create a new git repository, and commit
all files not excluded by the .gitignore file.
project that is created. You should create a new Git repository, and commit
all files not excluded by the `.gitignore` file.

## What does the template do?

Expand All @@ -56,13 +52,13 @@ When installing the given `composer.json` some tasks are taken care of:
This project will attempt to keep all of your Drupal Core files up-to-date; the
project [drupal/core-composer-scaffold](https://github.com/drupal/core-composer-scaffold)
is used to ensure that your scaffold files are updated every time drupal/core is
updated. If you customize any of the "scaffolding" files (commonly .htaccess),
updated. If you customize any of the "scaffolding" files (commonly `.htaccess`),
you may need to merge conflicts if any of your modified files are updated in a
new release of Drupal core.

Follow the steps below to update your core files.

1. Run `composer update drupal/core drupal/core-dev --with-dependencies` to update Drupal Core and its dependencies.
1. Run `composer update drupal/core-recommended drupal/core-dev --with-dependencies` to update Drupal Core and its dependencies.
2. Run `git diff` to determine if any of the scaffolding files have changed.
Review the files for any changes and restore any customizations to
`.htaccess` or `robots.txt`.
Expand All @@ -75,13 +71,6 @@ Follow the steps below to update your core files.
keeping all of your modifications at the beginning or end of the file is a
good strategy to keep merges easy.

## Generate composer.json from existing project

With using [the "Composer Generate" drush extension](https://www.drupal.org/project/composer_generate)
you can now generate a basic `composer.json` file from an existing project. Note
that the generated `composer.json` might differ from this project's file.


## FAQ

### Should I commit the contrib modules I download?
Expand All @@ -91,11 +80,14 @@ workrounds if a project decides to do it anyway](https://getcomposer.org/doc/faq

### Should I commit the scaffolding files?

The [Drupal Composer Scaffold](https://github.com/drupal/core-composer-scaffold) plugin can download the scaffold files (like
index.php, update.php, …) to the web/ directory of your project. If you have not customized those files you could choose
to not check them into your version control system (e.g. git). If that is the case for your project it might be
convenient to automatically run the drupal-scaffold plugin after every install or update of your project. You can
achieve that by registering `@composer drupal:scaffold` as post-install and post-update command in your composer.json:
The [Drupal Composer Scaffold](https://github.com/drupal/core-composer-scaffold)
plugin can download the scaffold files (like index.php, update.php, …) to the
web/ directory of your project. If you have not customized those files you could
choose to not check them into your version control system (e.g. git). If that is
the case for your project it might be convenient to automatically run the
drupal-scaffold plugin after every install or update of your project. You can
achieve that by registering `@composer drupal:scaffold` as post-install and
post-update command in your composer.json:

```json
"scripts": {
Expand All @@ -109,6 +101,7 @@ achieve that by registering `@composer drupal:scaffold` as post-install and post
]
},
```

### How can I apply patches to downloaded modules?

If you need to apply patches (depending on the project being modified, a pull
Expand All @@ -117,6 +110,7 @@ request is often a better solution), you can do so with the

To add a patch to drupal module foobar insert the patches section in the extra
section of composer.json:

```json
"extra": {
"patches": {
Expand All @@ -126,20 +120,18 @@ section of composer.json:
}
}
```
### How do I switch from packagist.drupal-composer.org to packages.drupal.org?

Follow the instructions in the [documentation on drupal.org](https://www.drupal.org/docs/develop/using-composer/using-packagesdrupalorg).

### How do I specify a PHP version ?

This project supports PHP 7.0 as minimum version (see [Drupal 8 PHP requirements](https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7+.
This project supports PHP 7.3 as minimum version (see [Environment requirements of Drupal 9](https://www.drupal.org/docs/understanding-drupal/how-drupal-9-was-made-and-what-is-included/environment-requirements-of)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7.3+.

To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`:

```json
"config": {
"sort-packages": true,
"platform": {
"php": "7.0.33"
"php": "7.3.19"
}
},
```
34 changes: 18 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"description": "Project template for Drupal 9 projects with Composer",
"type": "project",
"license": "GPL-2.0-or-later",
"authors": [
Expand All @@ -16,26 +16,26 @@
}
],
"require": {
"php": ">=7.0.8",
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6.5",
"drupal/console": "^1.0.2",
"drupal/core": "^8.8.0",
"drupal/core-composer-scaffold": "^8.8.0",
"drush/drush": "^9.7.1 | ^10.0.0",
"vlucas/phpdotenv": "^4.0",
"webflo/drupal-finder": "^1.0.0",
"zaporylie/composer-drupal-optimizations": "^1.0"
"php": ">=7.3",
"composer/installers": "^1.9",
"cweagans/composer-patches": "^1.6",
"drupal/core-composer-scaffold": "^9.0",
"drupal/core-recommended": "^9.0",
"drush/drush": "^10.3",
"vlucas/phpdotenv": "^5.1",
"webflo/drupal-finder": "^1.2"
},
"require-dev": {
"drupal/core-dev": "^8.8.0"
"drupal/core-dev": "^9.0",
"zaporylie/composer-drupal-optimizations": "^1.1"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"discard-changes": true,
"sort-packages": true
},
"autoload": {
Expand All @@ -59,10 +59,6 @@
]
},
"extra": {
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"drupal-scaffold": {
"locations": {
"web-root": "web/"
Expand All @@ -75,6 +71,12 @@
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"]
},
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"patches": {
}
}
}

0 comments on commit 90c6cca

Please sign in to comment.