-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.js
30 lines (27 loc) · 862 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"use strict";
import dot from "dot";
export class ContributingGen {
/**
* Create a new generator with pre compiled templates
*/
constructor(contributingTemplate, codeOfConductTemplate) {
dot.templateSettings.strip = false;
this.contributingCompiled = dot.template(contributingTemplate);
this.codeOfConductCompiled = dot.template(codeOfConductTemplate);
}
/**
* Generate markdown output for the contribution guidelines.
*/
generateContributing(specs) {
if (!specs.contributing.generate) return "";
specs.project.repoUrl = specs.project.repoUrl.replace(/\/\s*$/, "");
return this.contributingCompiled(specs);
}
/**
* Generate markdown output for the code of conduct.
*/
generateCodeOfConduct(specs) {
if (!specs.codeOfConduct.generate) return "";
return this.codeOfConductCompiled(specs);
}
}