[break] refactor(config): split config into project (settings/) and local (profiles/) scopes#774
Open
bofeng-song wants to merge 7 commits into
Open
Conversation
…ofiles/) scopes Personal, per-machine scene state (camera views, gizmo / scene-view display preferences) was written to a committed <project>/cocos.config.json, leaking local preferences into version control. Introduce a 'local' configuration scope alongside 'project', following the Cocos Creator directory convention: - project / committed -> <project>/settings/cocos.config.json - local / personal (gitignore)-> <project>/profiles/cocos.config.json - Add 'local' to ConfigurationScope and a SaveLocal message type. - BaseConfiguration: add a local bucket; scoped get/set/remove; merged reads resolve default <- project <- local. - ConfigurationManager: load and save both files; relocate a legacy root cocos.config.json into settings/ and remove it; adjust the $schema path for the new settings/ location. - Route scene personal keys (camera, gizmo, sceneView, camera-infos, camera-uuids) to the local scope; tick stays in project. - SceneConfig: migrate personal keys from the project bucket to local on init. - lib/configuration: expose saveLocal / getLocalConfigPath / onDidSaveLocal. - Ignore profiles/cocos.config.json; relocate the test fixture config into settings/ and update the DTS snapshot.
…rameter Replace the separate saveLocal / getLocalConfigPath / onDidSaveLocal helpers on lib/configuration with an optional `scope` parameter on save, getConfigPath and onDidSave. The parameter defaults to 'project', so existing call sites keep their current behavior; pass 'local' to target profiles/cocos.config.json. Update the DTS snapshot accordingly.
knoxHuang
reviewed
Jul 20, 2026
knoxHuang
approved these changes
Jul 20, 2026
knoxHuang
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the latest head. The fixture path regression is fixed, the relevant tests and typecheck pass, and I found no additional functional issues. Approval is independent of the still-running CI checks.
…ope-settings-profiles
…tures The project scope config now lives in <project>/settings/cocos.config.json, but the e2e project manager treated the whole `settings` directory as Cocos cache: it deleted it from the source fixture and excluded it from the copied test project. As a result the temp build project had no builder config, so the build produced no output and builder-query-default-build-config fell back to a default template. Narrow the cache entry to `settings/v2` (the actual Creator scene cache) so the committed settings/cocos.config.json is preserved and copied, and normalize the copy-filter path separators so the nested cache dir also matches on Windows.
knoxHuang
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Personal, per-machine scene state (camera views, gizmo / scene-view display preferences) was previously written to a committed
<project>/cocos.config.json, leaking local preferences into version control.This PR introduces a
localconfiguration scope alongsideproject, following the Cocos Creator directory convention:<project>/settings/cocos.config.json<project>/profiles/cocos.config.jsonBoth remain single consolidated files grouped by module name (cli's own key names — no Creator key-name interop).
Changes
'local'toConfigurationScopeand aSaveLocalmessage type.BaseConfiguration— add a local bucket; scopedget/set/remove; merged reads resolvedefault <- project <- local.ConfigurationManager— load and save both files; relocate a legacy rootcocos.config.jsonintosettings/and remove it; adjust the$schemapath for the newsettings/location.camera,gizmo,sceneView,camera-infos,camera-uuids) now use thelocalscope;tickstays inproject.SceneConfig— migrate personal keys from the project bucket to local on init (existing projects self-heal).lib/configuration— exposesaveLocal/getLocalConfigPath/onDidSaveLocalto mirror the existingsave/getConfigPath/onDidSavesurface.profiles/cocos.config.json; relocate the test fixture config intosettings/; update the DTS snapshot.Migration behavior
On load, a project that only has a legacy root
cocos.config.jsonis relocated tosettings/cocos.config.json(root file removed), and its personal keys are split out intoprofiles/cocos.config.json. Existing camera views / display preferences continue to resolve.Testing
npx tsc -b— clean.npx jest src/core/configuration/test/manager.test.ts src/core/scene/test/scene-configs.test.ts— 31 passed.npx jest --roots packages/cocos-cli-types --testPathPattern dts-snapshot— 9 passed (snapshot updated).