All Projects → nuvoleweb → Drupal Component Scaffold

nuvoleweb / Drupal Component Scaffold

Licence: gpl-2.0
Scaffolding Composer plugin for Drupal modules and themes.

Projects that are alternatives of or similar to Drupal Component Scaffold

drupal-composer-init
Initialise a Drupal composer setup
Stars: ✭ 43 (+290.91%)
Mutual labels:  drupal, composer-plugin
Beetbox
Pre-provisioned L*MP stack
Stars: ✭ 94 (+754.55%)
Mutual labels:  drupal, composer-plugin
Waterwheel.swift
The Waterwheel Swift SDK provides classes to natively connect iOS, macOS, tvOS, and watchOS applications to Drupal 7 and 8.
Stars: ✭ 415 (+3672.73%)
Mutual labels:  drupal
Simplesamlphp Module Drupalauth
simpleSAMLphp module that turns Drupal site into IdP(Identity Provider)
Stars: ✭ 18 (+63.64%)
Mutual labels:  drupal
Composer Merge Plugin
Merge one or more additional composer.json files at Composer runtime
Stars: ✭ 718 (+6427.27%)
Mutual labels:  composer-plugin
Drupalgeddon2
Exploit for Drupal v7.x + v8.x (Drupalgeddon 2 / CVE-2018-7600 / SA-CORE-2018-002)
Stars: ✭ 464 (+4118.18%)
Mutual labels:  drupal
Cmsscan
CMS Scanner: Scan Wordpress, Drupal, Joomla, vBulletin websites for Security issues
Stars: ✭ 775 (+6945.45%)
Mutual labels:  drupal
Farmos
farmOS: A web-based farm record keeping application.
Stars: ✭ 380 (+3354.55%)
Mutual labels:  drupal
Drucker
drucker: Drupal + Docker - Spin up Drupal, Lightning or BLT in seconds.
Stars: ✭ 26 (+136.36%)
Mutual labels:  drupal
Composer Normalize
🎵 Provides a composer plugin for normalizing composer.json.
Stars: ✭ 602 (+5372.73%)
Mutual labels:  composer-plugin
Xattacker
X Attacker Tool ☣ Website Vulnerability Scanner & Auto Exploiter
Stars: ✭ 897 (+8054.55%)
Mutual labels:  drupal
Hookphp
HookPHP基于C扩展搭建内置AI编程的架构系统-支持微服务部署|热插拔业务组件-集成业务模型|权限模型|UI组件库|多模板|多平台|多域名|多终端|多语言-含常驻内存|前后分离|API平台|LUA QQ群:679116380
Stars: ✭ 575 (+5127.27%)
Mutual labels:  drupal
Docksal
Unified, Docker 🐳 powered web development environment for macOS, Windows, and Linux
Stars: ✭ 505 (+4490.91%)
Mutual labels:  drupal
Idea Php Symfony2 Plugin
IntelliJ IDEA / PhpStorm Symfony Plugin
Stars: ✭ 797 (+7145.45%)
Mutual labels:  drupal
Composer Registry Manager
🛠 🔨 Composer registry manager that help to easily switch to the composer repository you want.
Stars: ✭ 448 (+3972.73%)
Mutual labels:  composer-plugin
Ddev
DDEV-Local: a local PHP development environment system
Stars: ✭ 915 (+8218.18%)
Mutual labels:  drupal
Blt
Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
Stars: ✭ 412 (+3645.45%)
Mutual labels:  drupal
Cmspoc
CMS渗透测试框架-A CMS Exploit Framework
Stars: ✭ 557 (+4963.64%)
Mutual labels:  drupal
Awesome Composer
😎 A curated awesome list for Composer, Packagist, Satis, Plugins, Scripts, Composer related resources, tutorials.
Stars: ✭ 738 (+6609.09%)
Mutual labels:  composer-plugin
Mespronos
Sport betting module for Drupal 8
Stars: ✭ 8 (-27.27%)
Mutual labels:  drupal

Drupal Component Scaffold

Build Status

Drupal Component Scaffold is a Composer plugin that helps Drupal 8 project maintainers enjoy leaner development workflow: working on modules and themes will be like working on any other modern PHP component.

Once installed the plugin allows to:

  • Specify all project's development dependencies in require-dev, like Drupal core, modules, themes or any needed testing libraries (PHPUnit, PHPSpec, Behat, etc.). See an example here.
  • Build a fully functional Drupal site right within the project directory by bundling all listed dependencies by just running composer install.
  • Have the same setup on both local development and continuous integration pipelines. This also leads to cleaner CI configuration files.

The plugin leverages the excellent Drupal Scaffold project and fires only after (and if) its main scaffolding tasks are ran.

Usage

Require it via Composer as follow:

$ composer require nuvoleweb/drupal-component-scaffold --dev

List all your dependencies (core version, modules, etc.) and run:

$ composer update

For example, take the following composer.json:

{
  "name": "drupal/my_module",
  "type": "drupal-module",
  "require": {
    "drupal/ds": "~3"
  },
  "require-dev": {
    "nuvoleweb/drupal-component-scaffold": "*",
    "drush/drush": "~8.0",
    "drupal/core": "~8",
    "drupal/panels": "~4",
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    }
  ],
  "extra": {
    "installer-paths": {
      "web/core": ["type:drupal-core"],
      "web/modules/contrib/{$name}": ["type:drupal-module"]
    }
  }  
}

Running composer install will result in:

.
├── web
│   ├── autoload.php
│   ├── core
│   ├── modules
│   │   ├── contrib
│   │   │    └── panels
│   │   └── custom
│   │       └── my_module (symlink to project root)
│   └── sites
│       ├── default
│       │   ├── default.services.yml
│       │   ├── default.settings.php
│       │   ├── drushrc.php
│       │   └── settings.local.php
│       ├── development.services.yml
│       ├── example.settings.local.php
│       └── example.sites.php
├── vendor
├── composer.json
├── composer.lock
├── my_module.info.yml
└── my_module.module

Configuration

Build directory will be derived by the installer-paths, make sure you specify there where you wish to install your core, modules etc:

{
  "extra": {
    "installer-paths": {
      "web/core": ["type:drupal-core"],
      "web/modules/contrib/{$name}": ["type:drupal-module"]
    }
  }
}

Also, all options for Drupal Scaffold still apply, check the project's documentation for more.

Component scaffolding can be triggered at any time by running:

$ composer drupal-component-scaffold

Setup PHPUnit tests

To setup PHPUnit use the following phpunit.xml.dist template:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" backupGlobals="true" colors="true" >
  <php>
    <ini name="error_reporting" value="32767"/>
    <var name="namespaces" value=""/>
    <ini name="memory_limit" value="-1"/>
    <env name="SIMPLETEST_DB" value="mysql://user:[email protected]/database"/>
  </php>
  <testsuites>
    <testsuite>
      <directory>./tests/</directory>
    </testsuite>
  </testsuites>
</phpunit>

This will ensure that both Unit and Kernel tests tests will ran correctly. See an example here.

Inner workings

When fired the plugin will:

After Drupal Scaffold is done the plugin will:

  • Prepare a custom projects directory at ./web/modules/custom.
  • Make ./web/sites/default writable.
  • Symlink your project at ./web/modules/custom/my_module (or at ./web/themes/custom/my_theme).
  • Setup default Drush configuration file at ./web/sites/default/drushrc.php.
  • Make sure that Twig cache is disabled on ./web/sites/development.services.yml.
  • Setup local development settings at ./web/sites/default/settings.local.php.
  • Patch Drupal core with kernel-test-base.patch allowing Kernel tests to run smoothly.

Note: the local development settings file above is disabled by default, to enable it un-comment the related lines in your settings.php file and clear the cache.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].