Skip to content

Commit f661b4a

Browse files
committed
Add script to generate plugin snippets markdown table
1 parent 3c1acea commit f661b4a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

scripts/snippets-table.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// require src\snippets.json file
2+
3+
const snippets = require('../src/snippets.json');
4+
5+
// snippets has this structure:
6+
// {
7+
// "Config": {
8+
// "prefix": "devproxy-config",
9+
// "body": [
10+
// "{",
11+
// "\t\"\\$schema\": \"https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v1.0/rc.schema.json\",",
12+
// "\t\"plugins\": [$1],",
13+
// "\t\"urlsToWatch\": [$2],",
14+
// "\t\"rate\": 50,",
15+
// "\t\"labelMode\": \"text\",",
16+
// "\t\"logLevel\": \"info\"",
17+
// "}"
18+
// ],
19+
// "description": "Dev Proxy config file"
20+
// }
21+
// }
22+
23+
// iterate over snippets and print out the prefix and description as a markdown table
24+
console.log('| Prefix | Description |');
25+
console.log('| ------ | ----------- |');
26+
for (const [key, value] of Object.entries(snippets)) {
27+
console.log(`| \`${value.prefix}\` | ${value.description} |`);
28+
}

0 commit comments

Comments
 (0)