File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
packages/gatsby-theme-iterative/config/prismjs Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 2424 - name : Check
2525 run : |
2626 if [[ `git status packages/gatsby-theme-iterative/config/prismjs --porcelain` ]]; then
27- cml pr create packages/gatsby-theme-iterative/config/prismjs --title "Update tool commands"
27+ cml pr create packages/gatsby-theme-iterative/config/prismjs --title "Update tool commands" --message "update tool commands"
2828 else
2929 echo "No changes!"
3030 fi
Original file line number Diff line number Diff line change 11const fs = require ( 'fs' )
2+ const vm = require ( 'node:vm' )
3+
24require ( 'isomorphic-fetch' )
35
46const args = process . argv . slice ( 2 )
@@ -21,6 +23,22 @@ const getUrl = (repo, branch = 'main') => {
2123 return `https://raw.githubusercontent.com/iterative/${ repo } /${ branch } /content/docs/sidebar.json`
2224}
2325
26+ const getAliasList = async ( repo , branch = 'main' , tool ) => {
27+ try {
28+ const link = `https://raw.githubusercontent.com/iterative/${ repo } /${ branch } /content/linked-terms.js`
29+ const res = await fetch ( link )
30+ if ( res . ok ) {
31+ const raw = await res . text ( )
32+ const data = vm . runInThisContext ( raw . replace ( 'module.exports' , 'data' ) )
33+ return data
34+ . filter ( item => item . matches . startsWith ( `${ tool } ` ) )
35+ . map ( item => item . matches . replace ( `${ tool } ` , '' ) )
36+ } else throw new Error ( 'Error with response' )
37+ } catch ( err ) {
38+ return [ ]
39+ }
40+ }
41+
2442const writeCommandsToFile = async ( commands , tool ) => {
2543 const file = `${ __dirname } /${ tool } -commands.js`
2644
@@ -52,6 +70,12 @@ const getCommands = async tool => {
5270 commands . push ( label )
5371 } )
5472
73+ const alias = await getAliasList (
74+ repoList [ tool ] . repo ,
75+ repoList [ tool ] . branch ,
76+ tool
77+ )
78+ commands . push ( ...alias )
5579 commands . sort ( sortDashedCommand )
5680
5781 writeCommandsToFile ( commands , tool )
You can’t perform that action at this time.
0 commit comments