This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Drupal VM is configured to use [Drush make](drush-make.md) by default but supports building Drupal from a custom composer.json or creating a project from a composer package (`composer create-project`). | ||
|
||
## Using composer.json | ||
|
||
Add a `drupal.composer.json` next to your `config.yml` and switch the build system by setting `build_makefile: false` and `build_composer: true` in your `config.yml`. By default Drupal VM expects the Drupal code to be installed within a `docroot/` directory, if you use a different webroot directory, you need to adjust `drupal_core_path`. | ||
|
||
```yaml | ||
build_makefile: false | ||
build_composer: true | ||
``` | ||
_The file set in `drupal_composer_path` (which defaults to `drupal.composer.json`) will be copied from your host computer into the VM's `drupal_composer_install_dir` and renamed `composer.json`. If you already have a composer.json within that directory, you can set `drupal_composer_path: false`._ | ||
|
||
## Using Composer when [Drupal VM is a composer dependency itself](../other/drupalv-composer-dependency.md) | ||
|
||
In the scenario where you already have an existing `composer.json` in the root of your project, follow the usual steps for installing with a composer.json but instead of creating a `drupal.composer.json` file, disable the transfering of the file by setting `drupal_composer_path` to `false`, and change `drupal_composer_install_dir` to point to the the directory where it will be located. If `drupal_composer_path` is not truthy, Drupal VM assumes it already exists. | ||
|
||
```yaml | ||
build_makefile: false | ||
build_composer: true | ||
drupal_composer_path: false | ||
drupal_composer_install_dir: "/var/www/drupalvm" | ||
``` | ||
|
||
## Creating a project from a composer package: `composer create-project` | ||
|
||
There's a couple of things you need to configure in your `config.yml`: | ||
|
||
- Switch the build system by setting `build_makefile: false`, `build_composer: false` and `build_composer_project: true`. | ||
- Configure the composer package in `drupal_composer_project_package`. | ||
- Additionally you can adjust the create-project CLI options in `drupal_composer_project_options` as well as add additional dependencies in `drupal_composer_dependencies`. | ||
- Ensure that the webroot configured in the composer package matches the one set in `drupal_core_path`. The default is `docroot/`. | ||
|
||
With [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) as an example your `config.yml` overrides would be: | ||
|
||
```yaml | ||
build_makefile: false | ||
build_composer: false | ||
build_composer_project: true | ||
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev" | ||
# Added `--no-dev` to avoid installing development dependencies. | ||
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction --no-dev" | ||
drupal_composer_dependencies: | ||
- "drupal/devel:8.*" | ||
|
||
drupal_core_path: "{{ drupal_composer_install_dir }}/web" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters