refactor: Rename lock file to docs-lock.json#16
Conversation
📝 WalkthroughWalkthroughRenamed the default lock filename from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
commit: |
There was a problem hiding this comment.
Pull request overview
This PR renames the lock file from docs.lock to docs-lock.json to follow a more conventional naming pattern with a clear file extension.
Changes:
- Updated
DEFAULT_LOCK_FILENAMEconstant from"docs.lock"to"docs-lock.json"insrc/lock.ts - Moved constant export from
src/paths.tstosrc/lock.tsand re-exported viasrc/api.ts - Updated all test files to import and use
DEFAULT_LOCK_FILENAMEinstead of hardcoded strings - Renamed fixture file
tests/fixtures/empty.docs.locktotests/fixtures/empty.docs-lock.json - Updated documentation in
README.mdandAGENTS.mdto reference new filename - Updated
.gitignoreto ignoredocs-lock.jsoninstead ofdocs.lock
Reviewed changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lock.ts | Changed DEFAULT_LOCK_FILENAME constant value from "docs.lock" to "docs-lock.json" |
| src/api.ts | Added export of DEFAULT_LOCK_FILENAME from lock module |
| src/paths.ts | Removed DEFAULT_LOCK_FILENAME constant (moved to lock.ts) |
| src/status.ts | Added import and usage of DEFAULT_LOCK_FILENAME for status display |
| tests/sync-tool-version.test.js | Updated to import and use DEFAULT_LOCK_FILENAME constant |
| tests/sync-output.test.js | Updated to import and use DEFAULT_LOCK_FILENAME constant |
| tests/sync-offline-fail.test.js | Updated to import and use DEFAULT_LOCK_FILENAME constant |
| tests/sync-materialize.test.js | Updated to import and use DEFAULT_LOCK_FILENAME constant |
| tests/lock.test.js | Updated to dynamically construct fixture path using DEFAULT_LOCK_FILENAME |
| tests/integration-real-repos.test.js | Updated to import and use DEFAULT_LOCK_FILENAME constant |
| tests/edge-cases.test.js | Updated to import and use DEFAULT_LOCK_FILENAME constant |
| tests/fixtures/empty.docs.lock | Deleted old fixture file |
| tests/fixtures/empty.docs-lock.json | Created new empty fixture file with renamed filename |
| tests/fixtures/docs.lock | Deleted fixture file containing vitest source data |
| README.md | Updated documentation to reference docs-lock.json |
| AGENTS.md | Updated documentation to reference docs-lock.json |
| .gitignore | Updated to ignore docs-lock.json instead of docs.lock |
| scripts/benchmarks/run.mjs | Updated to import and use DEFAULT_LOCK_FILENAME constant |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.gitignore:
- Around line 9-10: Restore and retain the legacy docs.lock ignore entry
alongside the existing docs-lock.json entry in .gitignore so both patterns are
ignored during the deprecation window; specifically add or keep "docs.lock" in
the ignore list (in addition to "docs-lock.json") to prevent stale docs.lock
files from appearing as untracked.
In `@src/lock.ts`:
- Line 22: The DEFAULT_LOCK_FILENAME export was changed to "docs-lock.json" but
readLock still fails when older "docs.lock" files exist; update the readLock
function to check for the legacy filename "docs.lock" if DEFAULT_LOCK_FILENAME
is missing, prefer the new file when present, and if the legacy file is found
either migrate/rename it to DEFAULT_LOCK_FILENAME or read from it and log a
notice about the fallback; reference DEFAULT_LOCK_FILENAME and readLock so you
add the fallback existence check, read logic, and optional rename/notification
flow there.
In `@tests/lock.test.js`:
- Around line 24-27: The test fails because the fixture referenced by
module.DEFAULT_LOCK_FILENAME (expected filename docs-lock.json) is missing the
required sources.vitest entry; either rename tests/fixtures/empty.docs-lock.json
to docs-lock.json and add a sources.vitest.rulesSha256: "efgh" entry, or create
a new docs-lock.json fixture containing version, generatedAt, toolVersion and a
sources object with vitest.rulesSha256 set to "efgh" so the lock validation in
the test (fixturePath / module.DEFAULT_LOCK_FILENAME) finds the expected data.
Summary
Rename lock file from
docs.locktodocs-lock.jsonfor consistency.Changes
docs.locktodocs-lock.jsonDEFAULT_LOCK_FILENAMEfrom main API moduleexecFileAsyncwithexecafor better subprocess handlingexecadependency with supporting packagesBreaking Changes
Lock file naming changes; existing
docs.lockfiles require migration.