Skip to content
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

defualt to embed all:frontend/dist #3887

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

atterpac
Copy link
Member

@atterpac atterpac commented Nov 16, 2024

Changes the template to use all:frontend/dist instead of frontend/dist added sveltekit templates were not compatible due to the lack of /dist/<subfolder>

# System
┌──────────────────────────────────────────────────────────────────────────────────────────┐
| Name         | Ubuntu                                                                    |
| Version      | 24.04                                                                     |
| ID           | ubuntu                                                                    |
| Branding     | 24.04 LTS (Noble Numbat)                                                  |
| Platform     | linux                                                                     |
| Architecture | amd64                                                                     |
| CPU          | 12th Gen Intel(R) Core(TM) i5-1235U                                       |
| GPU 1        | Alder Lake-UP3 GT2 [Iris Xe Graphics] (Intel Corporation) - Driver: i915  |
| Memory       | 7GB                                                                       |
└──────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment
┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.7                           |
| Go Version   | go1.22.4                                 |
| Revision     | 99d538ea971eb23efa3f65448ff3c5398d220902 |
| Modified     | true                                     |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOAMD64      | v1                                       |
| GOARCH       | amd64                                    |
| GOOS         | linux                                    |
| vcs          | git                                      |
| vcs.modified | true                                     |
| vcs.revision | 99d538ea971eb23efa3f65448ff3c5398d220902 |
| vcs.time     | 2024-11-16T01:30:33Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────┐
| webkit2gtk | 2.46.1-0ubuntu0.24.04.1 |
| gcc        | 12.10ubuntu1            |
| gtk3       | 3.24.41-4ubuntu1.2      |
| npm        | 10.5.1                  |
| pkg-config | 1.8.1-2build1           |
└────── * - Optional Dependency ───────┘

Summary by CodeRabbit

  • New Features

    • Introduced new commands: wails3 update build-assets and wails3 generate runtime.
    • Added InitialPosition option for window positioning.
    • New methods for file path management in the application package.
    • Enhanced Windows options for autofill and password autosave.
  • Bug Fixes

    • Resolved issues with the AlwaysOnTop feature on macOS and compilation errors on Linux.
  • Documentation

    • Updated changelog to reflect new features, changes, and fixes, improving user experience across platforms.

Copy link
Contributor

coderabbitai bot commented Nov 16, 2024

Walkthrough

The pull request updates the changelog to document new features, changes, and bug fixes in the project. Key additions include new commands for asset management, enhancements to the application package, and improved support for Windows options. The embedding directive for frontend assets has been modified to include all files in the specified directory. Several bugs have been addressed, particularly for macOS and Linux. Overall, the changes reflect a significant enhancement in functionality and user experience across various platforms.

Changes

File Path Change Summary
mkdocs-website/docs/en/changelog.md Updated changelog to include new features, changes, and bug fixes; added documentation for events, new SvelteKit templates, and commands.
v3/internal/templates/_common/main.go.tmpl Updated embed directive from //go:embed frontend/dist to //go:embed all:frontend/dist to include all files in the directory.

Possibly related PRs

Suggested reviewers

  • leaanthony

🐇 In the changelog, new features hop,
With commands and options, we just can't stop!
Assets now bundled, all files in a row,
Fixes for bugs make our project glow.
Documentation shines, with templates galore,
Hooray for the changes, let’s celebrate more! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 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.

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.

@atterpac atterpac force-pushed the v3/fix-sveltkit-templates branch from 4e73761 to 07c2da3 Compare November 16, 2024 23:46
@atterpac atterpac marked this pull request as ready for review November 16, 2024 23:51
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: 1

🧹 Outside diff range and nitpick comments (2)
v3/internal/templates/_common/main.go.tmpl (1)

Line range hint 11-14: Update comments to reflect subdirectory embedding.

The existing comments should be updated to mention that files in subdirectories under frontend/dist will also be embedded.

 // Wails uses Go's `embed` package to embed the frontend files into the binary.
-// Any files in the frontend/dist folder will be embedded into the binary and
+// Any files in the frontend/dist folder and its subdirectories will be embedded into the binary and
 // made available to the frontend.
 // See https://pkg.go.dev/embed for more information.
mkdocs-website/docs/en/changelog.md (1)

Line range hint 93-94: Remove duplicate changelog entries.

The following entries appear twice in the changelog:

Please remove the duplicate entries to maintain clarity.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 99d538e and 07c2da3.

📒 Files selected for processing (2)
  • mkdocs-website/docs/en/changelog.md (1 hunks)
  • v3/internal/templates/_common/main.go.tmpl (1 hunks)
🔇 Additional comments (1)
mkdocs-website/docs/en/changelog.md (1)

32-32: LGTM! The changelog entry accurately reflects the changes.

The entry clearly documents:

  • The modification to asset embedding
  • The reason for the change (support for frameworks generating subfolders)
  • Proper attribution and PR reference

This aligns well with the PR objectives of ensuring compatibility with SvelteKit templates.

@@ -14,7 +14,7 @@ import (
// made available to the frontend.
// See https://pkg.go.dev/embed for more information.

//go:embed frontend/dist
//go:embed all:frontend/dist
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

The embed directive change requires updates to example files for consistency

The verification revealed that there are two example files still using the old frontend/dist embed directive:

  • v3/examples/file-association/main.go
  • v3/examples/dev/main.go

These should be updated to use all:frontend/dist for consistency with the template change and to properly support frameworks that generate subfolders.

Note: The v2 test file already uses the all: prefix, which further validates this approach.

🔗 Analysis chain

LGTM! The embed directive change correctly addresses SvelteKit compatibility.

The addition of the all: prefix to include subdirectories is the right approach to support frameworks like SvelteKit that generate assets in subdirectories.

Let's verify the impact on binary size and existing templates:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other templates that might be affected by this change
# and analyze typical dist directory structures

# Look for other template files that might need similar updates
echo "Checking for other template files with embed directives:"
rg -l "go:embed.*frontend/dist" --type go

# Look for potential documentation that needs updating
echo "Checking for documentation that might need updates:"
fd -e md -e txt | xargs rg -l "frontend/dist"

Length of output: 856


Script:

#!/bin/bash
# Let's examine the embed directives in the found files to understand their usage
echo "Checking embed directive in file-association example:"
rg -A 5 -B 2 "go:embed.*frontend/dist" v3/examples/file-association/main.go

echo -e "\nChecking embed directive in dev example:"
rg -A 5 -B 2 "go:embed.*frontend/dist" v3/examples/dev/main.go

echo -e "\nChecking embed directive in v2 test:"
rg -A 5 -B 2 "go:embed.*frontend/dist" v2/internal/staticanalysis/test/standard/main.go

# Let's also check if there are any other similar embed patterns we should consider
echo -e "\nChecking for other embed patterns with frontend:"
rg "go:embed.*frontend" --type go

# Let's examine the documentation mentions to understand the context
echo -e "\nChecking frontend/dist mentions in runtime docs:"
rg -A 2 -B 2 "frontend/dist" mkdocs-website/docs/en/learn/runtime.md

echo -e "\nChecking frontend/dist mentions in changelog:"
rg -A 2 -B 2 "frontend/dist" mkdocs-website/docs/en/changelog.md

Length of output: 2553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants