First Class Development Workflow Rob Bayliss | CTO @rbayliss | - - PowerPoint PPT Presentation

first class development workflow
SMART_READER_LITE
LIVE PREVIEW

First Class Development Workflow Rob Bayliss | CTO @rbayliss | - - PowerPoint PPT Presentation

First Class Development Workflow Rob Bayliss | CTO @rbayliss | rob@lastcallmedia.com https:/ /github.com/LastCallMedia/LCM-Scaffolding Leveling up your builds in Drupal 8 A case study of a somewhat opinionated development framework. An


slide-1
SLIDE 1

First Class Development Workflow

Rob Bayliss | CTO @rbayliss | rob@lastcallmedia.com https:/ /github.com/LastCallMedia/LCM-Scaffolding

slide-2
SLIDE 2

Leveling up your builds in Drupal 8

A case study of a somewhat opinionated development framework. An example for how you can roll your own scaffolding.

slide-3
SLIDE 3

Problem: Starting a (good) Drupal project is too complicated!

slide-4
SLIDE 4

Things to consider when setting up a project

  • How to pull in Drupal core/projects so they can be

updated.

  • How to pull in external libraries (front and back

end)

  • Asset pipeline
  • Testing process and tools
  • Coding standards
slide-5
SLIDE 5

Problem: Every project has a different way of doing things!

slide-6
SLIDE 6

Things we don’t want to change between projects

  • Coding standards
  • Top level development tools
  • The interface to those tools
  • Deployment process
slide-7
SLIDE 7

Things we want to be able to change

  • Packages (drupal modules, front end frameworks)
  • Custom code
  • Asset pipelines
  • Tests
slide-8
SLIDE 8

Solution: Let’s build a scaffold!

  • Quick to set up
  • Capture best practices
  • Standard framework of tools
  • Standard UI layer
  • Compile and minify assets
  • Static code checks based on configurable parameters
  • Behat and performance testing
  • Extensible build process
  • Exclude dependency code
slide-9
SLIDE 9

The tools we use:

slide-10
SLIDE 10

Composer

  • Based on drupal.org Packagist
  • Download modules, themes and libraries
  • Apply complex version constraints to

dependencies

  • Apply patches with cweagans/composer-patches
  • Parallel downloading with hirak/prestissimo

Usage: composer require drupal/ctools

slide-11
SLIDE 11

NPM

  • Simple installation of build tools
  • Huge ecosystem
  • Not PHP (no interdependencies with your project)
  • Javascript
  • Roll your own packages for build functionality

Usage: npm install —save gulp-imagemin

slide-12
SLIDE 12

Bower

  • Front end package manager for CSS frameworks

and JS libraries

  • Also not PHP
  • Allows easy updates of front end dependencies
  • Roll your own package for common brand assets

Usage: bower install —save foundation-sites

slide-13
SLIDE 13

ESLint

  • Static code checker for JS
  • Rules set by Drupal code standards

Usage: eslint themes/custom

slide-14
SLIDE 14

Coder/PHPCS

  • Static code checker for PHP
  • Detects security issues and standards violations
  • Use to protect your team from crappy code

Usage: phpcs --standard=vendor/drupal/coder/ coder_snifger/Drupal

slide-15
SLIDE 15

Behat

  • BDD for web sites
  • Align stakeholders on requirements
  • Test JS functionality

Usage: behat

slide-16
SLIDE 16

Phantomas

  • Front end performance testing
  • Run assertions on performance metrics
  • Grab screenshots of key pages

Usage: phantomas --url=http://localhost/scafgold

slide-17
SLIDE 17

Autoprefixer

  • Add browser prefjxes to CSS rules
  • Smart database of rules from caniuse.com
  • Allows your CSS to become leaner over time as

browsers advance

slide-18
SLIDE 18

SASS

  • Everyone’s favorite CSS preprocessor
  • Many frameworks to choose from
  • When used with a framework, allows you to

dynamically rebuild the framework with your settings

slide-19
SLIDE 19

Other tools

  • Minifjcation
  • Auto generation of source maps
slide-20
SLIDE 20

Gulp

  • Javascript task runner
  • 100% customizable build tasks
  • Hundreds/thousands of possible integrations
  • Ties all of the pieces together
  • Provides the common interface for developers

Usage: gulp

slide-21
SLIDE 21
  • Not a base theme!
  • Foundation based
  • Minimal implementation (messages, tabs,

breadcrumbs, pager)

Scaffold Theme

slide-22
SLIDE 22

Pattern Library

  • Barebones implementation of a style guide
  • Idea shamelessly stolen from Pattern Lab
  • Dynamic elements, passed through the Drupal

theme layer

slide-23
SLIDE 23
  • Easily build a release artifact from this project and

deploy to a downstream repository Usage: DOWNSTREAM=git@my.git.repo BRANCH=feature-1 MESSAGE=“This is an awesome commit!” scripts/ push-to-downstream.sh

Artifact Based Build

slide-24
SLIDE 24

Future possibilities

  • Lean “production mode” version
  • PHPUnit setup
  • Docker support (docker-compose.yml)
  • More robust pattern library
  • Increased support for an artifact based build

(switch to gulp for artifact build/push)

  • Image and CSS optimization
  • Automatic generation of sprites and/or icon fonts
slide-25
SLIDE 25

MIT Student

Cheers!

https://github.com/LastCallMedia/LCM-Scaffolding