Skip to content

Commit

Permalink
fix: sort cache keys, remove default 10
Browse files Browse the repository at this point in the history
  • Loading branch information
reggi committed Dec 18, 2024
1 parent 86da819 commit 0b2ffbf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cli-cache.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"v11": "f7da341322c2f860156e8144b208583596504479",
"v9": "64763a341e7aa5b456e696f956759bf9b3440dc1",
"v8": "aa8fff11cdab94fff1a2160ee5241f5f4632e96b",
"v10": "a3041941586b6fb8ed7403fe3c24d81138a96005"
"v9": "64763a341e7aa5b456e696f956759bf9b3440dc1",
"v10": "a3041941586b6fb8ed7403fe3c24d81138a96005",
"v11": "f7da341322c2f860156e8144b208583596504479"
}
11 changes: 11 additions & 0 deletions cli/lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ class CacheVersionSha {
}

async save() {
const sortedCache = {}
Object.keys(this.cache)
.sort((a, b) => {
const numA = parseInt(a.replace('v', ''), 10)
const numB = parseInt(b.replace('v', ''), 10)
return numA - numB
})
.forEach(key => {
sortedCache[key] = this.cache[key]
})
this.cache = sortedCache
await fs.writeFile(this.path, JSON.stringify(this.cache, null, 2))
return this
}
Expand Down
2 changes: 1 addition & 1 deletion content/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@
- title: Version 10.9.2
shortName: v10
url: /cli/v10
default: true
default: false
type: legacy
children:
- title: CLI Commands
Expand Down

0 comments on commit 0b2ffbf

Please sign in to comment.