Generator-hedley - Scaffold a headless Drupal backend, Angular app client, and Behat tests

Overview

generator-hedley Build Status

Scaffold a headless Drupal backend, Angular app client, and Behat tests

Hedley is a yeoman generator that scaffolds a headless Drupal backend, Angular app client, and Behat tests. Its a great starting point for learning and developing fully decoupled websites, that follow best practices, and includes automatic testing using Behat.

Getting Started

Prerequisites

  • Yo (npm install -g yo)
  • Drush
  • Composer installed globally, for Behat dependencies to be setup

Installation

To install generator-hedley from npm, run:

npm install -g generator-hedley

As we generate not only a Web app but also add behat and other scripts make sure to create a project directory.

mkdir my-hedley-project
cd my-hedley-project

Finally, initiate the generator:

yo hedley

CLI

You can scaffold a new app with no user interaction, for example:

yo hedley --skip-install --project-name=skeleton --github-repo=https://github.com/Foo/skeleton --db=skeleton --db-user=root --db-pass=root --drupal-url=http://localhost/skeleton/www

Pantheon's Cloud Integration

Integrated into hedley an automated scripts for "Pantheon’s Cloud Integration", The scripts are initiated through pantheon.yml and do the following:

  • Sanitization for the DEV database when cloned from TEST or LIVE environments (Basically replaces all domains in user's emails to @test).
  • Revert all features, The features will be reverted on each deploy to the DEV.

You can add or remove operations by editing pantheon.yml file in the root of the project.

Contribute

In order to develop generator-hedley and provide pull requests the following steps should be taken:

  1. Git clone your fork locally.
  2. npm install inside the new directory
  3. npm link - This makes your local system sync with the changes you make
  4. mkdir skeleton
  5. Inside the new directory, initiate yo hedley, and make sure to keep the default project name to skeleton
  6. cp sync_hedley.example.sh sync_hedley.sh
  7. Edit sync_hedley.sh and point the the GENERATOR_FOLDER variable to the place where generator-hedley is located
  8. From now on, you may easily sync back your changes back to the forked generator-hedley by executing ./sync_hedley.sh

Credits

Gizra

License

MIT

Comments
  • Introduce the yo hedley concept

    Introduce the yo hedley concept

    @mateu-aguilo-bosch this is a very early work, but the idea is (watch out, lots of buzz words):

    A yeoman generator that will scaffold an opinionated headless Drupal (read: RESTful), along with an Angular app, and Behat tests that use PhantomJs.

    • Drupal: RESTful, OG -- this is a typical use case we find ourself in Gizra doing over and over again. Dashboards for "groups" with private access.
    • Angular: Login, Switching between "groups", using angular ui-router
    • Behat: Few tests to assert the example app, and to show how to write ones.

    As a use case I thought about showing a Leaflet map, and each marker will represent an event. Each event will belong to a group.

    As reference you can see this project and this sandbox project I play with.

    opened by amitaibu 6
  • Drupal Bootstrap could not complete successfully.

    Drupal Bootstrap could not complete successfully.

    $ git clone https://github.com/Gizra/generator-hedley
    $ cd generator-hedley
    $ chmod +x install
    $ ./install
    drush status grep "Drupal bootstrap" | grep "Successful"
    

    console log

    exception 'Exception' with message 'Resolve all issues below to continue the installation. For help configuring your       [error]
    database server, see the <a href="http://drupal.org/getting-started/install">installation handbook</a>, or contact your
    hosting provider.<p class="error">Failed to connect to your database server. The server reports the following message:
    <em>SQLSTATE[HY000] [2002] No route to host</em>.<ul><li>Is the database server running?</li><li>Does the database exist,
    and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have
    you entered the correct database hostname?</li></ul></p>' in
    $HOME/generator-hedley/www/includes/install.core.inc:415
    Stack trace:
    #0 $HOME/generator-hedley/www/includes/install.core.inc(339): install_run_task(Array, Array)
    #1 $HOME/blog/generator-hedley/www/includes/install.core.inc(77): install_run_tasks(Array)
    #2 $HOME/.composer/vendor/drush/drush/includes/drush.inc(725): install_drupal(Array)
    #3 $HOME/.composer/vendor/drush/drush/includes/drush.inc(711): drush_call_user_func_array('install_drupal', Array)
    #4 $HOME/.composer/vendor/drush/drush/commands/core/drupal/site_install_7.inc(82): drush_op('install_drupal', Array)
    #5 $HOME/.composer/vendor/drush/drush/commands/core/site_install.drush.inc(247):
    drush_core_site_install_version('hedley', Array)
    #6 [internal function]: drush_core_site_install('hedley')
    #7 $HOME/.composer/vendor/drush/drush/includes/command.inc(366): call_user_func_array('drush_core_site...', Array)
    #8 $HOME/.composer/vendor/drush/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
    #9 [internal function]: drush_command('hedley')
    #10 $HOME/.composer/vendor/drush/drush/includes/command.inc(185): call_user_func_array('drush_command', Array)
    #11 $HOME/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
    #12 $HOME/.composer/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
    #13 $HOME/.composer/vendor/drush/drush/drush.php(12): drush_main()
    #14 {main}
    
    > Set the file permissions on the sites/default/files directory
    
    > Enabling the development modules
    Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal      [error]
    environment to run this command.
    The drush command 'en devel views_ui field_ui' could not be executed.                                                      [error]
    Drush was not able to start (bootstrap) the Drupal database.                                                               [error]
    Hint: This may occur when Drush is trying to:
     * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another
    site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush
    topic docs-aliases` for details.
     * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed
    shell. See http://drupal.org/node/1428638 for details.
    
    Drush was attempting to connect to:
     Drupal version         :  7.43
     Site URI               :  http://default
     PHP executable         :  /usr/local/bin/php
     PHP configuration      :  /usr/local/etc/php/5.5/php.ini
     PHP OS                 :  Darwin
     Drush script           :  $HOME/.composer/vendor/drush/drush/drush.php
     Drush version          :  8.1.2
     Drush temp directory   :  /tmp
     Drush configuration    :
     Drush alias files      :
     Drupal root            :  $HOME/generator-hedley/www
     Drupal Settings File   :  sites/default/settings.php
     Site path              :  sites/default
    
    > Run post_install script.
    
      Installation failure!
      > Drupal Bootstrap could not complete successfully.
    

    I am hosting a drupal to the pantheon.

    http://dev-syui.pantheonsite.io/

    I made a page on GitHub.

    https://syui.github.io/elm-hedley/

    src/elm/Config.elm

    // https://github.com/Gizra/elm-hedley/commit/f374a3b1680b16d1d3b0f722a74c7c82f28b4f6a#diff-12275ec22d3941822667dda3d8c44b44L8
    prodBackend : BackendConfig
    prodBackend =
      { backendUrl = "http://dev-syui.pantheonsite.io"
      , githubClientId = "xxxxxxxxxxxxxxx"
      , name = "gh-pages"
      , hostname = "syui.github.io"
      }
    

    However, it does not end load.

    Bootstrap will seem like it is not functioning.

    $ git clone https://github.com/Gizra/hedley-server
    $ cd hedley-server
    $ ./install
    $ rm www/profiles/hedley
    $ cp -rf ./hedley www/profiles
    $ rm www/.gitignore
    $ cd www
    # pantheon upload
    $ git init ... git push
    

    SFTP mode, and change the permissions on the settings.php to 644.

    https://pantheon.io/docs/filesystem-faq/

    $ sftp -o Port=2222 dev.foo...
    $ cd /code/site/default
    $ chmod 644 settings.php
    

    Please let me know if there are any issues.

    Thanks!

    opened by syui 3
  • Make sure to create a working directory.

    Make sure to create a working directory.

    Following the instructions I end up with lot's of files in the current directory.

    afaik yo always generate a project directory so let at least instruct people to do so.

    opened by clemens-tolboom 3
  • Add CTools patch

    Add CTools patch

    projects[ctools][patch][] = "https://www.drupal.org/files/issues/2067997-reload-plugins-class-7.patch"

    This will fix issues when trying to write tests that have the $profile set

    /**
     * FooCrud tests.
     */
    class FooCrud extends DrupalWebTestCase {
    
      /**
       * The profile name.
       *
       * @var string
       */
      protected $profile = 'skeleton';
    
    opened by amitaibu 0
  • Travis scaffolding isn't working

    Travis scaffolding isn't working

    We call a wrong file here - https://github.com/Gizra/generator-hedley/blob/db14d40007e4af26970413b3d5bbc87e3bea3e81/app/templates/_travis.yml#L58

    Also, on a newly scaffolded site, I had to manually chmod +x scripts/travis/*.sh

    1 - Ready 
    opened by amitaibu 1
  • WIP: Adding composer.json

    WIP: Adding composer.json

    #103

    I started by creating the things we into composer file. We don't need bootstrap but it's looked good enough to see how it's interact.

    One more critical issue is patching. Composer don't support it out of the box like drush make but I found a script for that - https://github.com/jpstacey/composer-patcher - but when running it I got:

    Composer\Patcher\PatcherPlugin::postPackageInstall PHP Fatal error: Call to undefined method Composer\Script\Event::getOperation() in /Applications/MAMP/htdocs/composer-drupal/vendor/jpstacey/composer-patcher/src/Composer/Patcher/PatcherPlugin.php on line 48

    Fatal error: Call to undefined method Composer\Script\Event::getOperation() in /Applications/MAMP/htdocs/composer-drupal/vendor/jpstacey/composer-patcher/src/Composer/Patcher/PatcherPlugin.php on line 48

    Any way it's look very very cool.

    opened by RoySegall 1
Laravel generator with GUI. Generate crud / scaffold.

Laravel generator with GUI. Generate crud / scaffold.

George 420 Dec 5, 2022
Navigator is a package to create headless navigation menus for use in Laravel applications

Navigator Navigator is a package to create headless navigation menus for use in Laravel applications: // In a Service Provider Nav::define(fn ($user)

Sam Rowden 36 Oct 30, 2022
A web app for detecting backend technologies used in a web app, Based on wappalyzer node module

About Techdetector This a web fingerprinting application, it detects back end technologies of a given domain by using the node module wappalyzer. And

Shobi 17 Dec 30, 2022
This repo can be used to scaffold a Laravel package

This repo can be used to scaffold a Laravel package. Follow these steps to get started: Press the "Use template" button at the to

Spatie 1.4k Jan 4, 2023
Chrome extension to generate Laravel integration tests while using your app.

Laravel TestTools Check out the introduction post about the chrome extension. Installation git clone [email protected]:mpociot/laravel-testtools.git # i

Marcel Pociot 473 Nov 1, 2022
Laravel Design Pattern Generator (api generator)

Laravel Design Pattern Generator (api generator) you can create your restful api easily by using this library and you can filter, sort and include elo

HusseinAlaa 2 Sep 25, 2022
Laravel Backend for Learnbot app

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Mobile & Backend developer 4 May 18, 2021
NYC Checkbook - Drupal 9 migration

Checkbook NYC Checkbook NYC is an open source financial transparency web application. Checkbook provides transparent access to a city's or other juris

Office of the Comptroller, City of New York 1 Jan 14, 2022
Fully customizable and tests supported Laravel admin dashboard for developers.

Laravel Admin dashboard Like Laravel Jetstream but built with Hotwire Turbo + additional perks. Tools used: tailwindcomponents/dashboard Hotwire Turbo

null 12 Nov 1, 2022
Perform Self-Diagnosis Tests On Your Laravel Application

Perform Self-Diagnosis Tests On Your Laravel Application This package allows you to run self-diagnosis tests on your Laravel application. It comes wit

Beyond Code 1.4k Dec 13, 2022
Removes whitelisted unnecessary files (like tests/docs etc.) from vendor directory

Composer vendor cleanup This is a simple script for the Composer to remove unnecessary files (documentation/examples/tests etc.) from included vendor

Chris 2 Nov 14, 2022
Laravel-veneer - A suite of mocked services to use in your Laravel tests.

Laravel Veneer A suite of fixture data and methods to help make mocking 3rd party services easier. Overview Laravel Veneer aims to solve two problems

Oh See Software 4 Jun 23, 2022
Testbench Component is the de-facto package that has been designed to help you write tests for your Laravel package

Laravel Testing Helper for Packages Development Testbench Component is the de-facto package that has been designed to help you write tests for your La

Orchestra Platform 1.9k Dec 29, 2022
This package provides a trait to run your tests against a MinIO S3 server.

Laravel MinIO Testing Tools This package provides a trait to run your tests against a MinIO S3 server. ?? Blog post: https://protone.media/en/blog/how

Protone Media 7 Oct 12, 2022
A REST client inside your Laravel app

Laravel Compass is an elegant REST assistant for the Laravel framework that you can use to test API calls and create API documentation. it provides automatically endpoints for GET, POST, PUT/PATCH, DELETE, various auth mechanisms, and other utility endpoints based on Laravel routes in your project.

David H. Sianturi 1.2k Dec 31, 2022
A simple blog app where a user can signup , login, like a post , delete a post , edit a post. The app is built using laravel , tailwind css and postgres

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Nahom_zd 1 Mar 6, 2022
CV-Resumes-App is helped us to build resume .. you can help me to improve this app...

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Eng Hasan Hajjar 2 Sep 30, 2022
Web application with Laravel in Backend and VueJS in Frontend

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Benjdia Saad 1 Oct 12, 2021
Laravel application project as Sheina Online Store backend to be built with Laravel and VueJS

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Boas Aditya Christian 1 Jan 11, 2022