Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Add install:collaboration command #9760

Merged
merged 59 commits into from
Apr 15, 2024

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Mar 19, 2024

This pull request introduces a new install:collaboration command which makes it really easy to setup Laravel's broadcast scaffolding, install a broadcast driver (like Laravel Reverb or Pusher) and install the statamic/collaboration package, all in a single command.

Related: laravel/framework#50662

@duncanmcclean duncanmcclean force-pushed the install-collaboration-command branch from e8539b6 to 97cf512 Compare March 19, 2024 21:05
@duncanmcclean duncanmcclean marked this pull request as ready for review March 19, 2024 21:26
duncanmcclean and others added 4 commits March 25, 2024 11:17
You can tell where I borrowed this code from, eh?
# Conflicts:
#	src/Providers/ConsoleServiceProvider.php
Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this, I immediately get an error about Pusher because it's not installed.

sandbox on  master [!?] 
→ plz install:collaboration 

   Statamic\Console\Processes\Exceptions\ProcessException 

  ./composer.json has been updated
Running composer update statamic/collaboration --with-dependencies
> Statamic\Console\Composer\Scripts::preUpdateCmd
Loading composer repositories with package information
Dependency statamic/cms is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking statamic/collaboration (dev-statamic-5-support 36d0846)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing statamic/collaboration (dev-statamic-5-support 36d0846): Extracting archive
  - Downloading statamic/collaboration (dist)
    Failed to download
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Error 

  Class "Pusher\Pusher" not found

  at vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php:306
    302▕      * @return \Pusher\Pusher
    303▕      */
    304▕     public function pusher(array $config)
    305▕     {
  ➜ 306▕         $pusher = new Pusher(

src/Console/Commands/InstallCollaboration.php Outdated Show resolved Hide resolved
When we use the `Broadcast` facade in the Collaboration addon's `ServiceProvider`, if the `BROADCAST_DRIVER` is `pusher`, you'll see an error when the Pusher driver hasn't yet been installed.
@duncanmcclean
Copy link
Member Author

@jasonvarga It looks like this was happening due to the Collaboration addon's ServiceProvider calling the Broadcast facade which subsequently tried to use the Pusher SDK which hasn't yet been installed.

This would only happen if the BROADCAST_DRIVER was set to pusher (< Laravel 11 apps).

To fix this, I've pushed up a fix which'll prevent composer scripts from running when we initially require statamic/collaboration. I've also included the compatible version of the collaboration addon in the composer require (we should probably take this out before merging / before tagging 5.0).

@jasonvarga jasonvarga merged commit 2c4fa01 into master Apr 15, 2024
31 checks passed
@jasonvarga jasonvarga deleted the install-collaboration-command branch April 15, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants