Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

autobadge

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autobadge - npm Package Compare versions

Comparing version 1.0.1 to 1.1.3

219

index.js

@@ -0,1 +1,4 @@

#!/usr/bin/env node
'use strict'
const qoa = require('qoa')

@@ -7,7 +10,7 @@ const Conf = require('conf');

config.clear();
//console.log(config.path);
const shields = "https://img.shields.io";
const badgen = "https://badgen.net";
const table_header = `| Syntax | Badge |\n| :--- | :----: |`;
const table_header = `\n| Syntax | Badge |\n| :--- | :----: |`;

@@ -17,2 +20,3 @@ var get_badge_text = (provider, path, url, alt) => {

var style = "";
if (config.has('style')) {

@@ -26,6 +30,6 @@ style = config.get('style');

if (type === 'HTML') {
return text = `<img alt="${alt}" src="${provider}${path}?style=${style}"></img>`;
return `<img alt="${alt}" src="${provider}${path}style=${style}"></img>`;
}
else if (type === 'MarkDown') {
return text = `[![${alt}](${provider}${path}?style=${style})](${url})`;
return `[![${alt}](${provider}${path}style=${style})](${url})`;
}

@@ -36,24 +40,27 @@ }

var make_a_row = (val) => {
return "\n| `" + val + "` | " + val + "|";
}
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 create_column = (val) => {
return text = "\n| `" + val + "` | " + val + "|";
return text;
}
function rating_bages() { };
function other_badges() { };
//-----------------------------------------
function social_badges(user, repo) {
var social_badges = (user, repo) => {
var text = "\n## Social Badges\n"

@@ -65,12 +72,12 @@ text += table_header;

shields,
`/github/followers/${user}`,
`/github/followers/${user}?`,
url,
'Followers'
);
//console.log(followers);
text += create_column(followers);
text += make_a_row(followers);
var forks = get_badge_text(
shields,
`/github/forks/${user}/${repo}`,
`/github/forks/${user}/${repo}?`,
url,

@@ -81,3 +88,3 @@ 'Forks'

//console.log(forks);
text += create_column(forks);
text += make_a_row(forks);

@@ -87,3 +94,3 @@

shields,
`/github/stars/${user}/${repo}`,
`/github/stars/${user}/${repo}?`,
url,

@@ -93,3 +100,3 @@ 'Stars'

// console.log(stars);
text += create_column(stars);
text += make_a_row(stars);

@@ -99,3 +106,3 @@

shields,
`/github/watchers/${user}/${repo}`,
`/github/watchers/${user}/${repo}?`,
url,

@@ -105,3 +112,3 @@ 'Watchers'

//console.log(watchers);
text += create_column(watchers);
text += make_a_row(watchers);

@@ -113,3 +120,3 @@

shields,
`/twitter/follow/${config.get('twitter.id')}?logo=twitter`,
`/twitter/follow/${config.get('twitter.id')}?logo=twitter&`,
url,

@@ -119,3 +126,3 @@ 'Twitter Follow'

// console.log(twitter_follow);
text += create_column(twitter_follow);
text += make_a_row(twitter_follow);
}

@@ -126,11 +133,8 @@ }

//-----------------------------------------
var dependency_badges = (user, repo) => {
function dependency_badges(user, repo) {
}
//------------------------------------------
function version_badges(user, repo) {
var version_badges = (user, repo) => {
var text = "\n## Version Badges\n";

@@ -142,3 +146,3 @@ text += table_header;

shields,
`/github/v/release/${user}/${repo}`,
`/github/v/release/${user}/${repo}?`,
url,

@@ -148,3 +152,3 @@ 'Release Version'

//console.log(version);
text += create_column(version);
text += make_a_row(version);
return text;

@@ -154,5 +158,34 @@ }

var ci_cd_badges = (user, repo) => {
var text = "\n## CI/CD Badges\n";
text += table_header;
var url = `https://github.com/${user}/${repo}`;
//-------------------------------------------
function activity_badges(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'
);
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);
}
return text;
}
var activity_badges = (user, repo) => {
var text = "\n## Activity Badges\n";

@@ -164,3 +197,3 @@ text += table_header;

shields,
`/github/commit-activity/m/${user}/${repo}`,
`/github/commit-activity/m/${user}/${repo}?`,
url,

@@ -170,3 +203,3 @@ 'Commits/month'

//console.log(commits_per_month);
text += create_column(commits_per_month);
text += make_a_row(commits_per_month);

@@ -176,3 +209,3 @@

shields,
`/github/last-commit/${user}/${repo}`,
`/github/last-commit/${user}/${repo}?`,
url,

@@ -182,3 +215,3 @@ 'Last Commit'

// console.log(last_commit);
text += create_column(last_commit);
text += make_a_row(last_commit);

@@ -188,3 +221,3 @@

shields,
`/github/release-date/${user}/${repo}`,
`/github/release-date/${user}/${repo}?`,
url,

@@ -194,3 +227,3 @@ 'Last release date'

// console.log(relese_date);
text += create_column(relese_date);
text += make_a_row(relese_date);

@@ -200,3 +233,3 @@

shields,
`/github/contributors/${user}/${repo}`,
`/github/contributors/${user}/${repo}?`,
url,

@@ -206,3 +239,3 @@ 'Contributors'

// console.log(contributors);
text += create_column(contributors);
text += make_a_row(contributors);

@@ -212,7 +245,4 @@ return text;

//--------------------------------------------
function license_badges(user, repo) {
var text = "\n## License Badges";
var license_badges = (user, repo) => {
var text = "\n## License Badges\n";
text += table_header;

@@ -222,3 +252,3 @@ var url = `https://github.com/${user}/${repo}`;

shields,
`/github/license/${user}/${repo}`,
`/github/license/${user}/${repo}?`,
url,

@@ -228,3 +258,3 @@ 'License'

// console.log(license);
text += create_column(license);
text += make_a_row(license);
return text;

@@ -234,6 +264,3 @@ }

//----------------------------------------------------
function size_badges(user, repo) {
var size_badges = (user, repo) => {
var text = "\n## Size Badges\n";

@@ -243,5 +270,6 @@ 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');
var repo_size = get_badge_text(shields, `/github/repo-size/${user}/${repo}?`
, url, 'Repo Size');
// console.log(repo_size);
text += create_column(repo_size);
text += make_a_row(repo_size);
return text;

@@ -251,5 +279,3 @@ }

//----------------------------------------------------
function analysis_badges(user, repo) {
var analysis_badges = (user, repo) => {
var text = "\n## Analysis Badges\n";

@@ -261,3 +287,3 @@ text += table_header;

shields,
`/github/languages/count/${user}/${repo}`,
`/github/languages/count/${user}/${repo}?`,
url,

@@ -267,7 +293,7 @@ 'Language Count'

// console.log(languages_count);
text += create_column(languages_count);
text += make_a_row(languages_count);
var top_language = get_badge_text(
shields,
`/github/languages/top/${user}/${repo}`,
`/github/languages/top/${user}/${repo}?`,
url,

@@ -277,3 +303,3 @@ 'Top Language'

// console.log(top_language);
text += create_column(top_language);
text += make_a_row(top_language);

@@ -283,3 +309,3 @@ if (config.has('analysis_provider') && config.get('analysis_provider') === 'CodeClimate') {

shields,
`/codeclimate/maintainability-percentage/${user}/${repo}`,
`/codeclimate/maintainability-percentage/${user}/${repo}?`,
url,

@@ -289,7 +315,7 @@ 'Code Climate maintainability'

// console.log(codeclimate_maintain_percent);
text += create_column(codeclimate_maintain_percent);
text += make_a_row(codeclimate_maintain_percent);
var codeclimate_issues = get_badge_text(
shields,
`/codeclimate/issues/${user}/${repo}`,
`/codeclimate/issues/${user}/${repo}?`,
url,

@@ -299,3 +325,3 @@ "Code Climate Issues"

// console.log(codeclimate_issues);
text += create_column(codeclimate_issues);
text += make_a_row(codeclimate_issues);

@@ -307,7 +333,8 @@ }

var codacy_grade = get_badge_text(
shields, `/codacy/grade/${codacy_project_id}`,
shields,
`/codacy/grade/${codacy_project_id}?`,
url, 'Codacy Grade'
);
// console.log(codacy_grade);
text += create_column(codacy_grade);
text += make_a_row(codacy_grade);
}

@@ -319,5 +346,4 @@ }

//------------------------------------------
function issues_badges(user, repo) {
var issues_badges = (user, repo) => {
var text = "\n## Issues Badges\n";

@@ -330,3 +356,3 @@ text += table_header;

shields,
`/github/issues-raw/${user}/${repo}`,
`/github/issues-raw/${user}/${repo}?`,
url,

@@ -336,3 +362,3 @@ "Github Isuues"

// console.log(issues_raw);
text += create_column(issue_raw);
text += make_a_row(issue_raw);

@@ -343,3 +369,3 @@

shields,
`/github/issues-closed/${user}/${repo}`,
`/github/issues-closed/${user}/${repo}?`,
url,

@@ -349,3 +375,3 @@ "Github closed Isuues"

// console.log(issues_closed);
text += create_column(issues_closed);
text += make_a_row(issues_closed);

@@ -356,3 +382,3 @@

shields,
`/github/issues-pr-raw/${user}/${repo}`,
`/github/issues-pr-raw/${user}/${repo}?`,
url,

@@ -362,3 +388,3 @@ "Github open PRs"

// console.log(pr_raw);
text += create_column(pr_raw);
text += make_a_row(pr_raw);

@@ -369,3 +395,3 @@

shields,
`/github/issues-pr-closed/${user}/${repo}`,
`/github/issues-pr-closed/${user}/${repo}?`,
url,

@@ -375,3 +401,3 @@ "Github closed PRs"

// console.log(pr_closed);
text += create_column(pr_closed);
text += make_a_row(pr_closed);

@@ -382,6 +408,6 @@ return text;

//---------------------------------------------------------
var analyze_inputs = () => {
const write_stream = fs.createWriteStream(`./autobadge-${config.get('style')}.md`);
const write_stream = fs.createWriteStream(`./autobadge-${config.get('repo')}-${config.get('style')}.md`);
write_stream.write("# Autobadge\nThis is an auto-generated file\n");

@@ -393,9 +419,13 @@

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));
console.log("\x1b[32m","Badges Creation Completed");
write_stream.write(ci_cd_badges(user, repo));
write_stream.write(other_badges(user, repo));
console.log("\x1b[32m", "\nBadges Creation Completed :)");
}

@@ -514,2 +544,19 @@

}
var github_workflow = await qoa.confirm({
query: "GitHub Workflow added?",
handle: "github",
accept: 'y',
deny: 'n'
});
config.set(github_workflow);
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);
}
}

@@ -521,2 +568,2 @@

interactive_mode().then(analyze_inputs);
// analyze_inputs();
//analyze_inputs();
{
"name": "autobadge",
"version": "1.0.1",
"version": "1.1.3",
"description": "simple CLI tool to generate repository badges",
"main": "index.js",
"bin": {
"autobadge": "./index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "npm publish",
"lint": "xo --prittier"
},

@@ -16,9 +21,12 @@ "repository": {

"md",
"markdown.readme",
"markdown",
"readme",
"doc",
"documentation",
"document",
"git",
"repo",
"repository"
"repository",
"badge-generator",
"shields",
"badgen"
],

@@ -31,2 +39,5 @@ "author": "dipankar pal <dipankarpal5050@gmail.com>",

"homepage": "https://github.com/deep5050/autobadge#readme",
"files": [
"index.js"
],
"dependencies": {

@@ -36,5 +47,3 @@ "conf": "^6.2.4",

},
"devDependencies": {
"signale": "^1.4.0"
}
"devDependencies": {}
}

@@ -5,8 +5,12 @@ <div align=center>

<h1>AutoBadge</h1>
<h2> Intaractive . Smart . Efficient</h2>
<h3>Simple CLI tool to Generate Essential Repository Badges with Ease.
<h2> Interactive . Smart . Efficient</h2>
<h3>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.</h3>
<a href="https://github.com/deep5050/autobadge/actions?query=workflow%3Anpm-publish"><img src="https://github.com/deep5050/autobadge/workflows/npm-publish/badge.svg"></a>
<!-- <a href="https://github.com/deep5050/autobadge/"><img src="https://img.shields.io/npm/dt/autobadge.svg"></a> -->
</div>
## Why use?

@@ -19,3 +23,3 @@ Digging the internet for getting common badges is not a handy way.

`npm install autobadge -g ` and add `const autobadge = require('autobadge');` to your main script, that's it :zap:
`npm install -g autobadge` and add `const autobadge = require('autobadge');` to your main script, that's it :zap:
<div align=center>

@@ -28,3 +32,3 @@ <a href="https://github.com/deep5050/autobadge"><img src="https://i.imgur.com/Qpy9o4Q.png" title="autobadge" /></a>

**Pro Tips:**
Create a dedicated directory and run the script everytime to generate badges for any kind of github repos.
Fork this repo and run `npm start` to generate badges for any kind of github repos.

@@ -31,0 +35,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc