-
Notifications
You must be signed in to change notification settings - Fork 270
Support loading guidelines and skills from vendor packages #566
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
Merged
+710
−31
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
17bffb2
Use vendor package guidelines
pushpak1300 4621d58
wip
pushpak1300 6360bba
Add node_modules skills detection
pushpak1300 b02cd0b
De-duplicate vendor core for alias packages and fix .md override
pushpak1300 01515ff
Refactor
pushpak1300 10016a5
Refactor
pushpak1300 8823cfd
Merge branch 'main' into replace_guidelines_from_vendor
pushpak1300 ec09a41
Update Inertia Guideline
pushpak1300 742b989
Merge branch 'replace_guidelines_from_vendor' of github.com:laravel/b…
pushpak1300 7cc8c0f
Merge branch 'main' into replace_guidelines_from_vendor
pushpak1300 656f114
fix wayfinder
pushpak1300 80b4669
Merge branch 'main' into replace_guidelines_from_vendor
pushpak1300 7ad5729
Merge remote-tracking branch 'origin/main' into replace_guidelines_fr…
pushpak1300 d9ad12c
Use implode for path joining consistency
pushpak1300 f11b815
Merge branch 'main' into replace_guidelines_from_vendor
pushpak1300 751972a
Add laravel echo and other first party packages
pushpak1300 b3be0f1
Fix code styling
pushpak1300 313be66
Update Npm.php
pushpak1300 90478ee
Merge branch 'replace_guidelines_from_vendor' of github.com:laravel/b…
pushpak1300 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 +1,16 @@ | ||
| # Inertia | ||
|
|
||
| - Inertia creates fully client-side rendered SPAs without modern SPA complexity, leveraging existing server-side patterns. | ||
| - Components live in `{{ $assist->inertia()->pagesDirectory() }}` (unless specified in `vite.config.js`). Use `Inertia::render()` for server-side routing instead of Blade views. | ||
| - ALWAYS use `search-docs` tool for version-specific Inertia documentation and updated code examples. | ||
| @if($assist->hasPackage(\Laravel\Roster\Enums\Packages::INERTIA_REACT)) | ||
| - IMPORTANT: Activate `inertia-react-development` when working with Inertia client-side patterns. | ||
| @elseif($assist->hasPackage(\Laravel\Roster\Enums\Packages::INERTIA_VUE)) | ||
| - IMPORTANT: Activate `inertia-vue-development` when working with Inertia Vue client-side patterns. | ||
| @elseif($assist->hasPackage(\Laravel\Roster\Enums\Packages::INERTIA_SVELTE)) | ||
| - IMPORTANT: Activate `inertia-svelte-development` when working with Inertia Svelte client-side patterns. | ||
| @endif | ||
|
|
||
| # Inertia v1 | ||
|
|
||
| - Inertia v1 does not support the following v2 features: deferred props, infinite scrolling (merging props + `WhenVisible`), lazy loading on scroll, polling, or prefetching. Do not use these. |
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,99 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Laravel\Boost\Support; | ||
|
|
||
| class Npm | ||
| { | ||
| /** @var array<int, string> */ | ||
| public const FIRST_PARTY_SCOPES = [ | ||
| '@inertiajs', | ||
| '@laravel', | ||
| ]; | ||
|
|
||
| /** @var array<int, string> */ | ||
| public const FIRST_PARTY_PACKAGES = [ | ||
| 'laravel-echo', | ||
| 'laravel-precognition', | ||
| 'laravel-vite-plugin', | ||
| ]; | ||
|
|
||
| public static function isFirstPartyPackage(string $npmName): bool | ||
| { | ||
| if (collect(self::FIRST_PARTY_SCOPES)->contains(fn (string $scope): bool => str_starts_with($npmName, $scope.'/'))) { | ||
| return true; | ||
| } | ||
|
|
||
| return in_array($npmName, self::FIRST_PARTY_PACKAGES, true); | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, string> | ||
| */ | ||
| public static function packagesDirectories(): array | ||
| { | ||
| return collect(static::packages()) | ||
| ->mapWithKeys(fn (string $key, string $package): array => [$package => implode(DIRECTORY_SEPARATOR, [ | ||
| base_path('node_modules'), | ||
| str_replace('/', DIRECTORY_SEPARATOR, $package), | ||
| ])]) | ||
| ->filter(fn (string $path): bool => is_dir($path)) | ||
| ->toArray(); | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, string> | ||
| */ | ||
| public static function packages(): array | ||
| { | ||
| $packageJsonPath = base_path('package.json'); | ||
|
|
||
| if (! file_exists($packageJsonPath)) { | ||
| return []; | ||
| } | ||
|
|
||
| $packageData = json_decode(file_get_contents($packageJsonPath), true); | ||
|
|
||
| if (json_last_error() !== JSON_ERROR_NONE) { | ||
| return []; | ||
| } | ||
|
|
||
| return collect($packageData['dependencies'] ?? []) | ||
| ->merge($packageData['devDependencies'] ?? []) | ||
| ->mapWithKeys(fn (string $key, string $package): array => [$package => $key]) | ||
| ->toArray(); | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, string> | ||
| */ | ||
| public static function packagesDirectoriesWithBoostGuidelines(): array | ||
| { | ||
| return self::packagesDirectoriesWithBoostSubpath('guidelines'); | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, string> | ||
| */ | ||
| public static function packagesDirectoriesWithBoostSkills(): array | ||
| { | ||
| return self::packagesDirectoriesWithBoostSubpath('skills'); | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, string> | ||
| */ | ||
| private static function packagesDirectoriesWithBoostSubpath(string $subpath): array | ||
| { | ||
| return collect(self::packagesDirectories()) | ||
| ->map(fn (string $path): string => implode(DIRECTORY_SEPARATOR, array_filter([ | ||
| $path, | ||
| 'resources', | ||
| 'boost', | ||
| $subpath, | ||
| ]))) | ||
| ->filter(fn (string $path): bool => is_dir($path)) | ||
| ->toArray(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.