Skip to content

Add DEV_APP_DATA_PATH env var for isolated appdata JSON#2713

Merged
wojtekn merged 3 commits intotrunkfrom
add-dev-app-data-path-env-var
Mar 10, 2026
Merged

Add DEV_APP_DATA_PATH env var for isolated appdata JSON#2713
wojtekn merged 3 commits intotrunkfrom
add-dev-app-data-path-env-var

Conversation

@wojtekn
Copy link
Contributor

@wojtekn wojtekn commented Mar 5, 2026

Related issues

  • N/A

How AI was used in this PR

AI assisted with implementation. I code reviewed and verified the solution.

Proposed Changes

I propose adding an easy way to quickly start the app for testing, to make screenshots, etc. without touching the appdata file that could include production sites.

  • Add DEV_APP_DATA_PATH env var that overrides the appdata JSON file path in both the main process (storage/paths.ts) and the CLI child process (cli/lib/appdata.ts)
  • Add start:test script to use DEV_APP_DATA_PATH instead of the E2E flags, so the app runs in normal (non-E2E) mode with only the appdata JSON redirected

Testing Instructions

  • Run npm run start:test — app starts with a clean appdata at /tmp/studio-test-appdata.json, server-files cache is preserved
  • Create a site
  • Run npm start — app starts with real appdata, unaffected

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Allows running the app with a clean appdata file without losing cached
server-files (PHP/WP downloads). Set DEV_APP_DATA_PATH to a JSON file
path to override only the appdata file location; all other paths
(server-files, certificates, thumbnails) continue using the real
appData directory.

Both the main process (storage/paths.ts) and the CLI child process
(cli/lib/appdata.ts) now respect this env var so they write/read from
the same file. The start:test script is updated to use this instead of
the E2E flags.
@wojtekn wojtekn self-assigned this Mar 5, 2026
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Mar 5, 2026

📊 Performance Test Results

Comparing 31e211e vs trunk

site-editor

Metric trunk 31e211e Diff Change
load 1690.00 ms 1478.00 ms -212.00 ms 🟢 -12.5%

site-startup

Metric trunk 31e211e Diff Change
siteCreation 6081.00 ms 6105.00 ms +24.00 ms ⚪ 0.0%
siteStartup 3943.00 ms 3948.00 ms +5.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@wojtekn wojtekn requested a review from a team March 5, 2026 16:51
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

I think this is a great idea!

The changes look good to me and work well - I am able to run the app without touching the original appdata JSON file and then switch back to using it again. 👍🏼

Two things:

  • the command won't run on Windows at its current form
  • maybe we could consider adding the mention to the project documentation

@wojtekn
Copy link
Contributor Author

wojtekn commented Mar 10, 2026

@ivan-ottinger thanks for the review.

the command won't run on Windows at its current form

As this command is purely for development and we don't use Windows as the main machine for development or for keeping our production sites, I think it's okay to keep this one a Mac-only helper.

maybe we could consider adding the mention to the project documentation

Makes sense, added.

@wojtekn wojtekn merged commit 267eeb1 into trunk Mar 10, 2026
10 checks passed
@wojtekn wojtekn deleted the add-dev-app-data-path-env-var branch March 10, 2026 12:03
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.

3 participants