├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ ├── extension.yml
│ ├── format.yml
│ └── lint.yml
├── .gitignore
├── .prettierignore
├── .prettierrc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── assets
├── github-repo-size-icon256.png
├── github-repo-size-popup.png
└── github-repo-size-screenshot.png
├── astro.config.mjs
├── bun.lockb
├── bundler.ts
├── entrypoints.ts
├── eslint.config.mjs
├── extract-inline.ts
├── package.json
├── page
├── .gitignore
├── astro.config.mjs
├── bun.lockb
├── package.json
├── patches
│ └── typedoc+0.25.1.patch
├── public
│ ├── .nojekyll
│ └── favicon.png
├── src
│ ├── env.d.ts
│ └── pages
│ │ ├── auth
│ │ └── index.astro
│ │ └── index.astro
├── tailwind.config.cjs
├── tsconfig.json
├── typedoc.ts
└── yarn.lock
├── pnpm-lock.yaml
├── privacy-policy.md
├── public
├── content.css
├── images
│ ├── icon128.png
│ ├── icon16.png
│ ├── icon32.png
│ ├── icon48.png
│ └── icon64.png
└── manifest.json
├── src
├── components
│ ├── Authenticator.svelte
│ ├── Expander.svelte
│ ├── Popup.svelte
│ ├── PopupTitle.svelte
│ ├── TokenInput.svelte
│ └── TokenStatus.svelte
├── env.d.ts
├── pages
│ └── index.astro
├── scripts
│ ├── background.ts
│ ├── content.ts
│ └── internal
│ │ ├── api.ts
│ │ ├── crypto.ts
│ │ ├── dom-manipulation.ts
│ │ ├── element-factory.ts
│ │ ├── format.ts
│ │ ├── get-path-object.ts
│ │ ├── get-size.ts
│ │ ├── index.ts
│ │ ├── selectors.ts
│ │ └── types
│ │ ├── index.ts
│ │ └── types.ts
└── shared
│ ├── branch.ts
│ ├── get-token.ts
│ ├── index.ts
│ ├── storage-keys.ts
│ └── storage.ts
├── svelte.config.js
├── tailwind.config.cjs
├── tsconfig.json
├── types.d.ts
└── update-version.ts
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: 'npm'
4 | directory: '/'
5 | schedule:
6 | interval: 'weekly'
7 | groups:
8 | all-updates:
9 | patterns:
10 | - '*'
11 | - package-ecosystem: 'npm'
12 | directory: '/page'
13 | schedule:
14 | interval: 'weekly'
15 | groups:
16 | all-updates:
17 | patterns:
18 | - '*'
19 |
--------------------------------------------------------------------------------
/.github/workflows/extension.yml:
--------------------------------------------------------------------------------
1 | name: Extension Build CI
2 |
3 | on:
4 | push:
5 | branches: '**'
6 | pull_request:
7 | branches: main
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - name: Checkout code
15 | uses: actions/checkout@v4
16 |
17 | - name: Use bun
18 | uses: oven-sh/setup-bun@v1
19 | with:
20 | bun-version: latest
21 |
22 | - name: Install dependencies
23 | run: |
24 | bun install
25 |
26 | - name: Build extension
27 | run: |
28 | bun run build
29 |
--------------------------------------------------------------------------------
/.github/workflows/format.yml:
--------------------------------------------------------------------------------
1 | name: Extension Format CI
2 |
3 | on:
4 | push:
5 | branches: '**'
6 | pull_request:
7 | branches: main
8 |
9 | jobs:
10 | format:
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - name: Checkout code
15 | uses: actions/checkout@v4
16 |
17 | - name: Use bun
18 | uses: oven-sh/setup-bun@v1
19 | with:
20 | bun-version: latest
21 |
22 | - name: Install dependencies
23 | run: |
24 | bun install
25 |
26 | - name: Check code formatting
27 | run: bun run checkFormat
28 |
--------------------------------------------------------------------------------
/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: Extension Lint CI
2 |
3 | on:
4 | push:
5 | branches: '**'
6 | pull_request:
7 | branches: main
8 |
9 | jobs:
10 | lint:
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - name: Checkout code
15 | uses: actions/checkout@v4
16 |
17 | - name: Use bun
18 | uses: oven-sh/setup-bun@v1
19 | with:
20 | bun-version: latest
21 |
22 | - name: Install dependencies
23 | run: bun install
24 |
25 | - name: Check code linting
26 | run: bun run lint
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2 |
3 | build
4 | .astro/
5 | github-repo-size-extension/
6 | github-repo-size-extension.zip
7 | *.pem
8 | *.crx
9 | # Logs
10 | logs
11 | *.log
12 | npm-debug.log*
13 | yarn-debug.log*
14 | yarn-error.log*
15 | lerna-debug.log*
16 | .pnpm-debug.log*
17 |
18 | # Diagnostic reports (https://nodejs.org/api/report.html)
19 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
20 |
21 | # Runtime data
22 | pids
23 | *.pid
24 | *.seed
25 | *.pid.lock
26 |
27 | # Directory for instrumented libs generated by jscoverage/JSCover
28 | lib-cov
29 |
30 | # Coverage directory used by tools like istanbul
31 | coverage
32 | *.lcov
33 |
34 | # nyc test coverage
35 | .nyc_output
36 |
37 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
38 | .grunt
39 |
40 | # Bower dependency directory (https://bower.io/)
41 | bower_components
42 |
43 | # node-waf configuration
44 | .lock-wscript
45 |
46 | # Compiled binary addons (https://nodejs.org/api/addons.html)
47 | build/Release
48 |
49 | # Dependency directories
50 | node_modules/
51 | jspm_packages/
52 |
53 | # Snowpack dependency directory (https://snowpack.dev/)
54 | web_modules/
55 |
56 | # TypeScript cache
57 | *.tsbuildinfo
58 |
59 | # Optional npm cache directory
60 | .npm
61 |
62 | # Optional eslint cache
63 | .eslintcache
64 |
65 | # Optional stylelint cache
66 | .stylelintcache
67 |
68 | # Microbundle cache
69 | .rpt2_cache/
70 | .rts2_cache_cjs/
71 | .rts2_cache_es/
72 | .rts2_cache_umd/
73 |
74 | # Optional REPL history
75 | .node_repl_history
76 |
77 | # Output of 'npm pack'
78 | *.tgz
79 |
80 | # Yarn Integrity file
81 | .yarn-integrity
82 |
83 | # dotenv environment variable files
84 | .env
85 | .env.development.local
86 | .env.test.local
87 | .env.production.local
88 | .env.local
89 | .env.production
90 |
91 | # parcel-bundler cache (https://parceljs.org/)
92 | .cache
93 | .parcel-cache
94 |
95 | # Next.js build output
96 | .next
97 | out
98 |
99 | # Nuxt.js build / generate output
100 | .nuxt
101 |
102 | # Gatsby files
103 | .cache/
104 |
105 | # vuepress build output
106 | .vuepress/dist
107 |
108 | # vuepress v2.x temp and cache directory
109 | .temp
110 | .cache
111 |
112 | # Docusaurus cache and generated files
113 | .docusaurus
114 |
115 | # Serverless directories
116 | .serverless/
117 |
118 | # FuseBox cache
119 | .fusebox/
120 |
121 | # DynamoDB Local files
122 | .dynamodb/
123 |
124 | # TernJS port file
125 | .tern-port
126 |
127 | # Stores VSCode versions used for testing VSCode extensions
128 | .vscode-test
129 |
130 | # yarn v2
131 | .yarn/cache
132 | .yarn/unplugged
133 | .yarn/build-state.yml
134 | .yarn/install-state.gz
135 | .pnp.*
136 |
137 | # IntelliJ based IDEs
138 | .idea
139 |
140 | # macOS-specific files
141 | .DS_Store
142 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | github-repo-size-extension/
2 | node_modules/
3 | package-lock.json
4 | pnpm-lock.yaml
5 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5",
3 | "tabWidth": 2,
4 | "semi": true,
5 | "singleQuote": true
6 | }
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 0.2.7
2 |
3 | Add headers (including auth token) to fetching default branch.
4 |
5 | # 0.2.6
6 |
7 | Fixed a bug where having a submodule in a repository would hinder the extension from adding size information elements to the DOM.
8 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | - Demonstrating empathy and kindness toward other people
21 | - Being respectful of differing opinions, viewpoints, and experiences
22 | - Giving and gracefully accepting constructive feedback
23 | - Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | - Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | - The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | - Trolling, insulting or derogatory comments, and personal or political attacks
33 | - Public or private harassment
34 | - Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | - Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | .
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | This project uses [Bun](https://bun.sh/docs)! If you are on Windows, please refer to [this post](https://github.com/oven-sh/bun/issues/43) on how to make it work on your machine.
4 |
5 | #### Install dependencies
6 |
7 | ```bash
8 | bun install
9 | ```
10 |
11 | #### Build the project
12 |
13 | ```bash
14 | bun run build
15 | ```
16 |
17 | OR
18 |
19 | ```bash
20 | bun run build:firefox
21 | ```
22 |
23 | #### Manual Installation:
24 |
25 | ##### Chrome
26 |
27 | - Open your Chrome browser and navigate to [chrome://extensions/](chrome://extensions/).
28 | - Enable "Developer mode" in the top right corner.
29 | - Click on "Load unpacked" and select the github-repo-size-extension folder inside the github-repo-size directory (generated after running bun run build:firefox).
30 |
31 | ##### Firefox
32 |
33 | - Open your Firefox browser and navigate to [about:debugging#/runtime/this-firefox](about:debugging#/runtime/this-firefox).
34 | - Click on "Load Temporary Add-on…" and select the github-repo-size-extension folder inside the github-repo-size directory (generated after running bun run build).
35 |
36 | Please format and fix any linting problems in the project before creating a PR.
37 |
38 | ```bash
39 | bun run format
40 | ```
41 |
42 | ```bash
43 | bun run lint
44 | ```
45 |
46 | Most of the business logic for this extension happens inside the [src/scripts/](https://github.com/AminoffZ/github-repo-size/tree/main/src/scripts) folder. If you are looking to make changes, this is most likely the place to start.
47 |
48 | ### Docs
49 |
50 | Visit the [docs page](https://aminoffz.github.io/github-repo-size/docs) for information about specific functions. There are even a few [examples](https://aminoffz.github.io/github-repo-size/docs/functions/internal_crypto.hashClass.html).
51 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 AminoffZ
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://chrome.google.com/webstore/detail/github-repo-size/jpdmfnflpdgefbfkafcikmhipofhanfl)
2 | [](https://addons.mozilla.org/en-US/firefox/addon/github-repo-size-extension/)
3 |
4 |
5 | # GitHub Repo Size
6 |
7 | An extension to display the size of GitHub repositories.
8 | Inspired by [github-repo-size](https://github.com/harshjv/github-repo-size).
9 |
10 | ## Features
11 |
12 | View summary of file sizes in repositories.
13 |
14 |
15 |
16 |
17 |
18 | It's also possible to view private repository size summaries by adding a personal access token.[^1]
19 |
20 |
21 |
22 |
23 |
24 | GitHubs API has a limit of 50 (at time of writing) requests per hour for unauthenticated requests. By clicking Authenticate and signing in with OAuth, you can make up to 5000 requests per hour.[^2]
25 |
26 | [^1]: [Managing your personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
27 |
28 | [^2]: [Rate limiting](https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limits)
29 |
30 | ## Requirements
31 |
32 | Chromium or Firefox based browser.
33 |
34 | ## Installation
35 |
36 | For Chrome, install the extension from the [Chrome Web Store](https://chrome.google.com/webstore/detail/github-repo-size/jpdmfnflpdgefbfkafcikmhipofhanfl).
37 |
38 | For Firefox, install the extension from the [Firefox Add-on Store](https://addons.mozilla.org/en-US/firefox/addon/github-repo-size-extension/).
39 |
40 | ## Contributing
41 |
42 | Whether you've found a bug, have a suggestion, or want to add a new feature, your contributions are valuable to us. To ensure a smooth collaboration, please take a moment to read our [Contributing Guide](https://github.com/AminoffZ/github-repo-size/blob/main/CONTRIBUTING.md).
43 |
44 | **Code of Conduct:**
45 | Please note that we have a [Code of Conduct](https://github.com/AminoffZ/github-repo-size/blob/main/CODE_OF_CONDUCT.md) in place. We expect all contributors to adhere to it. It outlines the standards of behavior that everyone involved in this project should follow. Be kind and respectful.
46 |
47 | **How to Contribute:**
48 |
49 | 1. If you've spotted a bug or have a feature request, feel free to submit an [Issue](https://github.com/AminoffZ/github-repo-size/issues) and explain your concern.
50 | 2. Interested in fixing issues or adding new features? Check out our [Contributing Guide](https://github.com/AminoffZ/github-repo-size/blob/main/CONTRIBUTING.md) for a detailed walkthrough.
51 |
52 | We're thrilled to have you on board, and your contributions will make GitHub Repo Size even better for everyone.
53 | Thank you all and happy coding!
54 |
55 | ## LICENSE
56 |
57 | Github Repo Size is under [MIT License](https://github.com/AminoffZ/github-repo-size/blob/main/LICENSE).
58 |
--------------------------------------------------------------------------------
/assets/github-repo-size-icon256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/assets/github-repo-size-icon256.png
--------------------------------------------------------------------------------
/assets/github-repo-size-popup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/assets/github-repo-size-popup.png
--------------------------------------------------------------------------------
/assets/github-repo-size-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/assets/github-repo-size-screenshot.png
--------------------------------------------------------------------------------
/astro.config.mjs:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'astro/config';
2 | import svelte from '@astrojs/svelte';
3 | import tailwind from '@astrojs/tailwind';
4 |
5 | import purgecss from 'astro-purgecss';
6 |
7 | // https://astro.build/config
8 | export default defineConfig({
9 | integrations: [
10 | svelte(),
11 | tailwind(),
12 | purgecss({
13 | safelist: {
14 | deep: [/grs/],
15 | },
16 | }),
17 | ],
18 | build: {
19 | assets: 'app',
20 | },
21 | outDir: './github-repo-size-extension',
22 | });
23 |
--------------------------------------------------------------------------------
/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/bun.lockb
--------------------------------------------------------------------------------
/bundler.ts:
--------------------------------------------------------------------------------
1 | import entryPoints from './entrypoints';
2 |
3 | const entrypoints = await entryPoints();
4 |
5 | await Bun.build({
6 | entrypoints: entrypoints,
7 | outdir: './github-repo-size-extension',
8 | minify: true,
9 | });
10 |
--------------------------------------------------------------------------------
/entrypoints.ts:
--------------------------------------------------------------------------------
1 | import { readdir } from 'fs/promises';
2 | import { extname, join } from 'path';
3 |
4 | const sourceDir = './src/scripts';
5 |
6 | /**
7 | * Recursively get all .ts and .js entrypoints from the directory
8 | *
9 | * @param dir Directory path to scan
10 | * @returns {Promise} The entrypoints
11 | */
12 | async function getFiles(options?: {
13 | root?: string;
14 | deep?: boolean;
15 | }): Promise {
16 | const dir = options?.root ?? sourceDir;
17 | const deep = options?.deep ?? false;
18 | const dirents = await readdir(dir, { withFileTypes: true });
19 | const files = await Promise.all(
20 | dirents.map((dirent) => {
21 | const res = join(dir, dirent.name);
22 | if (dirent.isDirectory() && deep) {
23 | return getFiles({ ...options, root: res });
24 | } else {
25 | return Promise.resolve(res);
26 | }
27 | })
28 | );
29 |
30 | // Flatten the array and filter only .ts and .js files
31 | return Array.prototype
32 | .concat(...files)
33 | .filter((file) => ['.ts', '.js'].includes(extname(file)));
34 | }
35 |
36 | /**
37 | * Get all entrypoints from the src directory
38 | *
39 | * @returns {Promise} The entrypoints
40 | */
41 | export default async function entryPoints(options?: {
42 | root?: string;
43 | deep?: boolean;
44 | }): Promise {
45 | return await getFiles(options);
46 | }
47 |
--------------------------------------------------------------------------------
/eslint.config.mjs:
--------------------------------------------------------------------------------
1 | import typescriptEslint from '@typescript-eslint/eslint-plugin';
2 | import globals from 'globals';
3 | import tsParser from '@typescript-eslint/parser';
4 | import path from 'node:path';
5 | import { fileURLToPath } from 'node:url';
6 | import js from '@eslint/js';
7 | import { FlatCompat } from '@eslint/eslintrc';
8 |
9 | const __filename = fileURLToPath(import.meta.url);
10 | const __dirname = path.dirname(__filename);
11 | const compat = new FlatCompat({
12 | baseDirectory: __dirname,
13 | recommendedConfig: js.configs.recommended,
14 | allConfig: js.configs.all,
15 | });
16 |
17 | export default [
18 | {
19 | ignores: ['**/node_modules/', '**/github-repo-size-extension/'],
20 | },
21 | ...compat.extends(
22 | 'eslint:recommended',
23 | 'plugin:@typescript-eslint/recommended'
24 | ),
25 | {
26 | plugins: {
27 | '@typescript-eslint': typescriptEslint,
28 | },
29 |
30 | languageOptions: {
31 | globals: {
32 | ...globals.browser,
33 | ...globals.node,
34 | },
35 |
36 | parser: tsParser,
37 | ecmaVersion: 2021,
38 | sourceType: 'module',
39 | },
40 |
41 | rules: {},
42 | },
43 | {
44 | files: ['**/.eslintrc.{js,cjs}'],
45 |
46 | languageOptions: {
47 | ecmaVersion: 5,
48 | sourceType: 'script',
49 | },
50 | },
51 | ];
52 |
--------------------------------------------------------------------------------
/extract-inline.ts:
--------------------------------------------------------------------------------
1 | import { readFileSync, writeFileSync } from 'fs';
2 | import { join, resolve } from 'path';
3 | import glob from 'tiny-glob';
4 |
5 | function hash(value: string) {
6 | let hash = 5381;
7 | let i = value.length;
8 | while (i) hash = (hash * 33) ^ value.charCodeAt(--i);
9 | return (hash >>> 0).toString(36);
10 | }
11 |
12 | async function removeInlineScriptAndStyle(directory: string) {
13 | console.log('Removing Inline Scripts and Styles');
14 | const scriptRegx = /`
41 | );
42 | writeFileSync(`${directory}${fn}`, inlineScriptContent);
43 | console.log(`Inline script extracted and saved at: ${directory}${fn}`);
44 | }
45 |
46 | let style;
47 | while ((style = styleRegx.exec(f))) {
48 | const inlineStyleContent = style[1];
49 | const fn = `/style-${hash(inlineStyleContent)}.css`;
50 | f = f.replace(
51 | style[0], // Using style[0] to replace the entire matched style tag
52 | ``
53 | );
54 | writeFileSync(`${directory}${fn}`, inlineStyleContent);
55 | console.log(`Inline style extracted and saved at: ${directory}${fn}`);
56 | }
57 |
58 | writeFileSync(file, f);
59 | }
60 | }
61 |
62 | removeInlineScriptAndStyle(
63 | resolve(import.meta.dir, 'github-repo-size-extension')
64 | );
65 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "github-repo-size-extension",
3 | "type": "module",
4 | "version": "0.2.7",
5 | "scripts": {
6 | "dev": "astro dev",
7 | "start": "astro dev",
8 | "build": "bun run versionCTRL && bun run astro build && bun run csp && bun bundler.ts",
9 | "build:firefox": "bun run versionCTRL firefox && bun run astro build && bun run csp && bun bundler.ts",
10 | "preview": "astro preview",
11 | "astro": "astro",
12 | "csp": "bun -b extract-inline.ts",
13 | "versionCTRL": "bun -b update-version.ts",
14 | "format": "prettier --write .",
15 | "checkFormat": "prettier --check .",
16 | "lint": "eslint ."
17 | },
18 | "dependencies": {
19 | "@astrojs/svelte": "^4.0.2",
20 | "@astrojs/tailwind": "^5.0.0",
21 | "astro": "^3.6.5",
22 | "svelte": "^4.2.18"
23 | },
24 | "devDependencies": {
25 | "@catppuccin/tailwindcss": "^0.1.6",
26 | "@tailwindcss/forms": "^0.5.6",
27 | "@types/chrome": "^0.0.269",
28 | "@typescript-eslint/eslint-plugin": "^7.18.0",
29 | "@typescript-eslint/parser": "^7.18.0",
30 | "astro-purgecss": "^3.2.1",
31 | "bun-types": "latest",
32 | "chalk": "5.3.0",
33 | "eslint": "^9.1.0",
34 | "prettier": "^3.3.3",
35 | "purgecss": "^5.0.0",
36 | "tailwindcss": "^3.4.7",
37 | "tiny-glob": "^0.2.9"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/page/.gitignore:
--------------------------------------------------------------------------------
1 | # build output
2 | dist/
3 | # generated types
4 | .astro/
5 |
6 | # dependencies
7 | node_modules/
8 |
9 | # logs
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 | pnpm-debug.log*
14 |
15 |
16 | # environment variables
17 | .env
18 | .env.production
19 |
20 | # macOS-specific files
21 | .DS_Store
22 |
--------------------------------------------------------------------------------
/page/astro.config.mjs:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'astro/config';
2 |
3 | import tailwind from '@astrojs/tailwind';
4 |
5 | // https://astro.build/config
6 | export default defineConfig({
7 | integrations: [tailwind()],
8 | site: 'https://aminoffz.github.io',
9 | base: '/github-repo-size',
10 | build: {
11 | assets: 'app',
12 | },
13 | });
14 |
--------------------------------------------------------------------------------
/page/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/page/bun.lockb
--------------------------------------------------------------------------------
/page/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "docs",
3 | "type": "module",
4 | "version": "0.0.1",
5 | "scripts": {
6 | "dev": "astro dev",
7 | "start": "astro dev",
8 | "build": "astro build",
9 | "preview": "astro preview",
10 | "astro": "astro",
11 | "docs": "bun typedoc.ts",
12 | "deploy": "bun run build && bun run docs && gh-pages -d dist",
13 | "postinstall": "patch-package"
14 | },
15 | "dependencies": {
16 | "@astrojs/tailwind": "^5.1.3",
17 | "astro": "^5.0.5",
18 | "marked": "^15.0.4",
19 | "tailwindcss": "^3.4.16"
20 | },
21 | "devDependencies": {
22 | "@catppuccin/tailwindcss": "^0.1.6",
23 | "@types/marked": "^6.0.0",
24 | "gh-pages": "^6.2.0",
25 | "typedoc": "^0.27.5"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/page/patches/typedoc+0.25.1.patch:
--------------------------------------------------------------------------------
1 | diff --git a/node_modules/typedoc/dist/lib/utils/loggers.js b/node_modules/typedoc/dist/lib/utils/loggers.js
2 | index 727254d..16b2932 100644
3 | --- a/node_modules/typedoc/dist/lib/utils/loggers.js
4 | +++ b/node_modules/typedoc/dist/lib/utils/loggers.js
5 | @@ -5,10 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6 | Object.defineProperty(exports, "__esModule", { value: true });
7 | exports.ConsoleLogger = exports.Logger = exports.LogLevel = void 0;
8 | const typescript_1 = __importDefault(require("typescript"));
9 | -const inspector_1 = require("inspector");
10 | const path_1 = require("path");
11 | const paths_1 = require("./paths");
12 | -const isDebugging = () => !!(0, inspector_1.url)();
13 | +const isDebugging = () => false;
14 | /**
15 | * List of known log levels. Used to specify the urgency of a log message.
16 | */
17 |
--------------------------------------------------------------------------------
/page/public/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/page/public/.nojekyll
--------------------------------------------------------------------------------
/page/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/page/public/favicon.png
--------------------------------------------------------------------------------
/page/src/env.d.ts:
--------------------------------------------------------------------------------
1 | import '../.astro/types.d.ts';
2 | import 'astro/client';
3 |
--------------------------------------------------------------------------------
/page/src/pages/auth/index.astro:
--------------------------------------------------------------------------------
1 | ---
2 | const progress = 120;
3 | ---
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Astro
12 |
13 |
14 |
GitHub Repo Size
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Authentication complete. Your API rate limit is now 5000 requests per
27 | hour. You can now close this window.
28 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/page/tailwind.config.cjs:
--------------------------------------------------------------------------------
1 | import forms from '@tailwindcss/forms';
2 | import catppuccin from '@catppuccin/tailwindcss';
3 |
4 | export default {
5 | content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
6 | theme: {
7 | extend: {},
8 | },
9 | safelist: [
10 | {
11 | pattern: /bg-.+/,
12 | },
13 | 'mocha',
14 | 'macchiato',
15 | 'frappe',
16 | 'latte',
17 | ],
18 | plugins: [
19 | forms,
20 | catppuccin({
21 | prefix: 'ctp',
22 | defaultFlavour: 'macchiato',
23 | }),
24 | ],
25 | };
26 |
--------------------------------------------------------------------------------
/page/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "astro/tsconfigs/strict",
3 | "include": ["../src/scripts/**/*.ts"]
4 | }
5 |
--------------------------------------------------------------------------------
/page/typedoc.ts:
--------------------------------------------------------------------------------
1 | import * as TypeDoc from 'typedoc';
2 | import entryPoints from '../entrypoints.ts';
3 |
4 | async function main() {
5 | // Application.bootstrap also exists, which will not load plugins
6 | // Also accepts an array of option readers if you want to disable
7 | // TypeDoc's tsconfig.json/package.json/typedoc.json option readers
8 | const entrypoints = await entryPoints({ root: '../src/scripts', deep: true });
9 | const app = await TypeDoc.Application.bootstrapWithPlugins({
10 | entryPoints: entrypoints,
11 | plugin: ['typedoc-plugin-extras'],
12 | name: 'GitHub Repo Size',
13 | // @ts-expect-error: This favicon URL is necessary for GitHub Repo Size extension.
14 | favicon:
15 | 'https://raw.githubusercontent.com/AminoffZ/github-repo-size/main/assets/github-repo-size-icon256.png',
16 | });
17 |
18 | const project = await app.convert();
19 |
20 | if (project) {
21 | // Project may not have converted correctly
22 | const outputDir = './dist/docs';
23 |
24 | // Rendered docs
25 | await app.generateDocs(project, outputDir);
26 | // Alternatively generate JSON output
27 | await app.generateJson(project, outputDir + '/documentation.json');
28 | }
29 | }
30 |
31 | main().catch(console.error);
32 |
--------------------------------------------------------------------------------
/privacy-policy.md:
--------------------------------------------------------------------------------
1 | # Privacy Policy
2 |
3 | We take your privacy seriously. To better protect your privacy we provide this privacy policy notice explaining the way your personal information is collected and used.
4 |
5 | ## Links to Third Party Websites
6 |
7 | We have included links on this page for your use and reference. We are not responsible for the privacy policies on these websites. You should be aware that the privacy policies of these websites may differ from our own.
8 |
9 | ## OAuth
10 |
11 | We provide an easy way to authenticate GitHub's API with OAuth. As a necessary step of authenticating this way, your e-mail address will be stored in a [Supabase](https://supabase.com/) database. We **do not** use or share this information with anyone else. This is completely optional and we recommend using a GitHub PAT token for authentication which is not stored or shared at all.
12 |
13 | ## Security
14 |
15 | The security of your personal information is important to us, but remember that no method of transmission over the Internet, or method of electronic storage, is 100% secure. While we strive to use commercially acceptable means to protect your personal information, we cannot guarantee its absolute security.
16 |
17 | ## Changes To This Privacy Policy
18 |
19 | This Privacy Policy is effective as of **December 24, 2023** and will remain in effect except with respect to any changes in its provisions in the future, which will be in effect immediately after being posted on this page.
20 |
21 | We reserve the right to update or change our Privacy Policy at any time and you should check this Privacy Policy periodically. If we make any material changes to this Privacy Policy, we will be placing a prominent notice on our [GitHub](https://github.com/AminoffZ/github-repo-size) and [Chrome Web Store Page](https://chrome.google.com/webstore/detail/github-repo-size/jpdmfnflpdgefbfkafcikmhipofhanfl).
22 |
--------------------------------------------------------------------------------
/public/content.css:
--------------------------------------------------------------------------------
1 | .grs {
2 | color: var(--fgColor-muted, var(--color-fg-muted));
3 | }
4 |
--------------------------------------------------------------------------------
/public/images/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/public/images/icon128.png
--------------------------------------------------------------------------------
/public/images/icon16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/public/images/icon16.png
--------------------------------------------------------------------------------
/public/images/icon32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/public/images/icon32.png
--------------------------------------------------------------------------------
/public/images/icon48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/public/images/icon48.png
--------------------------------------------------------------------------------
/public/images/icon64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AminoffZ/github-repo-size/3bd39aac57d18d216fbb3e78d95dca33eb10c1a5/public/images/icon64.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "name": "GitHub Repo Size",
4 | "author": "mouiylus@gmail.com",
5 | "description": "Show size summaries of GitHub repos",
6 | "version": "0.2.7",
7 | "web_accessible_resources": [
8 | {
9 | "resources": ["script.js"],
10 | "matches": ["https://github.com/*"]
11 | }
12 | ],
13 | "content_scripts": [
14 | {
15 | "matches": ["https://github.com/*"],
16 | "js": ["content.js"],
17 | "run_at": "document_end",
18 | "css": ["content.css"]
19 | }
20 | ],
21 | "action": {
22 | "default_popup": "index.html"
23 | },
24 | "permissions": ["storage", "tabs", "webNavigation"],
25 | "background": {
26 | "service_worker": "background.js"
27 | },
28 | "icons": {
29 | "16": "images/icon16.png",
30 | "32": "images/icon32.png",
31 | "48": "images/icon48.png",
32 | "128": "images/icon128.png"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/components/Authenticator.svelte:
--------------------------------------------------------------------------------
1 |
47 |
48 |