Skip to content

Commit 3aa2c8d

Browse files
committed
More controlled guideliens
Signed-off-by: Pushpak Chhajed <[email protected]>
1 parent 0d187da commit 3aa2c8d

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

.ai/foundation.blade.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
- Do not change the application's dependencies without approval.
3131

3232
## Frontend Bundling
33-
@if ($assist->config->usesSail)
34-
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `{{ $assist->composerCommand('run dev') }}`. Ask them.
35-
@else
36-
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `{{ $assist->nodePackageManager() }} run build`, `{{ $assist->nodePackageManager() }} run dev`, or `{{ $assist->composerCommand('run dev') }}`. Ask them.
37-
@endif
33+
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `{{ $assist->nodePackageManager('run build') }}`, `{{ $assist->nodePackageManager('run dev') }}`, or `{{ $assist->composerCommand('run dev') }}`. Ask them.
3834

3935
## Replies
4036
- Be concise in your explanations - focus on what's important rather than explaining obvious details.

.ai/laravel/core.blade.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,4 @@
4242
- When creating tests, make use of `{{ $assist->artisanCommand('make:test [options] <name>') }}` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.
4343

4444
### Vite Error
45-
@if ($assist->config->usesSail)
46-
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->composerCommand('run dev') }}` or ask the user to run it.
47-
@else
48-
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->nodePackageManager() }} run build` or ask the user to run `{{ $assist->nodePackageManager() }} run dev` or `{{ $assist->composerCommand('run dev') }}`.
49-
@endif
45+
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->nodePackageManager('run build') }}` or ask the user to run `{{ $assist->nodePackageManager('run dev') }}` or `{{ $assist->composerCommand('run dev') }}`.

.ai/sail/core.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- Start services using `{{$assist->sailBinaryPath()}} up -d` and stop them with `{{$assist->sailBinaryPath()}} stop`.
88
- Open the application in the browser by running `{{$assist->sailBinaryPath()}} open`.
99
- Always prefix PHP, Artisan, Composer, and Node commands** with `{{$assist->sailBinaryPath()}}`. Examples:
10-
- Run migrations: `{{$assist->sailBinaryPath()}} artisan migrate`
11-
- Install Composer packages: `{{$assist->sailBinaryPath()}} composer install`
12-
- Run npm: `{{$assist->sailBinaryPath()}} npm run dev`
10+
- Run Artisan Commands: `{{$assist->artisanCommand('migrate')}}`
11+
- Install Composer packages: `{{$assist->composerCommand('install')}}`
12+
- Execute node commands: `{{$assist->nodePackageManager('run dev')}}`
1313
- Execute PHP scripts: `{{$assist->sailBinaryPath()}} php [script]`
1414
- View all available Sail commands by running `{{$assist->sailBinaryPath()}}` without arguments.

src/Install/GuidelineAssist.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,14 @@ public function inertia(): Inertia
164164
return new Inertia($this->roster);
165165
}
166166

167-
public function nodePackageManager(): string
167+
public function nodePackageManager(string $command): string
168168
{
169-
return ($this->roster->nodePackageManager() ?? NodePackageManager::NPM)->value;
169+
$manager = ($this->roster->nodePackageManager() ?? NodePackageManager::NPM)->value;
170+
$nodePackageManagerCommand = $this->config->usesSail
171+
? Sail::nodePackageManagerCommand($manager)
172+
: $manager;
173+
174+
return "{$nodePackageManagerCommand} {$command}";
170175
}
171176

172177
public function artisanCommand(string $command): string

src/Install/Sail.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ public static function composerCommand(): string
2525
return self::BINARY_PATH.' composer';
2626
}
2727

28+
public static function nodePackageManagerCommand(string $manager): string
29+
{
30+
return self::BINARY_PATH.' '.$manager;
31+
}
32+
2833
public function isInstalled(): bool
2934
{
3035
return file_exists(base_path(self::BINARY_PATH)) &&
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Blade with @assist variable
22

3-
Run `{{ $assist->nodePackageManager() }} install` to install dependencies.
3+
Run `{{ $assist->nodePackageManager('install') }}` to install dependencies.
44

5-
Package manager: {{ $assist->nodePackageManager() }}
5+
Package manager: {{ $assist->nodePackageManager('install') }}

0 commit comments

Comments
 (0)