-
Notifications
You must be signed in to change notification settings - Fork 19
/
generate.js
43 lines (39 loc) · 1.24 KB
/
generate.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
31
32
33
34
35
36
37
38
39
40
41
42
43
import { ContributingGen } from "./index.js";
import { writeFile } from "./utils.js";
import fs from "fs";
// Update with your project's info
const specs = {
project: {
name: "XYZ",
defaultBranch: "main",
repoUrl: "https://github.com/user/project-slug",
docsUrl: "https://github.com/user/project-slug/blob/main/README.md",
},
contributing: {
generate: true,
emailSensitiveBugs: "security@example.com",
},
codeOfConduct: {
generate: true,
// enforcement email must not be omitted if 'generate' is true
enforcementEmail: "email@example.com",
// additional info about how the code of conduct will be enforced
enforcementGuidelines: false,
},
};
const contributingTemplate = fs.readFileSync(
"templates/contributing.dot",
"utf8"
);
const codeOfConductTemplate = fs.readFileSync(
"templates/codeOfConduct.dot",
"utf8"
);
const contributingGen = new ContributingGen(
contributingTemplate,
codeOfConductTemplate
);
const contributingMd = contributingGen.generateContributing(specs);
const codeOfConductMd = contributingGen.generateCodeOfConduct(specs);
if (contributingMd) writeFile("out", contributingMd, "CONTRIBUTING.md");
if (codeOfConductMd) writeFile("out", codeOfConductMd, "CODE_OF_CONDUCT.md");