GithubHelp home page GithubHelp logo

harshjv / github-repo-size Goto Github PK

View Code? Open in Web Editor NEW
1.2K 15.0 132.0 1.04 MB

🚀 Chrome extension to display repository size on GitHub

Home Page: https://chrome.google.com/webstore/detail/github-repository-size/apnjnioapinblneaedefcnopcjepgkci

License: MIT License

JavaScript 100.00%
chrome-extension github github-api repository-utilities repository-tools repository-management statistics chrome chrome-extensions

github-repo-size's Introduction

🚀 Chrome extension to display repository size on GitHub JavaScript Style Guide Chrome Web Store Chrome Web Store

Automatically adds repository size to GitHub's repository summary.

Featured on Product Hunt Install from chrome web store

Screenshot

Screenshot of repository size on GitHub

Private Repository

To enable viewing size of private repositories;

  1. Install extension from chrome webstore, if you haven't.
  2. Go to https://github.com/settings/tokens to generate your personal access token.
  • Check repo scope to enable this extension on private repo.
  1. Click on the Github Repo Size extension (this extension)'s icon aside the address bar.
  2. Paste your access token there in the prompt box.

Temporarily override the token

You can set x-github-token in localStorage to your access token, and the extension will use this value even if you've previously set token.

localStorage.setItem('x-github-token', <YOUR-PERSONAL-ACCESS-TOKEN>)

and then remove it to use previously set token;

localStorage.removeItem('x-github-token')

Development

  1. Clone this repo
  2. Go to chrome extensions chrome://extensions
  3. Enable developer mode
  4. Click on load unpacked extension and select this cloned repo

License

MIT

github-repo-size's People

Contributors

0xfeeddeadbeef avatar davidsawyer avatar frangio avatar fregante avatar harshjv avatar mateossh avatar stevennoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-repo-size's Issues

[ASK FOE HELP! ] About setting the repositoty size

Hi,Harsh !
Thanks for your contributions,i have succeeded in setting "viewing size of private repositories". Just like the below pic shows, the size of each files have been shown.
image
You have writen as the follows:

Temporarily override then token
You can set x-github-token in localStorage to your access token, and the extension will use this value even if you've previously set token.https://github.com/harshjv/github-repo-size#private-repository/

However, i can't find the right way to set just like the below pic.
image

CAN YOU HELP ME PLEASE? i am new to github.

  • Do i need to dowload some softwares or add new files of some types to repo

  • Where can i find the x-github-token in localStorage just like you said?

Not working on private repos

I'm trying to keep track on the size of my remote repository, and this would be very handy. Unfortunately, it does not work with private repositories.

Doesn't work for private repositories

A very helpful extension, @harshjv! But unfortunately it does not seem to work for private repositories.
It would be great if the size would be visible to the owner.
I think Github authentication would be required in the extension, but it will be worth it.

Missing or redundant

截屏2020-04-0311 55 47

截屏2020-04-0311 40 08

What is displayed will disappear or be repeated.

[Thanks for your job, it is valuable.]

Build system

Gulp or Grunt based build system with Browserify!

Wrong size ?

Hi,

I just find out that the provided size is wrong oO
Let's try with PhpFastCache:
https://api.github.com/repos/PHPSocialNetwork/phpfastcache

The size is 19153 which mean 18,7Ko(KiloOctet/KiloBytes) which mean ~ 0,02Mo (MegaOctet/MegaBytes)

However your extension, displays 18.7 MB, i guess Megabytes (because the B is uppercase).
So there's something wrong in the math.

I had a look at the code and found out this in inject.js line 20:
bytes *= 1024

It confuses me a lot. Are you calculating per-bits-based or per-bytes-based ?

Cheers,
Georges

Userscript version

I love this script, so i want to request if you can make a userscrpt version of this, for use in other browsers (even Edge using tampermonkey).

Is this possible?

Support new repository page

Github is previewing a new look for the repository page (enable it by going to Avatar → feature preview → Repository Refresh), which isn't compatible with the extension.

Screen Shot 2020-06-18 at 1 15 35 AM

Not working in private repos (404)

Even though I generated the token and added to the extension I get this in the console:

Failed to load resource: the server responded with a status of 404 (Not Found)
inject.js:109 Error: GitHub returned a bad status: 404
    at checkStatus (inject.js:79)

When I try that 404 fetch myself I see this:

image

Enhance Instructions to work correctly with Private Repo

In order to work correctly with Private Repositories or Organizations, the token needs to get the "repo - Full control of private repositories" scope assigned to it:

Scope settings needed for private repositories

Without this scope, the extension will only work on public repositories, even with the token provided.

This needs to go into the Private Repository instructions: https://github.com/harshjv/github-repo-size#private-repository

Note: The token doesn't need any other scope. Just the repo scope is enough.

Use OAuth login to your account feature.

To be honest, I find it annoying having to always enter a token (I create my token that ends at a certain time due to security reasons). I wish there was just a "Login to GitHub" feature as an alternative way to obtain access.

How to see private repo size?

I can see this in the docs "Generate a Github personal access token from here and click on extension icon to add it." But, could you elaborate?

Not able to see size of big repos

I have two private repo, one is of size 40 MB and another one is about 3.44 GB, i am not able to see the size of folder nor repo size in in my big repo.

"Data Saving" mode

Hello, I would like to make a sugestion:

Add a "Data Saving" feature that would only preload the total github repository size and would then allow to load a folder/file size manually, on click.

This will save not only bandwith but also the number of requests to the GitHub API. Note that after seeing some repos the rate limit is easily exceeded if one is not using his personal token.

Option to provide API token

Hello,

As the free access to the API is limited, you should offer a way to setup a token to the extension settings :)

total repo size != sum of folders

I have a private repo in which the after activating the plugin says it is 714MB
However when i click this to display the folder sizes, there is one folder @1.58GB

It seems like the plugin is not calculating things correctly. Any ideas?
image

EDIT: I see this behavior in many other repos, some repos have an underestimate of total size, others an overestimate

Wrong repo size

In addition to #31, I've noticed too that sometimes the repo size is completely wrong, either too big or too small.

Example

  • Go to this repo : https://github.com/bitoiu/markwrap
  • As time of writing, the total size displayed is 4.28MB
  • Click on the assets folder
  • Notice that the size of the example.gif file only is 4.58MB

extension contradicts with vimium

It seems the extension can't work with vimium on. However, after closing vimium, it can display repository size again after refreshing.

Always asks for token

Every time I restart my Browser (on latest macOS, using Brave with Chromium), this asks me for the GitHub token.

It would be good to have an options page rather than a prompt, which is terrible UX.

Text Color

image

Color for KB is off, it should be #586069 not #24292e. I fixed it locally.

Exception when there is a git submodule in the repo

DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
at chrome-extension://apnjnioapinblneaedefcnopcjepgkci/src/inject.js:154:46

image
image

It is a private repo, thus no more details can I tell, thanks.

Please consider adding support for GitHubEnterprise

Our company is moving from public github to private github (GitHubEnterprise/GHE).
In the process, I will be losing the use of this nice extension.
One of the folks in charge of the move identified the problem with this extension.

Yeah...I'm guessing this line would have to change:

const API = 'https://api.github.com/repos/'

to be configurable and to use the API Base URL I sent in the email

Display folder sizes.

It would be great if it displays folder sizes also. Would be great for big projects as they have lots of folders/extensions and could easily track their sizes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.