Skip to content

fix(build): add root package.json so bench builds the SPA - #2

Merged
NagariaHussain merged 2 commits into
mainfrom
fix/spa-assets-not-built
Aug 11, 2026
Merged

fix(build): add root package.json so bench builds the SPA#2
NagariaHussain merged 2 commits into
mainfrom
fix/spa-assets-not-built

Conversation

@Rl0007

@Rl0007 Rl0007 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Problem

On a fresh bench get-app + bench build --app wikify, no frontend assets were produced. The build reported success in ~300ms and emitted nothing — no bundle, and no wikify/www/wikify.html, so /wikify returned Page not found.

Cause: frappe's esbuild runner looks for apps/<app>/package.json and silently continues when it's missing — frappe/esbuild/esbuild.js:611-620:

let package_json = path.resolve(root_app_path, "package.json");
if (!fs.existsSync(package_json)) {
    continue;          // <- wikify fell through here
}
let { scripts } = require(package_json);
if (!scripts?.build) {
    continue;
}

frontend/package.json exists, but the root one never did — so the app was never a build candidate.

Fix

  • Add the root package.json with the standard Frappe SPA scripts, matching frappe/crm.
  • postinstall cascades into frontend/, which also keeps frontend deps in sync. Worth calling out: without it, a stale frontend/node_modules silently builds against the wrong frappe-ui — on this branch that surfaced as 12 MISSING_EXPORT errors (BottomSheet, etc.) because beta.18 was installed while frontend/package.json had moved to beta.24 in 16f5f55.
  • Ignore wikify/public/node_modules. bench build symlinks it, and git sees a symlink rather than a directory, so the existing node_modules/ rule never matched it and it showed up as untracked.

yarn.lock is the trivial autogenerated root lockfile (2 comment lines), same as crm's.

Verification

Reproduced and fixed against wikify.localhost, each run from a cleared wikify/public/frontend + wikify/www/wikify.html:

state bench build --app wikify assets www/wikify.html
without root package.json Total Build Time: 315ms — no build command run 0 missing
with root package.json ✔ wikify built in 14.9s 81 emitted

/wikify renders correctly after the fix (Projects list, sidebar, styling all intact). pre-commit passes on the changed files.

`bench build --app wikify` silently skipped the frontend: frappe's
esbuild runner looks for `apps/<app>/package.json` and `continue`s when
it is absent (frappe/esbuild/esbuild.js:611-620), so no bundle and no
`www/wikify.html` were ever emitted on a fresh `bench get-app`.

Add the root package.json with the standard Frappe SPA scripts, matching
frappe/crm. `postinstall` also keeps frontend deps in sync — without it
a stale `frontend/node_modules` silently builds against the wrong
frappe-ui.

Also ignore `wikify/public/node_modules`: `bench build` symlinks it, and
git sees a symlink rather than a directory, so the existing
`node_modules/` rule never matched it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

Adds the root package metadata needed for Frappe Bench to discover and build the SPA, while declaring Wiki as a required app.

  • Cascades root dependency installation and build commands into frontend/.
  • Installs the Wiki dependency in CI before Wikify.
  • Ignores Bench-generated dependency symlinks and reformats existing source files.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
package.json Adds the root package metadata and scripts that make Wikify eligible for Frappe's application build.
wikify/hooks.py Declares the Wiki application as a required dependency.
.github/workflows/ci.yml Fetches and installs Wiki before installing Wikify and building assets.
.gitignore Excludes the dependency symlink generated under the application's public directory.
.pre-commit-config.yaml Expands the global hook exclusions to omit POC and scratch trees.
yarn.lock Adds the root Yarn v1 lockfile associated with the dependency-free root package.

Reviews (2): Last reviewed commit: "ci: install wiki app and take pocs/scrat..." | Re-trigger Greptile

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Rl0007

Rl0007 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@NagariaHussain shall I merge it?

@NagariaHussain
NagariaHussain merged commit 5d1276e into main Aug 11, 2026
4 checks passed
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