Comparing version 1.3.0 to 1.3.1
816
index.js
#!/usr/bin/env node | ||
'use strict' | ||
"use strict"; | ||
const qoa = require('qoa') | ||
const Conf = require('conf'); | ||
const fs = require('fs'); | ||
const qoa = require("qoa"); | ||
const Conf = require("conf"); | ||
const fs = require("fs"); | ||
const config = new Conf(); | ||
config.clear(); | ||
//console.log(config.path); | ||
// console.log(config.path); | ||
const shields = "https://img.shields.io"; | ||
@@ -17,502 +17,470 @@ const badgen = "https://badgen.net"; | ||
var get_badge_text = (provider, path, url, alt) => { | ||
var type = ""; | ||
var style = ""; | ||
if (config.has('style')) { | ||
style = config.get('style'); | ||
} | ||
if (config.has('type')) { | ||
type = config.get('type'); | ||
} | ||
var type = ""; | ||
var style = ""; | ||
if (type === 'HTML') { | ||
return `<img alt="${alt}" src="${provider}${path}style=${style}"></img>`; | ||
} | ||
else if (type === 'MarkDown') { | ||
return `[![${alt}](${provider}${path}style=${style})](${url})`; | ||
} | ||
} | ||
if (config.has("style")) { | ||
style = config.get("style"); | ||
} | ||
if (config.has("type")) { | ||
type = config.get("type"); | ||
} | ||
if (type === "HTML") { | ||
return `<a href="${url}"><img alt="${alt}" src="${provider}${path}style=${style}"/></a>`; | ||
} else if (type === "MarkDown") { | ||
return `[![${alt}](${provider}${path}style=${style})](${url})`; | ||
} | ||
}; | ||
var make_a_row = (val) => { | ||
return "\n| `" + val + "` | " + val + "|"; | ||
} | ||
return "\n| `" + val + "` | " + val + "|"; | ||
}; | ||
var rating_badges = () => {}; | ||
var rating_bages = () => { } | ||
var other_badges = (user, repo) => { | ||
var text = "\n## Other Badges\n" | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var hit_count = get_badge_text( | ||
"http://hits.dwyl.com", | ||
`/${user}/${repo}.svg?`, | ||
url, | ||
'Hit Count' | ||
); | ||
text += make_a_row(hit_count); | ||
var text = "\n## Other Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var hit_count = get_badge_text( | ||
"http://hits.dwyl.com", | ||
`/${user}/${repo}.svg?`, | ||
url, | ||
"Hit Count" | ||
); | ||
text += make_a_row(hit_count); | ||
return text; | ||
} | ||
return text; | ||
}; | ||
var social_badges = (user, repo) => { | ||
var text = "\n## Social Badges\n" | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var text = "\n## Social Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var followers = get_badge_text( | ||
shields, | ||
`/github/followers/${user}?`, | ||
url, | ||
'Followers' | ||
); | ||
text += make_a_row(followers); | ||
var followers = get_badge_text( | ||
shields, | ||
`/github/followers/${user}?`, | ||
`https://github.com/${user}?tab=followers`, | ||
"Followers" | ||
); | ||
var forks = get_badge_text( | ||
shields, | ||
`/github/forks/${user}/${repo}?`, | ||
url, | ||
'Forks' | ||
); | ||
text += make_a_row(followers); | ||
//console.log(forks); | ||
text += make_a_row(forks); | ||
var forks = get_badge_text( | ||
shields, | ||
`/github/forks/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/network/members`, | ||
"Forks" | ||
); | ||
// console.log(forks); | ||
text += make_a_row(forks); | ||
var stars = get_badge_text( | ||
shields, | ||
`/github/stars/${user}/${repo}?`, | ||
url, | ||
'Stars' | ||
); | ||
// console.log(stars); | ||
text += make_a_row(stars); | ||
var stars = get_badge_text( | ||
shields, | ||
`/github/stars/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/stargazers`, | ||
"Stars" | ||
); | ||
// console.log(stars); | ||
text += make_a_row(stars); | ||
var watchers = get_badge_text( | ||
shields, | ||
`/github/watchers/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/watchers`, | ||
"Watchers" | ||
); | ||
// console.log(watchers); | ||
text += make_a_row(watchers); | ||
var watchers = get_badge_text( | ||
if (config.has("twitter")) { | ||
if ( | ||
config.get("twitter") !== false && | ||
config.get("twitter.id") !== undefined | ||
) { | ||
var twitter_follow = get_badge_text( | ||
shields, | ||
`/github/watchers/${user}/${repo}?`, | ||
url, | ||
'Watchers' | ||
); | ||
//console.log(watchers); | ||
text += make_a_row(watchers); | ||
if (config.has('twitter')) { | ||
if (config.get('twitter') !== false && config.get('twitter.id') !== undefined) { | ||
var twitter_follow = get_badge_text( | ||
shields, | ||
`/twitter/follow/${config.get('twitter.id')}?logo=twitter&`, | ||
url, | ||
'Twitter Follow' | ||
); | ||
// console.log(twitter_follow); | ||
text += make_a_row(twitter_follow); | ||
} | ||
`/twitter/follow/${config.get("twitter.id")}?logo=twitter&`, | ||
`https://twitter.com/${config.get("twitter.id")}`, | ||
"Twitter Follow" | ||
); | ||
// console.log(twitter_follow); | ||
text += make_a_row(twitter_follow); | ||
} | ||
return text; | ||
} | ||
} | ||
return text; | ||
}; | ||
var dependency_badges = (user, repo) => { | ||
var url = `https://github.com/${user}/${repo}/network/dependencies`; | ||
}; | ||
} | ||
var version_badges = (user, repo) => { | ||
var text = "\n## Version Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var text = "\n## Version Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}/releases`; | ||
var version = get_badge_text( | ||
shields, | ||
`/github/v/release/${user}/${repo}?`, | ||
url, | ||
'Release Version' | ||
); | ||
//console.log(version); | ||
text += make_a_row(version); | ||
return text; | ||
} | ||
var version = get_badge_text( | ||
shields, | ||
`/github/v/release/${user}/${repo}?`, | ||
url, | ||
"Release Version" | ||
); | ||
// console.log(version); | ||
text += make_a_row(version); | ||
return text; | ||
}; | ||
var ci_cd_badges = (user, repo) => { | ||
var text = "\n## CI/CD Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var text = "\n## CI/CD Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
if (config.get('github') === false || !config.has('github')) { | ||
return text = "\n## CI/CD Badges\n"; | ||
} | ||
var github_workflow = get_badge_text( | ||
shields, | ||
`/github/workflow/status/${user}/${repo}/${config.get('github.workflow')}?label=${config.get('github.workflow')}&logo=github&`, | ||
url, | ||
'GitHub Workflow Status' | ||
); | ||
if (config.get("github") === false || !config.has("github")) { | ||
return (text = "\n## CI/CD Badges\n"); | ||
} | ||
var github_workflow = get_badge_text( | ||
shields, | ||
`/github/workflow/status/${user}/${repo}/${config.get( | ||
"github.workflow" | ||
)}?label=${config.get("github.workflow")}&logo=github&`, | ||
url + `/actions?query=workflow:${config.get("github.workflow")}`, | ||
"GitHub Workflow Status" | ||
); | ||
text += make_a_row(github_workflow); | ||
text += make_a_row(github_workflow); | ||
if (config.has('ci_cd_provider') && config.get('ci_cd_provider') === 'Travis') { | ||
var travis = get_badge_text( | ||
shields, | ||
`/travis/${user}/${repo}?label=Build&logo=travis&`, | ||
url, | ||
'Travis Build' | ||
); | ||
text += make_a_row(travis); | ||
} | ||
if ( | ||
config.has("ci_cd_provider") && | ||
config.get("ci_cd_provider") === "Travis" | ||
) { | ||
var travis = get_badge_text( | ||
shields, | ||
`/travis/${user}/${repo}?label=Build&logo=travis&`, | ||
url, | ||
"Travis Build" | ||
); | ||
text += make_a_row(travis); | ||
} | ||
return text; | ||
} | ||
return text; | ||
}; | ||
var activity_badges = (user, repo) => { | ||
var text = "\n## Activity Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var text = "\n## Activity Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}/graphs/commit-activity`; | ||
var commits_per_month = get_badge_text( | ||
shields, | ||
`/github/commit-activity/m/${user}/${repo}?`, | ||
url, | ||
'Commits/month' | ||
); | ||
//console.log(commits_per_month); | ||
text += make_a_row(commits_per_month); | ||
var commits_per_month = get_badge_text( | ||
shields, | ||
`/github/commit-activity/m/${user}/${repo}?`, | ||
url, | ||
"Commits/month" | ||
); | ||
// console.log(commits_per_month); | ||
text += make_a_row(commits_per_month); | ||
var last_commit = get_badge_text( | ||
shields, | ||
`/github/last-commit/${user}/${repo}?`, | ||
url, | ||
"Last Commit" | ||
); | ||
// console.log(last_commit); | ||
text += make_a_row(last_commit); | ||
var last_commit = get_badge_text( | ||
shields, | ||
`/github/last-commit/${user}/${repo}?`, | ||
url, | ||
'Last Commit' | ||
); | ||
// console.log(last_commit); | ||
text += make_a_row(last_commit); | ||
var release_date = get_badge_text( | ||
shields, | ||
`/github/release-date/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/releases`, | ||
"Last release date" | ||
); | ||
// console.log(release_date); | ||
text += make_a_row(release_date); | ||
var contributors = get_badge_text( | ||
shields, | ||
`/github/contributors/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/graphs/contributors`, | ||
"Contributors" | ||
); | ||
// console.log(contributors); | ||
text += make_a_row(contributors); | ||
var relese_date = get_badge_text( | ||
shields, | ||
`/github/release-date/${user}/${repo}?`, | ||
url, | ||
'Last release date' | ||
); | ||
// console.log(relese_date); | ||
text += make_a_row(relese_date); | ||
return text; | ||
}; | ||
var contributors = get_badge_text( | ||
shields, | ||
`/github/contributors/${user}/${repo}?`, | ||
url, | ||
'Contributors' | ||
); | ||
// console.log(contributors); | ||
text += make_a_row(contributors); | ||
return text; | ||
} | ||
var license_badges = (user, repo) => { | ||
var text = "\n## License Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var license = get_badge_text( | ||
shields, | ||
`/github/license/${user}/${repo}?`, | ||
url, | ||
'License' | ||
); | ||
// console.log(license); | ||
text += make_a_row(license); | ||
return text; | ||
} | ||
var text = "\n## License Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}/blob/master/LICENSE`; | ||
var license = get_badge_text( | ||
shields, | ||
`/github/license/${user}/${repo}?`, | ||
url, | ||
"License" | ||
); | ||
// console.log(license); | ||
text += make_a_row(license); | ||
return text; | ||
}; | ||
var size_badges = (user, repo) => { | ||
var text = "\n## Size Badges\n"; | ||
text += table_header; | ||
var text = "\n## Size Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var repo_size = get_badge_text(shields, `/github/repo-size/${user}/${repo}?` | ||
, url, 'Repo Size'); | ||
// console.log(repo_size); | ||
text += make_a_row(repo_size); | ||
return text; | ||
} | ||
var url = `https://github.com/${user}/${repo}`; | ||
var repo_size = get_badge_text( | ||
shields, | ||
`/github/repo-size/${user}/${repo}?`, | ||
url, | ||
"Repo Size" | ||
); | ||
// console.log(repo_size); | ||
text += make_a_row(repo_size); | ||
return text; | ||
}; | ||
var analysis_badges = (user, repo) => { | ||
var text = "\n## Analysis Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var text = "\n## Analysis Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var languages_count = get_badge_text( | ||
shields, | ||
`/github/languages/count/${user}/${repo}?`, | ||
url, | ||
'Language Count' | ||
); | ||
// console.log(languages_count); | ||
text += make_a_row(languages_count); | ||
var languages_count = get_badge_text( | ||
shields, | ||
`/github/languages/count/${user}/${repo}?`, | ||
url, | ||
"Language Count" | ||
); | ||
// console.log(languages_count); | ||
text += make_a_row(languages_count); | ||
var top_language = get_badge_text( | ||
shields, | ||
`/github/languages/top/${user}/${repo}?`, | ||
url, | ||
'Top Language' | ||
); | ||
// console.log(top_language); | ||
text += make_a_row(top_language); | ||
var top_language = get_badge_text( | ||
shields, | ||
`/github/languages/top/${user}/${repo}?`, | ||
url, | ||
"Top Language" | ||
); | ||
// console.log(top_language); | ||
text += make_a_row(top_language); | ||
if (config.has('analysis_provider') && config.get('analysis_provider') === 'CodeClimate') { | ||
var codeclimate_maintain_percent = get_badge_text( | ||
shields, | ||
`/codeclimate/maintainability-percentage/${user}/${repo}?`, | ||
url, | ||
'Code Climate maintainability' | ||
); | ||
// console.log(codeclimate_maintain_percent); | ||
text += make_a_row(codeclimate_maintain_percent); | ||
var codeclimate_issues = get_badge_text( | ||
shields, | ||
`/codeclimate/issues/${user}/${repo}?`, | ||
url, | ||
"Code Climate Issues" | ||
); | ||
// console.log(codeclimate_issues); | ||
text += make_a_row(codeclimate_issues); | ||
} | ||
if (config.has('analysis_provider') && config.get('analysis_provider') === 'Codacy') { | ||
if (config.has('codacy.project_id') && config.get('codacy.project_id') !== "") { | ||
var codacy_project_id = config.get('codacy.project_id'); | ||
var codacy_grade = get_badge_text( | ||
shields, | ||
`/codacy/grade/${codacy_project_id}?`, | ||
url, 'Codacy Grade' | ||
); | ||
// console.log(codacy_grade); | ||
text += make_a_row(codacy_grade); | ||
} | ||
} | ||
return text; | ||
} | ||
var issues_badges = (user, repo) => { | ||
var text = "\n## Issues Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}`; | ||
var issue_raw = get_badge_text( | ||
shields, | ||
`/github/issues-raw/${user}/${repo}?`, | ||
url, | ||
"Github Isuues" | ||
if ( | ||
config.has("analysis_provider") && | ||
config.get("analysis_provider") === "CodeClimate" | ||
) { | ||
var codeclimate_maintain_percent = get_badge_text( | ||
shields, | ||
`/codeclimate/maintainability-percentage/${user}/${repo}?`, | ||
url, | ||
"Code Climate maintainability" | ||
); | ||
// console.log(issues_raw); | ||
text += make_a_row(issue_raw); | ||
// console.log(codeclimate_maintain_percent); | ||
text += make_a_row(codeclimate_maintain_percent); | ||
var issues_closed = get_badge_text( | ||
shields, | ||
`/github/issues-closed/${user}/${repo}?`, | ||
url, | ||
"Github closed Isuues" | ||
var codeclimate_issues = get_badge_text( | ||
shields, | ||
`/codeclimate/issues/${user}/${repo}?`, | ||
url, | ||
"Code Climate Issues" | ||
); | ||
// console.log(issues_closed); | ||
text += make_a_row(issues_closed); | ||
var pr_raw = get_badge_text( | ||
// console.log(codeclimate_issues); | ||
text += make_a_row(codeclimate_issues); | ||
} | ||
if ( | ||
config.has("analysis_provider") && | ||
config.get("analysis_provider") === "Codacy" | ||
) { | ||
if ( | ||
config.has("codacy.project_id") && | ||
config.get("codacy.project_id") !== "" | ||
) { | ||
var codacy_project_id = config.get("codacy.project_id"); | ||
var codacy_grade = get_badge_text( | ||
shields, | ||
`/github/issues-pr-raw/${user}/${repo}?`, | ||
`/codacy/grade/${codacy_project_id}?`, | ||
url, | ||
"Github open PRs" | ||
); | ||
// console.log(pr_raw); | ||
text += make_a_row(pr_raw); | ||
"Codacy Grade" | ||
); | ||
// console.log(codacy_grade); | ||
text += make_a_row(codacy_grade); | ||
} | ||
} | ||
return text; | ||
}; | ||
var issues_badges = (user, repo) => { | ||
var text = "\n## Issues Badges\n"; | ||
text += table_header; | ||
var url = `https://github.com/${user}/${repo}/issues`; | ||
var issue_raw = get_badge_text( | ||
shields, | ||
`/github/issues-raw/${user}/${repo}?`, | ||
url, | ||
"Github Issues" | ||
); | ||
// console.log(issues_raw); | ||
text += make_a_row(issue_raw); | ||
var pr_closed = get_badge_text( | ||
shields, | ||
`/github/issues-pr-closed/${user}/${repo}?`, | ||
url, | ||
"Github closed PRs" | ||
); | ||
// console.log(pr_closed); | ||
text += make_a_row(pr_closed); | ||
var issues_closed = get_badge_text( | ||
shields, | ||
`/github/issues-closed/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/issues?q=is%3Aissue+is%3Aclosed`, | ||
"Github closed Issues" | ||
); | ||
// console.log(issues_closed); | ||
text += make_a_row(issues_closed); | ||
return text; | ||
} | ||
var pr_raw = get_badge_text( | ||
shields, | ||
`/github/issues-pr-raw/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/pulls`, | ||
"Github open PRs" | ||
); | ||
// console.log(pr_raw); | ||
text += make_a_row(pr_raw); | ||
var pr_closed = get_badge_text( | ||
shields, | ||
`/github/issues-pr-closed/${user}/${repo}?`, | ||
`https://github.com/${user}/${repo}/pulls?q=is%3Apr+is%3Aclosed`, | ||
"Github closed PRs" | ||
); | ||
// console.log(pr_closed); | ||
text += make_a_row(pr_closed); | ||
return text; | ||
}; | ||
var analyze_inputs = () => { | ||
const write_stream = fs.createWriteStream( | ||
`./autobadge-${config.get("repo")}-${config.get("style")}.md` | ||
); | ||
write_stream.write("# Autobadge\nThis is an auto-generated file\n"); | ||
const write_stream = fs.createWriteStream(`./autobadge-${config.get('repo')}-${config.get('style')}.md`); | ||
write_stream.write("# Autobadge\nThis is an auto-generated file\n"); | ||
const user = config.get("user"); | ||
const repo = config.get("repo"); | ||
const user = config.get('user'); | ||
const repo = config.get('repo'); | ||
write_stream.write(license_badges(user, repo)); | ||
write_stream.write(social_badges(user, repo)); | ||
write_stream.write(size_badges(user, repo)); | ||
write_stream.write(issues_badges(user, repo)); | ||
write_stream.write(analysis_badges(user, repo)); | ||
write_stream.write(activity_badges(user, repo)); | ||
write_stream.write(version_badges(user, repo)); | ||
write_stream.write(ci_cd_badges(user, repo)); | ||
write_stream.write(other_badges(user, repo)); | ||
console.log("\x1b[32m", "\nBadges Creation Completed :)"); | ||
}; | ||
write_stream.write(license_badges(user, repo)); | ||
write_stream.write(social_badges(user, repo)); | ||
write_stream.write(size_badges(user, repo)); | ||
write_stream.write(issues_badges(user, repo)); | ||
write_stream.write(analysis_badges(user, repo)); | ||
write_stream.write(activity_badges(user, repo)); | ||
write_stream.write(version_badges(user, repo)); | ||
write_stream.write(ci_cd_badges(user, repo)); | ||
write_stream.write(other_badges(user, repo)); | ||
console.log("\x1b[32m", "\nBadges Creation Completed :)"); | ||
} | ||
const interactive_mode = async () => { | ||
var user = await qoa.input({ | ||
query: "Type your github username:", | ||
handle: "user", | ||
}); | ||
config.set(user); | ||
if (!config.has("user") || config.get("user") === "") | ||
throw new Error("Empty user name"); | ||
var user = await qoa.input({ | ||
query: 'Type your github username:', | ||
handle: 'user' | ||
}); | ||
config.set(user); | ||
if (!config.has('user') || config.get('user') === "") | ||
throw new Error("Empty user name"); | ||
var repo = await qoa.input({ query: "Type your repo name:", handle: "repo" }); | ||
config.set(repo); | ||
if (!config.has("repo") || config.get("repo") === "") | ||
throw new Error("Empty repo name"); | ||
var style = await qoa.interactive({ | ||
query: "Badges style:", | ||
handle: "style", | ||
symbol: ">", | ||
menu: ["flat", "flat-square", "plastic", "social", "for-the-badge"], | ||
}); | ||
config.set(style); | ||
var repo = await qoa.input({ | ||
query: 'Type your repo name:', | ||
handle: 'repo' | ||
}); | ||
config.set(repo); | ||
if (!config.has('repo') || config.get('repo') === "") | ||
throw new Error("Empty repo name"); | ||
var type = await qoa.interactive({ | ||
query: "Badges Type:", | ||
handle: "type", | ||
symbol: ">", | ||
menu: ["MarkDown", "HTML"], | ||
}); | ||
config.set(type); | ||
var twitter = await qoa.confirm({ | ||
query: "Have Twitter Account?", | ||
handle: "twitter", | ||
accept: "y", | ||
deny: "n", | ||
}); | ||
config.set(twitter); | ||
if (config.get("twitter") == true) { | ||
var twitter_id = await qoa.input({ query: "Twitter Id:", handle: "id" }); | ||
config.set("twitter", twitter_id); | ||
} | ||
var style = await qoa.interactive({ | ||
query: 'Badges style:', | ||
handle: 'style', | ||
symbol: '>', | ||
menu: [ | ||
'flat', | ||
'flat-square', | ||
'plastic', | ||
'social', | ||
'for-the-badge' | ||
] | ||
}); | ||
config.set(style); | ||
var ci_cd = await qoa.confirm({ | ||
query: "Want CI/CD status?", | ||
handle: "ci_cd", | ||
accept: "y", | ||
deny: "n", | ||
}); | ||
config.set(ci_cd); | ||
var type = await qoa.interactive({ | ||
query: 'Badges Type:', | ||
handle: 'type', | ||
symbol: '>', | ||
menu: [ | ||
'MarkDown', | ||
'HTML' | ||
] | ||
if (config.get("ci_cd") === true) { | ||
var ci_cd_provider = await qoa.interactive({ | ||
query: "Your CI/CD provider:", | ||
handle: "ci_cd_provider", | ||
symbol: ">", | ||
menu: ["Travis"], | ||
}); | ||
config.set(type); | ||
config.set(ci_cd_provider); | ||
} | ||
var twitter = await qoa.confirm({ | ||
query: 'Have Twitter Account?', | ||
handle: 'twitter', | ||
accept: 'y', | ||
deny: 'n' | ||
}); | ||
config.set(twitter); | ||
if (config.get('twitter') == true) { | ||
var twitter_id = await qoa.input({ | ||
query: 'Twitter Id:', | ||
handle: 'id' | ||
}); | ||
config.set('twitter', twitter_id); | ||
} | ||
var analysis = await qoa.confirm({ | ||
query: "Code Analysis services added?", | ||
handle: "analysis", | ||
accept: "y", | ||
deny: "n", | ||
}); | ||
config.set(analysis); | ||
var ci_cd = await qoa.confirm({ | ||
query: "Want CI/CD status?", | ||
handle: 'ci_cd', | ||
accept: 'y', | ||
deny: 'n' | ||
if (config.has("analysis") && config.get("analysis") === true) { | ||
var analysis_provider = await qoa.interactive({ | ||
query: "Your Code Analysis provider:", | ||
handle: "analysis_provider", | ||
symbol: ">", | ||
menu: ["CodeClimate", "Codacy"], | ||
}); | ||
config.set(ci_cd); | ||
config.set(analysis_provider); | ||
} | ||
if (config.get('ci_cd') === true) { | ||
var ci_cd_provider = await qoa.interactive({ | ||
query: 'Your CI/CD provider:', | ||
handle: 'ci_cd_provider', | ||
symbol: '>', | ||
menu: [ | ||
'Travis' | ||
] | ||
}); | ||
config.set(ci_cd_provider); | ||
} | ||
var analysis = await qoa.confirm({ | ||
query: 'Code Analysis services added?', | ||
handle: 'analysis', | ||
accept: 'y', | ||
deny: 'n' | ||
if ( | ||
config.has("analysis_provider") && | ||
config.get("analysis_provider") === "Codacy" | ||
) { | ||
var project_id = await qoa.secure({ | ||
query: "Your Codacy Project ID:", | ||
handle: "project_id", | ||
}); | ||
config.set(analysis); | ||
config.set("codacy", project_id); | ||
} | ||
if (config.has('analysis') && config.get('analysis') === true) { | ||
var analysis_provider = await qoa.interactive({ | ||
query: 'Your Code Analysis provider:', | ||
handle: 'analysis_provider', | ||
symbol: '>', | ||
menu: [ | ||
'CodeClimate', | ||
'Codacy' | ||
] | ||
}); | ||
config.set(analysis_provider); | ||
} | ||
var github_workflow = await qoa.confirm({ | ||
query: "GitHub Workflow added?", | ||
handle: "github", | ||
accept: "y", | ||
deny: "n", | ||
}); | ||
config.set(github_workflow); | ||
if (config.has('analysis_provider') && config.get('analysis_provider') === 'Codacy') { | ||
var project_id = await qoa.secure({ | ||
query: 'Your Codacy Project ID:', | ||
handle: 'project_id' | ||
}); | ||
config.set('codacy', project_id); | ||
} | ||
var github_workflow = await qoa.confirm({ | ||
query: "GitHub Workflow added?", | ||
handle: "github", | ||
accept: 'y', | ||
deny: 'n' | ||
if (config.has("github") && config.get("github") === true) { | ||
var workflow_name = await qoa.input({ | ||
query: "Enter GitHub Workflow name:", | ||
handle: "workflow", | ||
}); | ||
config.set(github_workflow); | ||
config.set("github", workflow_name); | ||
} | ||
}; | ||
if (config.has('github') && config.get('github') === true) { | ||
var workflow_name = await qoa.input({ | ||
query: "Enter GitHub Workflow name:", | ||
handle: "workflow", | ||
}); | ||
config.set('github', workflow_name); | ||
} | ||
} | ||
interactive_mode().then(analyze_inputs); | ||
//analyze_inputs(); | ||
// analyze_inputs(); |
{ | ||
"name": "autobadge", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "simple CLI tool to generate repository badges", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
128
README.md
@@ -5,38 +5,34 @@ <div align=center> | ||
<p align="center"> <h1 align="center">AutoBadge</h1></p> | ||
<p align="center"><h2 align="center"> Interactive . Smart . Efficient</h2></p> | ||
<p align="center">A Simple CLI Tool To Generate Essential Repository Badges With Ease. | ||
It Asks For Minimum Informtion From The User And Produces All (Almost) The Essential Badges.</p> | ||
<p align="center">A Simple Cli Tool To Generate Essential Repository Badges With Ease. | ||
It Asks For Minimum Information From The User And Produces All (Almost) The Essential Badges</p> | ||
<p align="center"><a href="https://github.com/deep5050/autobadge/actions?query=workflow%3Anpm-publish"><img src="https://img.shields.io/github/workflow/status/deep5050/autobadge/npm-publish?label=npm-publish&logo=github&style=for-the-badge"></a></p> | ||
<p align="center"><a href="https://www.npmjs.com/package/autobadge"><img alt="npm" src="https://img.shields.io/npm/dt/autobadge?color=red&label=INSTALL&logo=npm&style=for-the-badge"></a></p> | ||
</div> | ||
## Why use? | ||
Digging The Internet For Getting Common Badges Is Not A Handy Way. Why Not Use A | ||
Script And Answer Few Questions To Generate Them? Huh?! :sunglasses: | ||
## Why use? | ||
Digging the internet for getting common badges is not a handy way. | ||
Why not use a script and answer few questions to generate them? Huh?! :sunglasses: | ||
## How to use? | ||
## How to use? | ||
Install It Globally : | ||
Run `npm install -g autobadge` and `autobadge`, that's it :zap: | ||
Run `npm install -g autobadge` and `autobadge`, That'S It :zap: | ||
<p align="center"><a href="https://github.com/deep5050/autobadge"><img src="https://i.imgur.com/sL3yf7x.png" title="autobadge" /></a></p> | ||
## Supports | ||
## Supports | ||
- [x] MarkDown | ||
- [x] HTML | ||
- [x] Shields Badges | ||
- [ ] Badgen Badges | ||
- [ ] ForTheBadge Badges | ||
## Style | ||
- [x] Flat | ||
@@ -48,67 +44,89 @@ - [x] Flat-Square | ||
# Result (More Comming Soon...) | ||
## What's New in 1.3.1? | ||
- [x] Clickable Badge When In HTML Format | ||
- [x] Separate URLs For Each badges | ||
## TODO | ||
- [ ] HTML Alignment Support | ||
- [ ] Ad Shields Badges | ||
- [ ] Badgen Badges | ||
- [ ] ForTheBadge Badges | ||
## Result (More Coming Soon....) | ||
## License Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![License](https://img.shields.io/github/license/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![License](https://img.shields.io/github/license/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/deep5050/autobadge?style=for-the-badge"/></a> | | ||
## Social Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Followers](https://img.shields.io/github/followers/deep5050?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Followers](https://img.shields.io/github/followers/deep5050?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Forks](https://img.shields.io/github/forks/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Forks](https://img.shields.io/github/forks/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Stars](https://img.shields.io/github/stars/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Stars](https://img.shields.io/github/stars/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Watchers](https://img.shields.io/github/watchers/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Watchers](https://img.shields.io/github/watchers/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Twitter Follow](https://img.shields.io/twitter/follow/deep5050?logo=twitter&style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Twitter Follow](https://img.shields.io/twitter/follow/deep5050?logo=twitter&style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050?tab=followers"><img alt="Followers" src="https://img.shields.io/github/followers/deep5050?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050?tab=followers"><img alt="Followers" src="https://img.shields.io/github/followers/deep5050?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/watchers"><img alt="Watchers" src="https://img.shields.io/github/watchers/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/watchers"><img alt="Watchers" src="https://img.shields.io/github/watchers/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://twitter.com/dipankar5050"><img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/dipankar5050?logo=twitter&style=for-the-badge"/></a>` | <a href="https://twitter.com/dipankar5050"><img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/dipankar5050?logo=twitter&style=for-the-badge"/></a> | | ||
## Size Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Repo Size](https://img.shields.io/github/repo-size/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Repo Size](https://img.shields.io/github/repo-size/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge"><img alt="Repo Size" src="https://img.shields.io/github/repo-size/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge"><img alt="Repo Size" src="https://img.shields.io/github/repo-size/deep5050/autobadge?style=for-the-badge"/></a> | | ||
## Issues Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Github Isuues](https://img.shields.io/github/issues-raw/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Github Isuues](https://img.shields.io/github/issues-raw/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Github closed Isuues](https://img.shields.io/github/issues-closed/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Github closed Isuues](https://img.shields.io/github/issues-closed/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Github open PRs](https://img.shields.io/github/issues-pr-raw/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Github open PRs](https://img.shields.io/github/issues-pr-raw/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Github closed PRs](https://img.shields.io/github/issues-pr-closed/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Github closed PRs](https://img.shields.io/github/issues-pr-closed/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge/issues"><img alt="Github Issues" src="https://img.shields.io/github/issues-raw/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/issues"><img alt="Github Issues" src="https://img.shields.io/github/issues-raw/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/issues?q=is%3Aissue+is%3Aclosed"><img alt="Github closed Issues" src="https://img.shields.io/github/issues-closed/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/issues?q=is%3Aissue+is%3Aclosed"><img alt="Github closed Issues" src="https://img.shields.io/github/issues-closed/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/pulls"><img alt="Github open PRs" src="https://img.shields.io/github/issues-pr-raw/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/pulls"><img alt="Github open PRs" src="https://img.shields.io/github/issues-pr-raw/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/pulls?q=is%3Apr+is%3Aclosed"><img alt="Github closed PRs" src="https://img.shields.io/github/issues-pr-closed/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/pulls?q=is%3Apr+is%3Aclosed"><img alt="Github closed PRs" src="https://img.shields.io/github/issues-pr-closed/deep5050/autobadge?style=for-the-badge"/></a> | | ||
## Analysis Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Language Count](https://img.shields.io/github/languages/count/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Language Count](https://img.shields.io/github/languages/count/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Top Language](https://img.shields.io/github/languages/top/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Top Language](https://img.shields.io/github/languages/top/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge"><img alt="Language Count" src="https://img.shields.io/github/languages/count/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge"><img alt="Language Count" src="https://img.shields.io/github/languages/count/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge"><img alt="Top Language" src="https://img.shields.io/github/languages/top/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge"><img alt="Top Language" src="https://img.shields.io/github/languages/top/deep5050/autobadge?style=for-the-badge"/></a> | | ||
## Activity Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Commits/month](https://img.shields.io/github/commit-activity/m/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Commits/month](https://img.shields.io/github/commit-activity/m/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Last Commit](https://img.shields.io/github/last-commit/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Last Commit](https://img.shields.io/github/last-commit/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Last release date](https://img.shields.io/github/release-date/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Last release date](https://img.shields.io/github/release-date/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| `[![Contributors](https://img.shields.io/github/contributors/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Contributors](https://img.shields.io/github/contributors/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge/graphs/commit-activity"><img alt="Commits/month" src="https://img.shields.io/github/commit-activity/m/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/graphs/commit-activity"><img alt="Commits/month" src="https://img.shields.io/github/commit-activity/m/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/graphs/commit-activity"><img alt="Last Commit" src="https://img.shields.io/github/last-commit/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/graphs/commit-activity"><img alt="Last Commit" src="https://img.shields.io/github/last-commit/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/releases"><img alt="Last release date" src="https://img.shields.io/github/release-date/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/releases"><img alt="Last release date" src="https://img.shields.io/github/release-date/deep5050/autobadge?style=for-the-badge"/></a> | | ||
| `<a href="https://github.com/deep5050/autobadge/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/deep5050/autobadge?style=for-the-badge"/></a> | | ||
## Version Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Release Version](https://img.shields.io/github/v/release/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Release Version](https://img.shields.io/github/v/release/deep5050/autobadge?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge/releases"><img alt="Release Version" src="https://img.shields.io/github/v/release/deep5050/autobadge?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/releases"><img alt="Release Version" src="https://img.shields.io/github/v/release/deep5050/autobadge?style=for-the-badge"/></a> | | ||
## CI/CD Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/deep5050/autobadge/npm-publish?label=npm-publish&logo=github&style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/deep5050/autobadge/npm-publish?label=npm-publish&logo=github&style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge/actions?query=workflow:npm-publish"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/deep5050/autobadge/npm-publish?label=npm-publish&logo=github&style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge/actions?query=workflow:npm-publish"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/deep5050/autobadge/npm-publish?label=npm-publish&logo=github&style=for-the-badge"/></a> | | ||
## Other Badges | ||
| Syntax | Badge | | ||
| :--- | :----: | | ||
| `[![Hit Count](http://hits.dwyl.com/deep5050/autobadge.svg?style=for-the-badge)](https://github.com/deep5050/autobadge)` | [![Hit Count](http://hits.dwyl.com/deep5050/autobadge.svg?style=for-the-badge)](https://github.com/deep5050/autobadge)| | ||
| Syntax | Badge | | ||
| :------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| `<a href="https://github.com/deep5050/autobadge"><img alt="Hit Count" src="http://hits.dwyl.com/deep5050/autobadge.svg?style=for-the-badge"/></a>` | <a href="https://github.com/deep5050/autobadge"><img alt="Hit Count" src="http://hits.dwyl.com/deep5050/autobadge.svg?style=for-the-badge"/></a> | | ||
# My Other Works | ||
<a href="https://github.com/deep5050/qikQR">qikQR : Minimal Cross-Platform QR Code Generator Desktop App </a> | ||
<a href="https://github.com/deep5050/autopy-lot">Autopy-lot: Github Action To Convert jupyter Notebook To Python Script</a> | ||
<a href="https://github.com/deep5050/qikQR">qikQR : Minimal Cross-Platform QR | ||
Code Generator Desktop App </a> | ||
<a href="https://github.com/deep5050/autopy-lot">Autopy-Lot: Github Action To | ||
Convert Jupyter Notebook To Python Script</a> | ||
### MIT (c) 2020 Dipankar Pal | ||
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
30918
422
131