Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Build scripts

2 sites No security coverage
View on drupal.org

This module allows you to trigger custom scripts directly from the Drupal user interface. It's designed to initiate builds, such as generating a static Gatsby site from your Drupal content, and can be adapted for various purposes by configuring environments and passing arguments to external shell scripts.

Build scripts is a module that adds functionality to run scripts from within Drupal user interface (for example to build a static site). This module is built for running Gatsby builds, but is very customizable and can be adapted to many different purposes. The module communicates with external build daemon and does nothing without it.

Our motivation for this project is that we want a button to our site that runs a script which builds a static Gatsby site from our Drupal data. Additionally we want it to support separate testing environment that our editors can use to check how their work looks on the Gatsby site.

This module has configurable environments that are passed to a shell script with current Drupal language as arguments. The shell script does most of the work.

Installation (for Gatsby)

  1. Install build daemon to you server according to README.
  2. Create a shell script that is responsible for the build (see README on build daemon):
    #!/usr/bin/env bash
    
    if [ ! $# -eq 2 ]; then
            printf "Invalid arguments\n" >&2
            exit 1
    fi
    
    ENVIRONMENT="$1"
    LANGUAGE="$2"
    LOCKFILE="/tmp/build-$LANGUAGE.lock" # Only one build per language is allowed
    GATSBY_DIR="/var/www/gatsby/$LANGUAGE/"
    WWW_DIR="/var/www/frontend/$LANGUAGE/$ENVIRONMENT/"
    
    echo "starting build for $ENVIRONMENT environment"
    cd "$GATSBY_DIR"
    
    # Better format for loggin Gatsby commands:
    export CI='true'
    
    # Prevent building multiple environments simultaneously.
    if ! mkdir "$LOCKFILE"; then
            printf "Failed to acquire lock.\n" >&2
            exit 1
    fi
    trap "rm -rf $LOCKFILE" EXIT  # remove the lockdir on exit
    if npx gatsby build && rsync -a --delete "$GATSBY_DIR/public/" "$WWW_DIR"; then
            echo "Build succeeded"
    else
            echo "Build failed :("
    	exit 1
    fi
    

Activity

Total releases
1
First release
Oct 2025
Latest release
9 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Release date
2.0.0-beta2 Pre-release Oct 1, 2025