fix(auto-update): sync cache package.json to opencode.json intent
When users switch opencode.json from pinned version to tag (e.g., 3.10.0 -> @latest), the cache package.json still contains the pinned version. This causes bun install to reinstall the old version instead of resolving the new tag. This adds syncCachePackageJsonToIntent() which updates the cache package.json to match the user's declared intent in opencode.json before running bun install. Also fixes mock.module in test files to include all exported constants, preventing module pollution across parallel tests.
This commit is contained in:
@@ -10,6 +10,13 @@ mock.module("./constants", () => ({
|
||||
CACHE_DIR: TEST_OPENCODE_CACHE_DIR,
|
||||
USER_CONFIG_DIR: TEST_USER_CONFIG_DIR,
|
||||
PACKAGE_NAME: "oh-my-opencode",
|
||||
NPM_REGISTRY_URL: "https://registry.npmjs.org/-/package/oh-my-opencode/dist-tags",
|
||||
NPM_FETCH_TIMEOUT: 5000,
|
||||
VERSION_FILE: join(TEST_OPENCODE_CACHE_DIR, "version"),
|
||||
USER_OPENCODE_CONFIG: join(TEST_USER_CONFIG_DIR, "opencode.json"),
|
||||
USER_OPENCODE_CONFIG_JSONC: join(TEST_USER_CONFIG_DIR, "opencode.jsonc"),
|
||||
INSTALLED_PACKAGE_JSON: join(TEST_OPENCODE_CACHE_DIR, "node_modules", "oh-my-opencode", "package.json"),
|
||||
getWindowsAppdataDir: () => null,
|
||||
}))
|
||||
|
||||
mock.module("../../shared/logger", () => ({
|
||||
|
||||
Reference in New Issue
Block a user