-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
52 lines (45 loc) · 1.5 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'use strict';
const fs = require('fs');
const obj = require('./list.json');
const year = 2018;
let content = `# ${year} Bootstrapper Conferences
A list of ${year} conferences for bootstrappers, solopreneurs, founders, entrepreneurs.
`;
// create contributing instructions
const contribute = `
## Contributing
1. [Fork it here](https://github.com/mijustin/2018-conferences)
2. Add your conference to \`list.json\`
3. Run \`node index\` to update \`README.md\` with your changes
4. Create your feature branch (\`git checkout -b my-new-feature\`)
5. Commit your changes (\`git commit -am "Add some feature"\`)
6. Push to the branch (\`git push origin my-new-feature\`)
7. Create new Pull Request
(Original code by [ryanburgess](https://github.com/ryanburgess/2017-conferences))
`;
// create heading for conference list
content += `
# Conference List
`;
// format date
let formatDateYYYYMMDD = (_dateString) => {
let _d = new Date(_dateString);
return new Date(_d - _d.getTimezoneOffset() * 60 * 1000).toJSON().split(/T/)[0].replace(/-/g, '');
};
// create list of conferences
for (const conference of obj) {
// create content for readme
content += ( `
## [${conference.title}](${conference.url})
**Where:** ${conference.where}
**When:** ${conference.when}
`
);
}
// add contribute information after list of conferences
content += contribute;
// create README with the list of conferences
fs.writeFile('./README.md', content, function (err) {
if (err) throw err;
console.log('Updated conference list');
});