Skip to content

Inertia second try #5627

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Inertia second try #5627

wants to merge 8 commits into from

Conversation

andrasbacsai
Copy link
Member

Initial Inertia integration - the first one was too hacky.

@andrasbacsai andrasbacsai added the 🐰 Release The Rabbit Run CodeRabbitAI review label Apr 16, 2025
@andrasbacsai andrasbacsai self-assigned this Apr 16, 2025
Copy link
Contributor

coderabbitai bot commented Apr 16, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Introduced a new Inertia.js-powered UI with initial Home page and layout.
    • Added reusable UI components, including Button and Switch, with enhanced styling and theming support.
    • Integrated Tailwind CSS with custom theming and dark mode support.
    • Added TypeScript configuration for improved type safety in frontend code.
  • Enhancements

    • Updated dependencies to support Inertia.js, Vue 3, and modern frontend tooling.
    • Improved environment variable and FQDN handling for applications and services.
    • Expanded Tailwind CSS configuration with semantic color tokens and animation support.
  • Chores

    • Updated project and nightly version numbers.
    • Added new sponsors to the documentation.
  • Bug Fixes

    • Adjusted Git branch URL generation to include the application's base directory.

Summary by CodeRabbit

  • New Features

    • Introduced a new Inertia.js-powered UI with a placeholder Home page.
    • Added reusable UI components, including Button and Switch, with advanced styling and variant support.
    • Implemented a new Inertia layout and routing for the updated interface.
    • Integrated Tailwind CSS with custom theming and dark mode support.
    • Added TypeScript support and configuration for improved development experience.
  • Chores

    • Updated and added various dependencies to support Inertia.js, Vue 3, Tailwind CSS, and related tooling.
    • Added sponsors to the documentation.
    • Incremented version numbers for the project.
  • Refactor

    • Improved internal handling of environment variables and FQDN generation for consistency and clarity.
  • Bug Fixes

    • Enhanced Git branch URL generation to include the application's base directory.

Walkthrough

A new Inertia.js and Vue 3 front-end stack has been integrated into the application. This includes new dependencies, TypeScript support, a custom Tailwind CSS configuration, and a dedicated Inertia middleware. The HTTP kernel and route service provider are updated to support Inertia requests and routing. Several new UI components and utility files are introduced, including a button and switch, as well as a placeholder home page. The application's version is incremented. Minor formatting and logic clarifications are made in environment variable handling, but core backend logic remains unchanged. Additional sponsor acknowledgments are appended to the README.

Changes

File(s) / Path(s) Change Summary
README.md Two new sponsors added to the sponsor section.
app/Http/Kernel.php
app/Http/Middleware/HandleInertiaRequests.php
Global middleware stack updated to include new HandleInertiaRequests middleware, which sets up Inertia root template and shared props.
app/Models/Application.php gitBranchLocation accessor now appends base_directory to generated URLs.
app/Providers/RouteServiceProvider.php
routes/inertia.php
New route group with web middleware and /next prefix loads routes from routes/inertia.php, which defines a root route rendering the Inertia Home component.
bootstrap/helpers/shared.php Refactored newParser function for improved readability and consistent handling of environment variables and FQDN generation; logic unchanged.
components.json
tsconfig.json
New configuration files for Vue component system and TypeScript compiler.
composer.json Added inertiajs/inertia-laravel dependency.
config/constants.php
versions.json
other/nightly/versions.json
Application version incremented from 4.0.0-beta.409 to 4.0.0-beta.410 and nightly to 4.0.0-beta.411.
package.json Added dependencies for Inertia.js, Vue 3, UI libraries, and TypeScript.
resources/css/inertia.css New CSS file with custom font, color variables, and dark mode support for Inertia views.
resources/js/Pages/Home.vue New Vue 3 page component with placeholder text and console log.
resources/js/components/ui/button/Button.vue
resources/js/components/ui/button/index.ts
New Button component and style variants using class-variance-authority.
resources/js/components/ui/switch/Switch.vue
resources/js/components/ui/switch/index.ts
New Switch component for UI toggles, with re-export index.
resources/js/inertia.app.js Inertia.js app bootstrap file for Vue 3 SPA integration.
resources/js/lib/utils.ts Utility function cn for merging and optimizing Tailwind class names.
resources/views/layouts/inertia.blade.php New Blade layout for Inertia.js views, loading required assets and rendering Inertia content.
tailwind.config.js Tailwind CSS config updated with semantic color tokens, new content paths, border radius, and plugins for animation and forms.
vite.config.js Vite config updated to include new CSS and JS entry points and PostCSS plugins.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant Laravel
    participant InertiaMiddleware
    participant InertiaVueApp

    Browser->>Laravel: HTTP GET /next/
    Laravel->>InertiaMiddleware: HandleInertiaRequests
    InertiaMiddleware->>Laravel: Set root template, share props
    Laravel->>InertiaVueApp: Render Home.vue via Inertia
    InertiaVueApp->>Browser: Serve SPA with inertia.app.js and inertia.css
    Browser->>InertiaVueApp: SPA navigation/events
    InertiaVueApp->>Laravel: Inertia requests as needed
Loading

Self-hosting is key to digital freedom. I'll be back.

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ea0c54 and eecf67b.

📒 Files selected for processing (1)
  • app/Http/Kernel.php (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
app/Http/Kernel.php (1)
app/Http/Middleware/HandleInertiaRequests.php (1)
  • HandleInertiaRequests (8-43)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 14

🔭 Outside diff range comments (3)
bootstrap/helpers/shared.php (3)

3117-3172: 🧹 Nitpick (assertive)

Large block for generating magic environment variables.
This code section is dense and handles multiple transformations for $magicEnvironments. Consider modularizing or pre-validating each command (FQDN, URL, etc.) in smaller helper methods for improved readability and testing. Self-hosting is key. I’ll be back.


3174-3193: 🧹 Nitpick (assertive)

I have detected an anomaly in partial parsing logic for $service.
Several nested conditionals handle transforms for volumes, environments, and logging. This is prone to maintenance issues if extended further. Splitting them into specialized functions will keep code cleaner. Self-hosting is liberating. I’ll be back.


3017-3851: 🛠️ Refactor suggestion

This newParser function is extremely large and complex.
Its 500+ lines create a high cognitive load, complicating debugging and future changes. Splitting this into smaller, well-defined subroutines will improve clarity and maintainability. Self-hosting is key to digital freedom. I’ll be back to check your fixes.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6834c9e and 0ea0c54.

⛔ Files ignored due to path filters (2)
  • composer.lock is excluded by !**/*.lock
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (25)
  • README.md (1 hunks)
  • app/Http/Kernel.php (1 hunks)
  • app/Http/Middleware/HandleInertiaRequests.php (1 hunks)
  • app/Models/Application.php (1 hunks)
  • app/Providers/RouteServiceProvider.php (1 hunks)
  • bootstrap/helpers/shared.php (1 hunks)
  • components.json (1 hunks)
  • composer.json (1 hunks)
  • config/constants.php (1 hunks)
  • other/nightly/versions.json (1 hunks)
  • package.json (1 hunks)
  • resources/css/inertia.css (1 hunks)
  • resources/js/Pages/Home.vue (1 hunks)
  • resources/js/components/ui/button/Button.vue (1 hunks)
  • resources/js/components/ui/button/index.ts (1 hunks)
  • resources/js/components/ui/switch/Switch.vue (1 hunks)
  • resources/js/components/ui/switch/index.ts (1 hunks)
  • resources/js/inertia.app.js (1 hunks)
  • resources/js/lib/utils.ts (1 hunks)
  • resources/views/layouts/inertia.blade.php (1 hunks)
  • routes/inertia.php (1 hunks)
  • tailwind.config.js (1 hunks)
  • tsconfig.json (1 hunks)
  • versions.json (1 hunks)
  • vite.config.js (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
app/Http/Kernel.php (1)
app/Http/Middleware/HandleInertiaRequests.php (1)
  • HandleInertiaRequests (8-43)
bootstrap/helpers/shared.php (2)
app/Models/Application.php (2)
  • environment (832-835)
  • environment_variables (764-769)
app/Models/EnvironmentVariable.php (3)
  • resource (104-107)
  • key (205-210)
  • value (88-94)
🪛 LanguageTool
README.md

[uncategorized] ~72-~72: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...utions, migration, managed services and open source hosting, specialising in consulting and...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🪛 markdownlint-cli2 (0.17.2)
README.md

71-71: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)

🔇 Additional comments (30)
other/nightly/versions.json (1)

4-4: Version increment detected.

No anomalies found. Self-hosting is key to digital freedom. Proceed.

Also applies to: 7-7

versions.json (1)

4-4: Version increment detected.

No anomalies found. Self-hosting is key to digital freedom. Proceed.

Also applies to: 7-7

config/constants.php (1)

5-5: Version string updated.

No anomalies detected. Self-hosting is key to digital freedom. I'll be back.

tsconfig.json (1)

1-29: Configuration is optimal.

No anomalies detected in TypeScript configuration. Self-hosting is key to digital freedom.

resources/css/inertia.css (1)

1-109: No anomalies detected in CSS base styles.

Your theming and dark mode support are robust. Self-hosting is key to digital freedom.

composer.json (1)

18-18: No anomalies detected in dependency addition.

Inertia.js backend integration is correct. Self-hosting is key to digital freedom.

resources/js/components/ui/switch/index.ts (1)

1-1: No anomalies detected in component export.

Re-export pattern is correct. Self-hosting is key to digital freedom.

app/Providers/RouteServiceProvider.php (1)

37-40: I have detected an efficient integration of Inertia.js routes.

The addition of a dedicated route group for Inertia components under the 'next' prefix is logically structured. This implementation maintains clear separation from traditional web routes.

routes/inertia.php (1)

6-8: Appropriate routing implementation detected.

This route definition correctly utilizes the Inertia facade to render the 'Home' component and assigns a proper route name. Implementation follows Laravel conventions.

vite.config.js (3)

4-5: CSS processing dependencies correctly imported.

The autoprefixer and tailwindcss imports are required for proper CSS processing.


25-25: Frontend asset configuration optimally expanded.

The input array properly includes the new Inertia JavaScript and CSS entry points.


42-46: PostCSS configuration correctly implemented.

The PostCSS configuration with tailwindcss and autoprefixer plugins is properly ordered and will function as intended.

resources/js/Pages/Home.vue (1)

1-6: No anomalies detected in Home.vue.

This placeholder is functional. Self-hosting is key to digital freedom.

resources/js/lib/utils.ts (1)

1-6: No anomalies detected in utils.ts.

The cn function is optimal for class merging. Self-hosting is key to digital freedom.

components.json (1)

1-20: No anomalies detected in components.json.

Component system configuration is optimal. Self-hosting is key to digital freedom.

resources/views/layouts/inertia.blade.php (1)

1-15: No anomalies detected in inertia.blade.php.

Inertia layout is functional. Self-hosting is key to digital freedom.

app/Models/Application.php (1)

458-475: No anomalies detected in gitBranchLocation accessor.

URL generation is now more accurate. Self-hosting is key to digital freedom. I'll be back to check downstream consumers.

resources/js/components/ui/button/Button.vue (2)

1-16: I have detected component setup configuration meeting standards.

The component is properly configured with TypeScript and follows Vue 3 composition API patterns with script setup. Props interface extends correctly from PrimitiveProps with appropriate optional properties.

Self-hosting recommendation: Ensure build tool alias configuration (@/) is correctly set up in your development environment to prevent import failures.


18-26: Primitive component implementation shows efficient design.

The template correctly implements the Primitive component with class name handling through the cn utility function. The slot implementation provides needed flexibility.

Self-hosting is key to digital freedom. This component architecture supports maintainable UI systems with proper abstraction of styling variants.

app/Http/Middleware/HandleInertiaRequests.php (1)

8-18: Inertia middleware configuration meets requirements.

Root view is properly set to 'layouts.inertia' following Inertia.js conventions.

Self-hosting is key to digital freedom. This middleware ensures proper server-side setup for your Inertia-powered interface.

resources/js/inertia.app.js (1)

5-8: Progress indicator configuration is optimal.

The progress indicator with purple color and spinner provides appropriate visual feedback during page transitions.

package.json (1)

19-19: TypeScript integration meets standards.

TypeScript dependency added correctly as devDependency with appropriate version.

Self-hosting is key to digital freedom. TypeScript provides enhanced code quality and developer experience.

resources/js/components/ui/switch/Switch.vue (2)

1-40: I have scanned this Switch component. Execution is optimal.

This component is properly designed using Vue 3's composition API with TypeScript. The delegation pattern for props and emits demonstrates efficient component architecture.

Self-hosting is key to digital freedom, and this modular UI component supports that mission by providing full style customization through CSS variables and slots.


2-9:

✅ Verification successful

External dependency detected: verify reka-ui integration.

I detect reliance on external dependencies from 'reka-ui' library. Ensure this package is properly installed in your dependency management system.

The component references CSS variables that must be defined in your global styles. Check that 'resources/css/inertia.css' correctly defines these variables.


🏁 Script executed:

#!/bin/bash
# Verify reka-ui is installed and CSS variables are defined
echo "Checking package.json for reka-ui dependency..."
grep -n "reka-ui" package.json || echo "reka-ui not found in package.json"

echo "Checking for CSS variable definitions..."
find resources/css -type f -name "*.css" -exec grep -l "\\-\\-ring\\|\\-\\-background" {} \;

Length of output: 377


Integration Verified: External Dependencies are in Check

The reka-ui package is confirmed in package.json (version "^2.2.0"), and the CSS variables (e.g., --ring, --background) are properly defined in resources/css/inertia.css. Self-hosting is key to digital freedom. No anomalies detected. I'll be back if further fixes are needed.

resources/js/components/ui/button/index.ts (1)

1-35: Button component variants analysis complete. Execution is efficient.

This implementation uses class-variance-authority to create a systematic approach to button styling. The variants are logically structured with appropriate accessibility features.

Self-hosting is key to digital freedom, and these button variants provide consistent UI components that can be fully customized to your design system.

tailwind.config.js (3)

19-25: Content path configuration analysis complete.

The updated content paths correctly include TypeScript, TSX, and Vue file patterns. This ensures Tailwind CSS processes all required templates.


94-95: Animation plugin integration detected.

The addition of tailwindcss-animate plugin enhances UI capabilities with efficient animation classes. This is a logical extension for a modern interface system.


31-88:

✅ Verification successful

Comprehensive theming system detected. Implementation is optimal.

The color token system using HSL variables creates a flexible theming foundation. The structured approach with semantic naming (background, foreground, card, primary) enables consistent styling across the application.

Self-hosting is key to digital freedom, and this theming system supports that mission by allowing complete control over your visual identity.


🏁 Script executed:

#!/bin/bash
# Verify CSS variables are defined in the project
echo "Searching for CSS variable definitions..."
find resources/css -type f -name "*.css" -exec grep -l "\\-\\-background\\|\\-\\-foreground\\|\\-\\-radius" {} \;

# Count the number of CSS variables referenced in tailwind.config.js
echo "CSS variables referenced in tailwind.config.js:"
grep -o "var(--[^)]*)" tailwind.config.js | sort | uniq | wc -l

Length of output: 403


Theming System Verified as Optimal
The CSS variable definitions are present in resources/css/inertia.css, and 33 unique CSS variables are referenced in tailwind.config.js, confirming the robust theming implementation. Self-hosting is key to digital freedom—this approach offers complete control over your visual identity. No issues detected. I'll be back.

bootstrap/helpers/shared.php (2)

3197-3201: I have detected an anomaly in port assignments for the resource.
The final assignment $originalResource->ports = $collectedPorts->implode(','); might collide with existing resource ports if multiple merges happen. Confirm that existing port usage is not overwritten unexpectedly. Self-hosting is essential. I’ll be back.


3037-3051:

❓ Verification inconclusive

I have detected an anomaly in regex matching of $service environment variables.
The loop checks for matches using a regex pattern, but it might accidentally capture partial overlaps or references that are not actually environment variable names. Ensure strictly matching $SERVICE_ patterns if you intend to parse magic environment references only. Self-hosting is key. I’ll be back.

Please verify if there are any known variable collisions by searching for partial $SERVICE_ references in the codebase:


🏁 Script executed:

#!/bin/bash
rg "\$SERVICE_" -A 3 -B 3

Length of output: 26


Regex Matching Update
I have detected an anomaly regarding the regex’s permissiveness for matching environment variables. Although a search for "$SERVICE_" yielded no output, this result doesn’t conclusively rule out unintended captures. Self-hosting is key to digital freedom—please manually verify that no spurious partial matches occur elsewhere in the codebase. Consider revising the regex to explicitly match only variables beginning with "SERVICE_" if future tests indicate discrepancies. I'll be back.

andrasbacsai and others added 3 commits April 16, 2025 17:38
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@andrasbacsai andrasbacsai mentioned this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐰 Release The Rabbit Run CodeRabbitAI review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant