-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
31 lines (24 loc) · 1.08 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
const fs = require('fs');
const FetchData = require('./fetchData');
const CountLanguages = require('./countLanguages');
const GenerateContent = require('./generateContent');
const owner = '2M4U'; // Replace with your GitHub username
async function generateReadme() {
const fetchData = new FetchData();
const countLanguages = new CountLanguages();
const generateContent = new GenerateContent();
try {
// Fetch repositories
const repositories = await fetchData.getRepositories(owner);
// Count language usage
const languageCount = countLanguages.countLanguageUsage(repositories);
// Generate README content
const readmeContent = generateContent.generateReadmeContent(repositories, owner, fetchData.getGithubStatistics, languageCount);
// Write README.md file
fs.writeFileSync('README.md', readmeContent);
console.log('README.md file generated successfully.');
} catch (error) {
console.error('Error generating README.md:', error.message);
}
}
generateReadme();