V2 - Fix non-default frontend:dir in builds#5035
V2 - Fix non-default frontend:dir in builds#5035Nifty255 wants to merge 8 commits intowailsapp:masterfrom
Conversation
📝 WalkthroughWalkthroughPatch release v2.11.1: ensures frontend built assets are copied into the expected embed location when Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer/CLI
participant BuildCmd as Build Command
participant FrontendBuilder as Frontend Builder
participant FS as Filesystem utils
participant Embed as Embed Target (frontend/dist)
Dev->>BuildCmd: run `wails build`
BuildCmd->>FrontendBuilder: builder.BuildFrontend()
FrontendBuilder-->>BuildCmd: frontend build artifacts
BuildCmd->>BuildCmd: call AssertFrontendDist(cwd, opts)
alt frontend dir != default
BuildCmd->>FS: Copy frontend/dist (from configured dir) to Embed
FS-->>BuildCmd: copy success/failure
end
BuildCmd->>BuildCmd: continue app build
BuildCmd->>BuildCmd: call CleanFrontendDist(cwd, opts)
CleanFrontendDist->>FS: remove non-embed artifacts (keep gitkeep)
FS-->>CleanFrontendDist: cleanup result
BuildCmd-->>Dev: final artifact
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.16.1)v2/pkg/commands/build/build.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
website/i18n/pt/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx (1)
21-21: Consider clarifying the automatic copy behavior.The current phrasing "be sure to change your embed directive or target 'frontend/dist'" suggests manual user action. However, according to the PR objectives, v2.11.1 now automatically copies built frontend files to frontend/dist when the configured frontend:dir doesn't match embed directives. The documentation could be clearer about this automatic behavior.
📝 Suggested documentation improvement
Consider revising to something like:
- // Relative path to the frontend directory. Defaults to 'frontend'. If not default, be sure to change your embed directive or target 'frontend/dist' + // Relative path to the frontend directory. Defaults to 'frontend'. If not default, Wails will automatically copy built assets to 'frontend/dist' for embedding (requires 'frontend/dist' embed directive)This more accurately reflects that Wails handles the copying automatically rather than requiring manual user intervention.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/i18n/pt/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx` at line 21, Update the sentence that currently reads "Relative path to the frontend directory. Defaults to 'frontend'. If not default, be sure to change your embed directive or target 'frontend/dist'" to clearly state the automatic copy behavior introduced in v2.11.1: when the configured frontend:dir does not match the embed directive, Wails will automatically copy built frontend files to 'frontend/dist' so no manual change to the embed directive is required; reference the terms frontend:dir, embed directive, and 'frontend/dist' in the revised sentence and mention v2.11.1 to make the behavior and version explicit.website/src/pages/changelog.mdx (1)
35-35: Consider removing empty "Added" section.The "### Added" section is empty. Consider removing it to keep the changelog concise, or leave it if you anticipate adding features before release.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/src/pages/changelog.mdx` at line 35, Remove the empty "### Added" header from the changelog page to avoid an empty section; locate the "### Added" heading in website/src/pages/changelog.mdx and delete that line (or replace it with content if you intend to add items before release), ensuring the rest of the markdown remains properly formatted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@v2/pkg/commands/build/build.go`:
- Line 191: The pterm warning uses pterm.Warning.Printf which doesn't append a
newline; replace the call in the build logic that references
buildOptions.ProjectData.GetFrontendDir() (the pterm.Warning.Printf invocation)
with pterm.Warning.Printfln to ensure the message ends with a newline and
remains consistent with other pterm calls in this file.
- Around line 219-228: The code currently hardcodes "./frontend/dist" and
creates "gitkeep" without using the function's cwd parameter; update the
cleanup/create logic to use the provided cwd (e.g., join cwd with
"frontend/dist" via filepath.Join) instead of the literal string, replace
os.RemoveAll("./frontend/dist"), os.MkdirAll("./frontend/dist", ...) and
os.Create("./frontend/dist/gitkeep") with operations against that joined path,
and create a hidden ".gitkeep" file (prefixed with a dot) when calling
os.Create; keep error handling around os.MkdirAll and file creation as-is and
ensure you close the file after creation.
In
`@website/i18n/fr/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx`:
- Line 21: Replace the English comment "Relative path to the frontend directory.
Defaults to 'frontend'. If not default, be sure to change your embed directive
or target 'frontend/dist'" with a French translation to restore localization
consistency; for example use: "Chemin relatif vers le répertoire frontend. Par
défaut : « frontend ». Si vous utilisez un chemin différent, pensez à mettre à
jour votre directive d'intégration ou à cibler « frontend/dist »." Locate and
update the exact comment string in the file (the line containing the quoted
English sentence) so the doc is fully French.
In
`@website/i18n/ru/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx`:
- Line 21: The Russian locale file
website/i18n/ru/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx
currently contains English text (notably the "frontend:dir" comment) and should
be translated into Russian unless intentionally left in English; update the
entire document text and the inline comment string "frontend:dir" to fluent
Russian, keeping technical tokens (e.g., frontend, frontend/dist) unchanged, and
run the provided verification script to check other locale folders and ensure
parity with website/docs/reference/project-config.mdx before committing.
In `@website/src/pages/changelog.mdx`:
- Line 38: Locate the changelog entry containing the line starting with "Smarter
frontend build handling when \"frontend:dir\"..." and replace the literal
placeholder "**PR GOES HERE**" with the actual PR link
"[`#5035`](https://github.com/wailsapp/wails/pull/5035)". Ensure the final line
reads: Smarter frontend build handling when "frontend:dir" doesn't match an
embed directive (e.g. when the frontend is outside the project dir) by `@Nifty255`
in [`#5035`](https://github.com/wailsapp/wails/pull/5035).
---
Nitpick comments:
In
`@website/i18n/pt/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx`:
- Line 21: Update the sentence that currently reads "Relative path to the
frontend directory. Defaults to 'frontend'. If not default, be sure to change
your embed directive or target 'frontend/dist'" to clearly state the automatic
copy behavior introduced in v2.11.1: when the configured frontend:dir does not
match the embed directive, Wails will automatically copy built frontend files to
'frontend/dist' so no manual change to the embed directive is required;
reference the terms frontend:dir, embed directive, and 'frontend/dist' in the
revised sentence and mention v2.11.1 to make the behavior and version explicit.
In `@website/src/pages/changelog.mdx`:
- Line 35: Remove the empty "### Added" header from the changelog page to avoid
an empty section; locate the "### Added" heading in
website/src/pages/changelog.mdx and delete that line (or replace it with content
if you intend to add items before release), ensuring the rest of the markdown
remains properly formatted.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (57)
v2/cmd/wails/internal/version.txtv2/examples/panic-recovery-test/go.modv2/internal/fs/fs.gov2/pkg/commands/build/build.gowebsite/docs/reference/project-config.mdxwebsite/i18n/ar/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/de/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/en/docusaurus-plugin-content-docs/version-v2.11.1.jsonwebsite/i18n/fr/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/ja/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.3.1/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.4.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.3.1/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.4.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.3.1/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.4.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/tr/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/vi/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.3.1/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.4.0/reference/project-config.mdxwebsite/src/pages/changelog.mdxwebsite/versioned_docs/version-v2.10/reference/project-config.mdxwebsite/versioned_docs/version-v2.11.0/reference/project-config.mdx
| // The directory where the build files reside. Defaults to 'build' | ||
| "build:dir": "", | ||
| // Relative path to the frontend directory. Defaults to 'frontend' | ||
| // Relative path to the frontend directory. Defaults to 'frontend'. If not default, be sure to change your embed directive or target 'frontend/dist' |
There was a problem hiding this comment.
Localize the new guidance text to French.
Line 21 introduces an English sentence in the FR doc, which breaks localization consistency for end users. Please translate this comment to French.
✏️ Suggested wording
- // Relative path to the frontend directory. Defaults to 'frontend'. If not default, be sure to change your embed directive or target 'frontend/dist'
+ // Chemin relatif vers le répertoire frontend. Valeur par défaut : 'frontend'. Si vous utilisez un autre chemin, veillez à adapter votre directive embed ou à cibler 'frontend/dist'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Relative path to the frontend directory. Defaults to 'frontend'. If not default, be sure to change your embed directive or target 'frontend/dist' | |
| // Chemin relatif vers le répertoire frontend. Valeur par défaut : 'frontend'. Si vous utilisez un autre chemin, veillez à adapter votre directive embed ou à cibler 'frontend/dist' |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@website/i18n/fr/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx`
at line 21, Replace the English comment "Relative path to the frontend
directory. Defaults to 'frontend'. If not default, be sure to change your embed
directive or target 'frontend/dist'" with a French translation to restore
localization consistency; for example use: "Chemin relatif vers le répertoire
frontend. Par défaut : « frontend ». Si vous utilisez un chemin différent,
pensez à mettre à jour votre directive d'intégration ou à cibler « frontend/dist
»." Locate and update the exact comment string in the file (the line containing
the quoted English sentence) so the doc is fully French.
| // The directory where the build files reside. Defaults to 'build' | ||
| "build:dir": "", | ||
| // Relative path to the frontend directory. Defaults to 'frontend' | ||
| // Relative path to the frontend directory. Defaults to 'frontend'. If not default, be sure to change your embed directive or target 'frontend/dist' |
There was a problem hiding this comment.
Documentation appears untranslated in Russian locale folder.
The entire file, including this updated comment, is in English despite being located in the Russian locale directory (i18n/ru/). Russian-speaking users would expect this documentation to be in Russian.
Run the following script to check if similar documentation updates exist in other locale folders and identify translation status:
#!/bin/bash
# Description: Check if similar frontend:dir documentation changes exist in other locales
# and verify translation status across locale folders
echo "=== Checking frontend:dir comment in English docs ==="
rg -n "frontend:dir.*embed directive" website/docs/ -A1 -B1
echo -e "\n=== Checking frontend:dir comment in other locale folders ==="
rg -n "frontend:dir" website/i18n/*/docusaurus-plugin-content-docs/*/reference/project-config.mdx -A1 -B1
echo -e "\n=== Checking which locale folders exist ==="
fd -t d -d 1 . website/i18n/
echo -e "\n=== Comparing English vs Russian file content similarity ==="
if [ -f "website/docs/reference/project-config.mdx" ]; then
echo "English version exists"
head -5 website/docs/reference/project-config.mdx
else
echo "English reference not found at expected path"
fiIs the English content in the Russian locale folder intentional, or should this documentation be translated to Russian?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@website/i18n/ru/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx`
at line 21, The Russian locale file
website/i18n/ru/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx
currently contains English text (notably the "frontend:dir" comment) and should
be translated into Russian unless intentionally left in English; update the
entire document text and the inline comment string "frontend:dir" to fluent
Russian, keeping technical tokens (e.g., frontend, frontend/dist) unchanged, and
run the provided verification script to check other locale folders and ensure
parity with website/docs/reference/project-config.mdx before committing.
There was a problem hiding this comment.
🧹 Nitpick comments (5)
website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx (1)
21-22: Minor version note: Feature is introduced in v2.11.1.This v2.11.0 documentation describes the copy-to-frontend/dist behavior that's being introduced in v2.11.1. The impact is minimal given the close version proximity, but for accuracy, consider whether v2.11.0 docs should describe this behavior.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx` around lines 21 - 22, The documentation for the "frontend:dir" setting currently lives under version-v2.11.0 but the behavior described was introduced in v2.11.1; update the doc so the behavior is documented under the correct version or add a clear note stating "Feature introduced in v2.11.1" next to the "frontend:dir" description (and adjust any version frontmatter or filename from version-v2.11.0 to version-v2.11.1 if appropriate) to ensure the change is accurately attributed to v2.11.1.website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx (1)
21-22: Documentation version mismatch with English versioned docs.This v2.10 zh-Hans doc describes the new copy-to-frontend/dist behavior, but the English
website/versioned_docs/version-v2.10uses simpler text: "Ensure your embed directive matches this. Frontends outside the project directory are unsupported."Consider aligning with the English versioned docs to maintain consistency and accuracy for v2.10 users.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx` around lines 21 - 22, The zh-Hans v2.10 doc text for the "frontend:dir" setting differs from the English v2.10 version; update the content around the "frontend:dir" entry so it matches the English versioned docs' wording (e.g., replace the long explanation about copying to 'frontend/dist' with the simpler sentence like "Ensure your embed directive matches this. Frontends outside the project directory are unsupported.") so both versions are consistent for version-v2.10.website/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx (1)
21-22: Same documentation version mismatch as other i18n versioned docs.Consider aligning with the English
website/versioned_docs/version-v2.10text which uses simpler wording appropriate for v2.10.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx` around lines 21 - 22, The Russian versioned doc uses wording that diverges from the English v2.10 copy; update the text in website/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx to match the simpler English phrasing used in website/versioned_docs/version-v2.10 (i.e., rephrase the sentence describing "frontend:dir" to the same concise wording as the English version), keeping the configuration key "frontend:dir" and its explanation semantically identical to the English v2.10 doc so the versioned translations remain consistent.website/i18n/ru/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx (1)
21-22: Documentation version mismatch: v2.7.0 docs describe v2.11.1 behavior.Same issue as other i18n versioned docs. Consider using simpler text appropriate for v2.7.0 or removing this change from older version docs.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@website/i18n/ru/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx` around lines 21 - 22, The versioned doc version-v2.7.0's description for the "frontend:dir" setting in project-config.mdx contains v2.11.1-specific behavior; update the "frontend:dir" description to match v2.7.0 semantics (remove references to embed directive behavior introduced later) or revert this change from the v2.7.0 file so it matches the original simple text used in that release; make the edit to the "frontend:dir" entry so the wording reflects v2.7.0 (concise default = "frontend" and no v2.11.1-specific copy/embed guidance).v2/pkg/commands/build/build.go (1)
219-219: Consider handlingos.RemoveAllerror.The error from
os.RemoveAllis silently ignored. WhileRemoveAllreturns nil when the path doesn't exist, it can fail due to permission issues. However, if removal fails due to permissions, the subsequentMkdirAllwould likely also fail and that error is handled. This is a minor concern since the error path converges.Optional: Log or check the error
- os.RemoveAll(filepath.Join(cwd, "frontend/dist")) + if err := os.RemoveAll(filepath.Join(cwd, "frontend/dist")); err != nil { + // Log but continue - MkdirAll will fail if there's a real permission issue + pterm.Warning.Printfln("Could not remove frontend/dist: %v", err) + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@v2/pkg/commands/build/build.go` at line 219, The call to os.RemoveAll(filepath.Join(cwd, "frontend/dist")) ignores its returned error; capture the error (e.g., err := os.RemoveAll(...)) and handle it—either log it with context (including cwd and path) using the existing logger or return/wrap the error from the surrounding function so failures (like permission issues) are visible; update the spot where os.RemoveAll is invoked in build.go to check the error and act accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@v2/pkg/commands/build/build.go`:
- Line 219: The call to os.RemoveAll(filepath.Join(cwd, "frontend/dist"))
ignores its returned error; capture the error (e.g., err := os.RemoveAll(...))
and handle it—either log it with context (including cwd and path) using the
existing logger or return/wrap the error from the surrounding function so
failures (like permission issues) are visible; update the spot where
os.RemoveAll is invoked in build.go to check the error and act accordingly.
In
`@website/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx`:
- Around line 21-22: The Russian versioned doc uses wording that diverges from
the English v2.10 copy; update the text in
website/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx
to match the simpler English phrasing used in
website/versioned_docs/version-v2.10 (i.e., rephrase the sentence describing
"frontend:dir" to the same concise wording as the English version), keeping the
configuration key "frontend:dir" and its explanation semantically identical to
the English v2.10 doc so the versioned translations remain consistent.
In
`@website/i18n/ru/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx`:
- Around line 21-22: The versioned doc version-v2.7.0's description for the
"frontend:dir" setting in project-config.mdx contains v2.11.1-specific behavior;
update the "frontend:dir" description to match v2.7.0 semantics (remove
references to embed directive behavior introduced later) or revert this change
from the v2.7.0 file so it matches the original simple text used in that
release; make the edit to the "frontend:dir" entry so the wording reflects
v2.7.0 (concise default = "frontend" and no v2.11.1-specific copy/embed
guidance).
In
`@website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx`:
- Around line 21-22: The zh-Hans v2.10 doc text for the "frontend:dir" setting
differs from the English v2.10 version; update the content around the
"frontend:dir" entry so it matches the English versioned docs' wording (e.g.,
replace the long explanation about copying to 'frontend/dist' with the simpler
sentence like "Ensure your embed directive matches this. Frontends outside the
project directory are unsupported.") so both versions are consistent for
version-v2.10.
In
`@website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx`:
- Around line 21-22: The documentation for the "frontend:dir" setting currently
lives under version-v2.11.0 but the behavior described was introduced in
v2.11.1; update the doc so the behavior is documented under the correct version
or add a clear note stating "Feature introduced in v2.11.1" next to the
"frontend:dir" description (and adjust any version frontmatter or filename from
version-v2.11.0 to version-v2.11.1 if appropriate) to ensure the change is
accurately attributed to v2.11.1.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (45)
v2/pkg/commands/build/build.gowebsite/docs/reference/project-config.mdxwebsite/i18n/ar/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/de/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/fr/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/ja/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/ko/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/pt/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdxwebsite/i18n/ru/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdxwebsite/i18n/tr/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/vi/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdxwebsite/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdxwebsite/src/pages/changelog.mdxwebsite/versioned_docs/version-v2.10/reference/project-config.mdxwebsite/versioned_docs/version-v2.11.0/reference/project-config.mdx
✅ Files skipped from review due to trivial changes (6)
- website/i18n/de/docusaurus-plugin-content-docs/current/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdx
- website/i18n/fr/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx
🚧 Files skipped from review as they are similar to previous changes (25)
- website/versioned_docs/version-v2.11.0/reference/project-config.mdx
- website/i18n/fr/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdx
- website/i18n/fr/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.10/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/current/reference/project-config.mdx
- website/i18n/ja/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx
- website/i18n/fr/docusaurus-plugin-content-docs/current/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.5.0/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdx
- website/i18n/fr/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx
- website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdx
- website/i18n/ru/docusaurus-plugin-content-docs/version-v2.9.0/reference/project-config.mdx
- website/i18n/tr/docusaurus-plugin-content-docs/current/reference/project-config.mdx
- website/i18n/ru/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdx
- website/i18n/ru/docusaurus-plugin-content-docs/version-v2.11.0/reference/project-config.mdx
- website/i18n/ko/docusaurus-plugin-content-docs/version-v2.7.0/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.8.0/reference/project-config.mdx
- website/i18n/ru/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdx
- website/i18n/pt/docusaurus-plugin-content-docs/version-v2.8.1/reference/project-config.mdx
- website/i18n/ru/docusaurus-plugin-content-docs/version-v2.6.0/reference/project-config.mdx
Description
Introduce smarter handling of built frontend files when building an application. Previously, configuring
frontend:dirto a folder other than one that was targeted by ago:embeddirective would allow the application to be built but cause it to fail to launch due to a lack of embedded frontend assets. While simply retargeting the embed directive is the intended option, the build should be throwing at least a warning for this situation, and this workaround only works if the configuredfrontend:diris inside the project's directory. Go's embed directives do not allow paths that start with.,.., or/, so projects with frontends that exist outside the project directory must copy the frontend's built files into the project. This change accomplishes that.On build:
frontend/dist.frontend/dist.frontend/distwas not found, the builder prints an error and halts.frontend/distafterward.Changes were made to
v2/internal/fs/fs.goto support copying to a preexisting directory. No tests were modified and all tests pass.Fixes #5034
Type of change
Please select the option that is relevant.
How Has This Been Tested?
Some changes reside in
v2/internal/fs.go testwas used:To test the build process which has no unit tests, I ran these steps.
wails init -n TestAppwails devand the resulting executable fromwails buildshould both work.frontendtojsfrontend.//go:embed all:jsfrontend/distwails devand the resulting executable fromwails buildboth work.//go:embed all:frontend/distwails devand the resulting executable fromwails buildshould both work. The build process should show a warning:Frontend directory "D:\...\jsfrontend" is not embedded by your application. Is this intentional? Attempting to copy built frontend assets to "frontend/dist"jsfrontendback tofrontendand move it outside the project directory.frontend:dirin config to"../jsfrontend"wails devand the resulting executable fromwails buildshould both work. The build process should show a warning:Frontend directory "D:\...\frontend" is not embedded by your application. Is this intentional? Attempting to copy built frontend assets to "frontend/dist"//go:embed all:myui/distwails devshould work whilewails buildshould fail with an error:Configured custom frontend directory is not embedded and could not copy the build to the default dist. Custom frontend directories inside the project directory should match an embed directive in your app, and frontend directories outside should use the default embed directive targeting "frontend/dist".Windows
macOS
Linux
Test Configuration
Checklist:
website/src/pages/changelog.mdxwith details of this PRSummary by CodeRabbit
Bug Fixes
Documentation
Chores