Skip to content

Commit ee2443f

Browse files
committed
feat(readme): included usage docs when returned for a lang
for #7 and for form8ion/javascript-scaffolder#20
1 parent a2fd194 commit ee2443f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

templates/README.mustache

+8
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
{{.}}
88
{{/badges.status}}
99

10+
{{#documentation.usage}}
11+
## Usage
12+
13+
{{/documentation.usage}}
1014
<!-- consumer badges -->
1115
{{#badges.consumer}}
1216
{{.}}
1317
{{/badges.consumer}}
18+
{{#documentation.usage}}
19+
20+
{{documentation.usage}}
21+
{{/documentation.usage}}
1422

1523
{{#documentation.contributing}}
1624
## Contributing

test/unit/readme-test.js

+29
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,35 @@ ${buildBadgeGroup(contributionBadges).join('\n')}
100100
});
101101

102102
suite('documentation', () => {
103+
test('that usage docs are shown after the contributing badges', async () => {
104+
const usageDocs = any.sentence();
105+
106+
await scaffoldReadme({
107+
projectRoot,
108+
badges: {consumer: consumerBadges, status: statusBadges, contribution: contributionBadges},
109+
documentation: {usage: usageDocs}
110+
});
111+
112+
assert.calledWith(
113+
fs.writeFile,
114+
`${projectRoot}/README.md`,
115+
sinon.match(`
116+
<!-- status badges -->
117+
${buildBadgeGroup(statusBadges).join('\n')}
118+
119+
## Usage
120+
121+
<!-- consumer badges -->
122+
${buildBadgeGroup(consumerBadges).join('\n')}
123+
124+
${usageDocs}
125+
126+
<!-- contribution badges -->
127+
${buildBadgeGroup(contributionBadges).join('\n')}
128+
`)
129+
);
130+
});
131+
103132
test('that contribution docs are shown after the contributing badges', async () => {
104133
const contributingDocs = any.sentence();
105134

0 commit comments

Comments
 (0)