Skip to content

Commit 3184687

Browse files
committed
- add screenshots under /public/screenshots/
- link the screenshots in `readme.md` - fix the jumping window width issue of `option.html` when it is opened up in popup mode, while also being compatible with mobile view (occupying all available width), and desktop view (occupying just enough width) - forgot to make the open-source links in `option.html` actually open up a new tab - the "download" button now always blinks red when clicked on, since we have yet to implement that feature - bump patch version to `v0.1.1`
1 parent 487819d commit 3184687

File tree

8 files changed

+52
-17
lines changed

8 files changed

+52
-17
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github_aid_ts",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "an extension to display the size of github repositories and files.",
55
"author": "Omar Azmi",
66
"license": "Lulz plz don't steal yet",

public/screenshots/desktop.png

273 KB
Loading
310 KB
Loading

public/screenshots/mobile.png

95.9 KB
Loading
Loading

readme.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ This is a Chromium and Firefox extension for viewing github Repository sizes, an
44

55
> TODO: The download feature has yet to be implemented
66
7+
### Obligatory screenshots
8+
9+
<p float="left">
10+
<img src="./public/screenshots/desktop.png" style="width: 75%;" />
11+
<img src="./public/screenshots/mobile.png" style="width: 22.5%;" />
12+
<img src="./public/screenshots/desktop_option_page.png" style="width: 98%;" />
13+
</p>
714

815
## Why?
916

@@ -46,6 +53,26 @@ all in all, that will lead to a highly coupled codebase, and it'll be incredibly
4653

4754
## The Deno build process
4855

56+
### Building it yourself
57+
58+
to build this yourself, make sure that you first have [`Deno`](https://deno.com/) installed. then, in your terminal (or cmd), run:
59+
```shell
60+
deno task build-all
61+
```
62+
and you should get an unpacked distribution of the extension in the [`/dist/github_aid_ts-v*`](./dist/github_aid_ts-v0.1.0/) directory.
63+
64+
other available commands (tasks):
65+
| command | general description |
66+
|---------|---------------------|
67+
| `deno task clean` | delete the [`/dist/`](./dist/) folder |
68+
| `deno task clean --js-only` | delete only the javascript files under the [`/dist/`](./dist/) folder |
69+
| `deno task build-1` | copy all non-typescript source files to the [`/dist/`](./dist/) folder |
70+
| `deno task build-2` | bundle endpoint typescript files inside of [`/src/`](./src/),<br>and mirror the resulting javascript files to the [`/dist/`](./dist/) folder |
71+
| add an additional `--log-only` <br> flag to any of the commands above | execute the task without actually writing or deleting any files |
72+
| `deno task build-all-log-only` | runs `deno task build-1 --log-only`<br>and then `deno task build-2 --log-only` |
73+
74+
75+
### Build diagram
4976
```mermaid
5077
---
5178
title: "Build process"
@@ -107,7 +134,7 @@ flowchart LR
107134
```
108135

109136

110-
## General import map
137+
### General import map
111138
```mermaid
112139
---
113140
title: "Import graph"
@@ -137,7 +164,7 @@ flowchart TD
137164

138165
## Rationale for Code-Splitting, and its caveates
139166

140-
### what is code-splitting, and how does it differ from regular bundling?
167+
### What is Code-Splitting, and how does it differ from regular bundling?
141168
suppose you have a total of 5 source code files (`A`, `B`, `C`, `D`, and `E`), with the following dependency graph:
142169
```mermaid
143170
---
@@ -178,7 +205,7 @@ this is where a potential problem can occur: if there was a runtime-unique share
178205
a few examples of runtime-unique shared pieces of code would be:
179206
- a javascript `Symbol`. both `bundleA` and `bundleB` will define the symbol separately, thereby becoming incompatible
180207
- mutative side-effects inside of `D`. if, for instance, `D.injectButton` was a function that would inject a button into your html and then set a `D.button_injected = true` flag inside so that duplicates of buttons are not made in future calls.
181-
If both `bundleA` and `bundleB` call `D.injectButton` several times, then we'd get two buttons instead of one, because now, the flags are defined independently.
208+
If both `bundleA` and `bundleB` call `D.injectButton` several times, then we'd get two buttons instead of one, because now, the flags are defined independently. <br>
182209
had we imported from `D` instead of bundling, we would've expected to see a single injected button.
183210

184211
if we bundle with code-splitting enabled, we would get the following output dependency graph, and our runtime-unique shared pieces of code will interoperate correctly:
@@ -206,10 +233,10 @@ flowchart
206233

207234
bundling with code-splitting also comes with the advantage of smaller total output file size.
208235

209-
### caveates, specifically with browser-extensions development
236+
### Caveates of Code-Splitting specific to browser-extensions development
210237

211238
first, you need to know that the extension is supposed to be a single javascript file that is executed after your designated injection-target website has loaded (this being "github.com" for this extension). <br>
212-
the javascript file to be ran is specified in the manifest file ([`/src/manifest.json`](/src/manifest.json)), under `manifest["content_scripts"][0]["js"][0]`. <br>
239+
the javascript file to be ran is specified in the manifest file ([`/src/manifest.json`](./src/manifest.json)), under `manifest["content_scripts"][0]["js"][0]`. <br>
213240
the global context available to this javascript of yours is simply the same as the one available to the target webpage (i.e. you are in the `window` environment), in addition to having a limitied number of browser-extension features, such as: `chrome.storage` and `chrome.runtime` (or in the case of firefox: `browser.storage` and `browser.runtime`). <br>
214241
moreover, by web-security design, you cannot do static imports in any content_script (so `import {x, y, z} from "./abc.js"` is disallowed). <br>
215242
however, you *can* dynamically import using `const {x, y, z} = await import("./abc.js")`, but it **will** require that the target webpage has access to that imported file, which it currently doesn't, because the file sits locally in your browser. <br>
@@ -232,10 +259,10 @@ here's how it should look: <br>
232259
// ...
233260
}
234261
```
235-
with that, you've solved the problem that you initiated, and made your extension less secure in doing so. <br>
236-
alternatively you can choose to bundle without code-splitting, and avoid all of this fuss. but where's the fun in that? <br>
262+
with that, you've solved the problem that you initiated, and made your extension less secure along the way. <br>
263+
alternatively you can choose to bundle without code-splitting, and avoid all the fuss. but where's the fun in that? <br>
237264
see this [stackexchange answer](https://stackoverflow.com/a/53033388), where I found this information from. <br>
238-
also see [`/src/js/content_script.ts`](/src/js/content_script.ts#L32-35) for the dynamic imports being done in this extension.
265+
also see [`/src/js/content_script.ts`](./src/js/content_script.ts#L32-L35) for the dynamic imports being done in this extension.
239266

240267

241268
## License

src/html/option.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
html,
1212
body {
1313
max-width: 480px;
14-
width: 24rem;
14+
min-width: calc(min(24rem, 380px));
1515
}
1616

1717
body {
@@ -23,9 +23,13 @@
2323
border-radius: 5px;
2424
}
2525

26-
@media screen and (max-width: 420px) {
26+
@media screen and (max-width: 460px) {
27+
28+
html,
2729
body {
28-
width: calc(100vw - 1rem);
30+
width: 100vw;
31+
max-width: calc(min(100vw, 420px));
32+
min-width: 320px;
2933
}
3034
}
3135

@@ -173,14 +177,14 @@ <h2>Github Aid options</h2>
173177
<hr>
174178
open-source libraries embedded:
175179
<ul>
176-
<li><a href="https://github.com/sindresorhus/modern-normalize">modern-normalize v2.0.0</a> (MIT License)</li>
177-
<li><a href="https://github.com/omar-azmi/kitchensink_ts">kitchensink_ts v0.7.3</a></li>
180+
<li><a href="https://github.com/sindresorhus/modern-normalize" target="_blank" rel="noopener">modern-normalize v2.0.0</a> (MIT License)</li>
181+
<li><a href="https://github.com/omar-azmi/kitchensink_ts" target="_blank" rel="noopener">kitchensink_ts v0.7.3</a></li>
178182
</ul>
179183
open-source tools used:
180184
<ul>
181-
<li><a href="https://github.com/evanw/esbuild">esbuild</a></li>
182-
<li><a href="https://github.com/lucacasonato/esbuild_deno_loader">esbuild_deno_loader</a></li>
183-
<li><a href="https://github.com/denoland/deno">Deno</a></li>
185+
<li><a href="https://github.com/evanw/esbuild" target="_blank" rel="noopener">esbuild</a></li>
186+
<li><a href="https://github.com/lucacasonato/esbuild_deno_loader" target="_blank" rel="noopener">esbuild_deno_loader</a></li>
187+
<li><a href="https://github.com/denoland/deno" target="_blank" rel="noopener">Deno</a></li>
184188
</ul>
185189
</div>
186190
</body>

src/lib/modify_ui.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export const injectDownloadButton = (row_number?: number, column_span?: number)
6262
feature_name: keyof typeof config["features"] = "download",
6363
button_dom = injectButtonInTableRow(config.features[feature_name].buttonText, feature_name, row_number, column_span)
6464
// button_dom.onclick = TODO
65+
button_dom.onclick = () => {
66+
button_dom.innerText = "coming soon\u{2122}"
67+
modifyElementStyleTemporarily(button_dom, 2000, "background-color: red;")
68+
}
6569
}
6670

6771
export const injectDiskspaceButton = (row_number?: number, column_span?: number) => {

0 commit comments

Comments
 (0)