forked from ryanburgess/engineer-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
77 lines (66 loc) · 1.99 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'use strict';
const fs = require('fs');
const obj = require('./list.json');
const videos = [];
const podcasts = [];
const books = [];
const articles = [];
let content = '# Engineering Manager Resources \n A list of engineering manager resource links.';
// create lists of resources
for (const resource of obj) {
const title = resource.title;
const url = resource.url;
const cat = resource.cat;
if(cat === 'book') {
books.push({'title': title, 'url': url});
}else if(cat === 'video') {
videos.push({'title': title, 'url': url});
}else if(cat === 'podcast') {
podcasts.push({'title': title, 'url': url});
}else if(cat === 'article') {
articles.push({'title': title, 'url': url});
}
}
// display list of books
content += '\n## Books';
for (const bookItem of books) {
content += (
`\n * [${bookItem.title}](${bookItem.url})`
);
}
// display list of videos
content += '\n\n## Videos';
for (const videoItem of videos) {
content += (
`\n * [${videoItem.title}](${videoItem.url})`
);
}
// display list of Podcasts
content += '\n\n## Podcasts';
for (const podcastItem of podcasts) {
content += (
`\n * [${podcastItem.title}](${podcastItem.url})`
);
}
// display list of Articles
content += '\n\n## Articles';
for (const articleItem of articles) {
content += (
`\n * [${articleItem.title}](${articleItem.url})`
);
}
// create contributing instructions
content += ('\n\n## Contributing \n' +
'1. Fork it\n' +
'2. Run `npm install`\n' +
'3. Add your resource to `list.json`\n' +
'4. Run `node index` to update `README.md` with your changes\n' +
'5. Create your feature branch (`git checkout -b my-new-feature`)\n' +
'6. Commit your changes (`git commit -am "Add some feature"`)\n' +
'7. Push to the branch (`git push origin my-new-feature`)\n' +
'8. Create new Pull Request\n');
// create README file
fs.writeFile('./README.md', content, function (err) {
if (err) throw err;
console.log('Updated resource list');
});