forked from github-tools/github-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_generate-options.js
More file actions
26 lines (22 loc) · 863 Bytes
/
_generate-options.js
File metadata and controls
26 lines (22 loc) · 863 Bytes
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
const YAML = require('yamljs');
const chalk = require('chalk');
const { writeFileSync } = require('fs');
const { changelogOptions, releaseOptions, globalOptions } = require('../lib/_options');
const stringifyObject = array => YAML.stringify(
array
.filter(({ short }) => short)
.map(option => {
let filteredObject = Object.assign({}, option);
delete filteredObject.action;
return filteredObject;
})
);
const files = {
'changelog-options': stringifyObject(changelogOptions),
'release-options': stringifyObject(releaseOptions),
'global-options': stringifyObject(globalOptions)
};
Object.entries(files).forEach(([filename, content]) => {
writeFileSync(`${process.cwd()}/docs/_data/${filename}.yml`, content);
console.log(chalk.green(`docs/_data/${filename}.yml created.`));
});