Skip to content

Commit 797d014

Browse files
authored
Merge pull request #106 from iterative/add-sorting-to-commands-script
2 parents e9aed01 + a46957d commit 797d014

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.github/workflows/update-commands.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Update tool commands list for Prismjs
22
on:
3+
workflow_dispatch:
34
schedule:
45
- cron: '0 10 * * 1-5'
56

packages/gatsby-theme-iterative/config/prismjs/get-commands.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ const repoList = {
1212

1313
const paths = ['command-reference', 'cli-reference', 'ref']
1414

15+
const sortDashedCommand = (a, b) => {
16+
if (a.split('-')[0] === b) return -1
17+
return 0
18+
}
19+
1520
const getUrl = (repo, branch = 'main') => {
1621
return `https://raw.githubusercontent.com/iterative/${repo}/${branch}/content/docs/sidebar.json`
1722
}
@@ -47,6 +52,8 @@ const getCommands = async tool => {
4752
commands.push(label)
4853
})
4954

55+
commands.sort(sortDashedCommand)
56+
5057
writeCommandsToFile(commands, tool)
5158
}
5259

0 commit comments

Comments
 (0)