Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Fix Code Styling

on: [ push ]
on:
push:
branches:
- main
- '*.x'

jobs:
lint:
Expand All @@ -18,7 +22,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
php-version: 8.4
extensions: json, dom, curl, libxml, mbstring
coverage: none

Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 8.1, 8.2, 8.3, 8.4 ]
php: [ 8.2, 8.3, 8.4 ]
Comment thread
aarondfrancis marked this conversation as resolved.
laravel: [ '10.*', '11.*', '12.*' ]
dependency-version: [ prefer-lowest, prefer-stable ]

exclude:
- laravel: 11.*
php: 8.1
- laravel: 12.*
php: 8.1

name: P${{ matrix.php }} / L${{ matrix.laravel }} / ${{ matrix.dependency-version }}

steps:
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## Unreleased

### Added
- PHP 8.4 support in CI test matrix

### Changed
- Default config now uses Vite instead of Laravel Mix (`vite.config.js`, `build/manifest.json`, `build/assets`)
- Modernized codebase with strict PHP typing (return types, parameter types, property types)
- Updated minimum dev dependency versions for PHPUnit 10+ compatibility
- CI workflow now uses local Pint instead of global installation

### Removed
- Support for PHPUnit 8 and 9
- Support for Orchestra Testbench < 8.21 and < 9.2
- Unused MySQL service from CI workflow
- Legacy test script

## 0.2.3 - 2022-02-15
- Added: Support for Laravel 9

Expand Down
15 changes: 6 additions & 9 deletions config/airdrop.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
// this makes the most sense and doesn't need to be changed.
resource_path(),

// Any time the webpack.mix.js file is changed, it could affect the
// Any time the vite.config.js file is changed, it could affect
// the build steps, and therefore the built files.
base_path('webpack.mix.js'),
base_path('vite.config.js'),

// Depending on your package manager, you'll want to uncomment one
// of the following lines. Whenever JS packages are updated or
Expand Down Expand Up @@ -120,14 +120,11 @@
* Files or folders that should be included.
*/
'include' => [
// The mix-manifest file tells Laravel how to get your versioned assets.
public_path('mix-manifest.json'),
// The Vite manifest file tells Laravel how to get your versioned assets.
public_path('build/manifest.json'),

// Compiled CSS.
public_path('css'),

// Compiled JS.
public_path('js'),
// Compiled assets from Vite.
public_path('build/assets'),
],

/*
Expand Down
4 changes: 2 additions & 2 deletions src/AirdropServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class AirdropServiceProvider extends ServiceProvider
{
public function boot()
public function boot(): void
{
if ($this->app->runningInConsole()) {
$this->commands([
Expand All @@ -32,7 +32,7 @@ public function boot()
], 'config');
}

public function register()
public function register(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/airdrop.php', 'airdrop');
}
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
namespace AaronFrancis\Airdrop\Commands;

use AaronFrancis\Airdrop\HashGenerator;
use Arr;
use Illuminate\Console\Command;
use Illuminate\Support\Arr;

class Debug extends Command
{
protected $signature = 'airdrop:debug {--trigger=}';

protected $description = 'Output the array of all triggers, or a specific trigger.';

public function handle()
public function handle(): void
{
$output = HashGenerator::make()->asArray();

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Download extends Command

protected $description = 'Run as a part of your deploy pipeline *before* assets are built.';

public function handle()
public function handle(): void
{
config([
'airdrop.verbose' => $this->option('verbose')
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Hash extends Command

protected $description = 'Output the calculated hash.';

public function handle()
public function handle(): void
{
$hash = HashGenerator::make()->generate();

Expand Down
15 changes: 1 addition & 14 deletions src/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@

class Install extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'airdrop:install';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Install the Airdrop config file into your app.';

public function __construct()
Expand All @@ -35,10 +25,7 @@ public function __construct()
}
}

/**
* @throws Exception
*/
public function handle()
public function handle(): void
{
Artisan::call('vendor:publish', [
'--provider' => AirdropServiceProvider::class
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Upload extends Command

protected $description = 'Run as a part of your deploy pipeline *after* assets are built.';

public function handle()
public function handle(): void
{
config([
'airdrop.verbose' => $this->option('verbose')
Expand Down
17 changes: 3 additions & 14 deletions src/Concerns/MakesDrivers.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@

trait MakesDrivers
{
/**
* @return BaseDriver
*
* @throws Exception
*/
public function makeDriver()
public function makeDriver(): BaseDriver
{
$config = $this->getDriverConfig();

Expand All @@ -30,21 +25,15 @@ public function makeDriver()
return $class->setConfig($config)->setCurrentHash(HashGenerator::make()->generate());
}

/**
* @return string|null
*/
public function getDriverConfig()
public function getDriverConfig(): ?array
{
$driver = config('airdrop.driver') ?? 'DRIVER_NOT_SET';
$drivers = config('airdrop.drivers');

return Arr::get($drivers, $driver);
}

/**
* @throws Exception
*/
protected function ensureDriverExtendsBase($driver)
protected function ensureDriverExtendsBase(mixed $driver): void
{
if (!is_subclass_of($driver, BaseDriver::class)) {
throw new Exception('Airdrop drivers must extend ' . json_encode(BaseDriver::class));
Expand Down
5 changes: 1 addition & 4 deletions src/Contracts/TriggerContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ interface TriggerContract
/**
* Return any state that should be considered when determining
* whether or not your build process needs to run again.
*
* @param array $config
* @return array
*/
public function triggerBuildWhenChanged($config = []);
public function triggerBuildWhenChanged(array $config = []): array;
}
28 changes: 9 additions & 19 deletions src/Drivers/BaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,32 @@

abstract class BaseDriver
{
/**
* Config for this specific driver.
*
* @var array
*/
protected $config;

/**
* Current hash based on all inputs.
*
* @var string
*/
protected $hash;

public function setConfig($config)
protected array $config = [];

protected string $hash = '';

public function setConfig(array $config): static
{
$this->config = $config;

return $this;
}

public function setCurrentHash($hash)
public function setCurrentHash(string $hash): static
{
$this->hash = $hash;

return $this;
}

public function output($line)
public function output(string $line): void
{
if (config('airdrop.verbose')) {
echo "[Airdrop] $line\n";
}
}

abstract public function download();
abstract public function download(): void;

abstract public function upload();
abstract public function upload(): void;
}
Loading