generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from hotwired-laravel/strada
Support Strada
- Loading branch information
Showing
14 changed files
with
149 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace HotwiredLaravel\StimulusLaravel\Commands; | ||
|
||
use HotwiredLaravel\StimulusLaravel\StimulusGenerator; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\File; | ||
use Illuminate\Support\Facades\Process; | ||
|
||
class StradaMakeCommand extends Command | ||
{ | ||
public $signature = 'strada:make | ||
{name : The Strada Component name (without bridge prefix.} | ||
{--prefix=bridge : The component prefix.} | ||
{--bridge-name= : The name of the native component.}'; | ||
|
||
public $description = 'Makes a new Strada Component.'; | ||
|
||
public function handle(StimulusGenerator $generator): int | ||
{ | ||
$this->components->info('Making Strada Component'); | ||
|
||
$this->components->task('creating strada component', function () use ($generator) { | ||
$generator->createStrada($this->option('prefix'), $this->argument('name'), $this->option('bridge-name')); | ||
|
||
return true; | ||
}); | ||
|
||
if (! File::exists(base_path('routes/importmap.php'))) { | ||
$this->components->task('regenerating manifest', function () { | ||
return $this->callSilently(ManifestCommand::class); | ||
}); | ||
|
||
if (file_exists(base_path('pnpm-lock.yaml'))) { | ||
Process::forever()->path(base_path())->run(['pnpm', 'run', 'build']); | ||
} elseif (file_exists(base_path('yarn.lock'))) { | ||
Process::forever()->path(base_path())->run(['yarn', 'run', 'build']); | ||
} else { | ||
Process::forever()->path(base_path())->run(['npm', 'run', 'build']); | ||
} | ||
} | ||
|
||
$this->newLine(); | ||
$this->components->info('Done'); | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { application } from 'libs/stimulus' | ||
import { Stimulus } from 'libs/stimulus' | ||
|
||
// Eager load all controllers defined in the import map under controllers/**/*_controller | ||
import { eagerLoadControllersFrom } from '@hotwired/stimulus-loading' | ||
eagerLoadControllersFrom('controllers', application) | ||
eagerLoadControllersFrom('controllers', Stimulus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { Application } from '@hotwired/stimulus' | ||
|
||
const application = Application.start() | ||
const Stimulus = Application.start() | ||
|
||
// Configure Stimulus development experience | ||
application.debug = false | ||
window.Stimulus = application | ||
Stimulus.debug = false | ||
|
||
export { application } | ||
window.Stimulus = Stimulus | ||
|
||
export { Stimulus } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { BridgeComponent, BridgeElement } from "@hotwired/strada" | ||
|
||
// Connects to data-controller="[attribute]" | ||
export default class extends BridgeComponent { | ||
static component = "[bridge-name]" | ||
|
||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters