Skip to content

A skeleton Drupal install profile to set up an appropriate layout for Myplanet's install profile development strategy, striving toward continuous delivery and greater good.

Notifications You must be signed in to change notification settings

myplanet/skeletor

Repository files navigation

Skeletor Install Profile Skeletor icon

Build Status

A skeleton Drupal install profile that scaffolds Myplanet projects.

Skull icon by Chanut is Industries

1. Build Instructions

Requirements

  • PHP 7.0.*
  • Composer 1.0.0+

Building Drupal

To start a new project based on Skeletor in [target-dir-name], run:

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
cd some-dir

Open composer.json in some-dir and add "enable-patching": true in the "extra" section.

{
    "extra": {
        "enable-patching": true
    }
}

Now add skeletor as a dependency to your build:

composer require myplanet/skeletor:8.2.x-dev

Once skeletor has successfully been added to the build we need to include scaffold files provided by skeletor. By default you will get Acquia cloud hooks, travis scripts, a .gitignore file to use on production and a .travis.yml file with sensible defaults. From the project root:

./vendor/bin/skeletor-init-project.sh

In order to create a sub profile based on Skeletor, you have to apply a patch to Drupal core (until it's incorporated into core). To do so, add the following to your composer.json

"patches": {
    "drupal/core": {
        "1356276 - Allow profiles to provide a base/parent profile and load them in the correct order":
        "https://www.drupal.org/files/issues/2018-10-23/1356276-549-8.6.x.patch"
    }
},

Then connect your new project to a git repository, from the project folder run:

git init
git remote add origin [git-url]
git add -A
git commit -m "Initial Commit"
git push origin

Customizing your build

Skeletor ships with composer scripts which can be viewed inside skeletor/scripts/composer. These can be added to your composer.json to automate parts of your build.

These scripts run during composer install or composer update so you will have to execute those again.

Script List

  • Skeletor\\composer\\PHPCSHandler::installDrupalSniffs

    PHP Code Sniffer is installed at the project level. Because Drupal has unique lint rules we include them with the coder project. This script attaches the Drupal specific lint rules to PHP Code Sniffer.

  • Skeletor\\composer\\ProductionHandler::installNPM

    Searches project directories and runs npm install in directories where package.json is discovered.

  • Skeletor\\composer\\ProductionBuild::placeGitIgnore

    Looks for prod.gitignore in the project root and copies it to .gitignore. This is useful as a deploy step for Acquia.

  • Skeletor\\composer\\ProductionBuild::removeGitFolders

    Searches project directories looking for .git directories which signify a git repository. It removes the discovered .git directories to prepare these dependencies to be committed to the Acquia deployment repository.

Full Example

Example of the scripts section of your composer.json.

{
    "scripts": {
        "deploy": [
            "@composer install --prefer-dist --no-dev",
            "Skeletor\\composer\\ProductionBuild::removeGitFolders",
            "Skeletor\\composer\\ProductionBuild::placeGitIgnore"
        ],
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles",
            "Skeletor\\composer\\ProductionHandler::installNPM",
            "Skeletor\\composer\\PHPCSHandler::installDrupalSniffs"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles",
            "Skeletor\\composer\\ProductionHandler::installNPM",
            "Skeletor\\composer\\PHPCSHandler::installDrupalSniffs"
        ]
    }
}

Adjusting Drupal files

You can make adjustments to files provided by Drupal directly, such as settings.php, .htaccess, or robots.txt.

Commit the file with the changes in it's desired place within the docroot (web), such as robots.txt. Add it to drupal-scaffold:excludes array in composer.json, to prevent it from being overwritten during the build process.

{
    "extra": {
        "drupal-scaffold": {
            "excludes": [
                "robots.txt"
            ]
        }
    }
}

By default, we have excluded the settings.php file in the build process already. You can read more about further customizing the drupal build process at the Drupal-Scaffold documentation.

2. Layout

With 8.2.x we have pared Skeletor down to an install profile.

Skeletor will be installed within a drupal-project composer build: guidelines for a Drupal 8 composer project.

Skeletor profile is installed in web/profiles/contrib/skeletor

Installation of Skeletor will scaffold the project with the following:

  • A starter .travis.yml to ease CI.
  • Default Acquia cloud hooks are symlinked to the project root. You are free remove the symlink and implement your own hooks.
  • PHP Codesniffer installed as a project dependency with Drupal code sniffs pre-installed.
  • Drush alias boilerplate.
  • local configuration files (settings.local.php, etc)
  • Opt In git hooks which can be linked into the project .git/hooks directory.

3. Theme

Skeletor has a base theme (barebones) and one starterkit sub-theme that implements Bootstrap. Teams that want to create a child theme that is based on a different framework, they can base them off the base theme.

A. Barebones base theme (barebones) features

  • Mixin/preprocess for easily inserting SVG as data-uri in sass
  • Libraries for each feature in css framework
  • Out-of-the-box template suggestions for:
    • form
    • form elements
    • container
    • fields
    • blocks
    • taxonomy terms
    • paragraphs
    • media

B. Barebone Bootstrap base theme (barebones_bootstrap) features

  • Templates for page/navigation/forms for basic bootstrap markup/architecture.
  • Template overrides for Skeletor Paragraph components
  • Bootstrap specific SASS files and preprocess functions.
  • A Starterkit child theme (STARTERKIT) theme to be used as starting point for a new theme.

C. Starterkit (STARTERKIT) features

  • Bootstrap
  • Linters (sass-linter, eslint)
  • Live style guide
  • Templates for common features
  • Webpack integration
  • Images in src/images moved and optimized to dist/images dir
  • SVG in src/svg moved and optimized to dist/svg
  • Icon font with svg files in src/icons

See Starterkit README file for instructions on how to create custom theme for your project.

4. Modules

Skeletor contains modules that are commonly used in Myplanet projects:

  • paragraphs
  • pathauto
  • devel
  • admin_toolbar
  • rabbit_hole
  • google_tag
  • robotstxt
  • field_group
  • twig_tweak
  • coder
  • squizlabs/php_codesniffer
  • svg_image
  • memcache
  • config_split
  • xmlsitemap
  • metatag
  • seckit

5. Features

Skeletor contains the following features:

  • Skeletor Acquia
  • Skeletor Media
  • Skeletor Search
  • Skeletor Paragraph Components
    • Accordion
      • Hero
      • Media Object
      • Slideshow/carousel
      • Tabs
      • Text

6. Documentation

Documentation for this project (and Skeletor based projects) should be placed in their github wiki.

7. Configuration Management

The Configuration Management system provides a consistent API for defining and syncing configuration between instances of a Drupal site. Read more about configuration management in our wiki

8. Production Build Requirements

Trusted host security setting in Drupal 8

Drupal 8 supports trusted host patterns, where you can (and should) specify a set of regular expressions that the domains on incoming requests must match. It is important to setup them before deploying to ACQUIA or PANTHEON environments.

About

A skeleton Drupal install profile to set up an appropriate layout for Myplanet's install profile development strategy, striving toward continuous delivery and greater good.

Resources

Stars

Watchers

Forks

Packages

No packages published