Skip to content

Commit 0df8d8d

Browse files
feat!: add v0.2
1 parent 8538674 commit 0df8d8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+5969
-2477
lines changed

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"arrowParens": "avoid"
3+
}

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"ecmel.vscode-html-css",
5+
"yzhang.markdown-all-in-one",
6+
"christian-kohler.npm-intellisense",
7+
"samverschueren.linter-xo",
8+
"zixuanchen.vitest-explorer",
9+
"christian-kohler.path-intellisense"
10+
]
11+
}

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
"[typescript]": {
33
"editor.defaultFormatter": "samverschueren.linter-xo"
44
},
5+
"[typescriptreact]": {
6+
"editor.defaultFormatter": "samverschueren.linter-xo"
7+
},
58
"[javascript]": {
69
"editor.defaultFormatter": "esbenp.prettier-vscode"
710
},
811
"xo.format.enable": true,
912
"typescript.tsdk": "./node_modules/typescript/lib",
13+
"vitest.commandLine": "pnpm run test",
14+
"vitest.enable": true,
1015
}

README.md

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,108 @@
11
# Banger
2-
![Icon](static/icons/icon.svg)
2+
![Banger icon](static/icons/icon.svg)
33

4-
A FireFox extension that adds DuckDuckGo-like !Bangs to any search engine.
4+
A Firefox extension that adds DuckDuckGo-like !Bangs to any search engine.
55

6-
Install this extension at https://addons.mozilla.org/en-US/firefox/addon/banger/
6+
Install this extension at https://addons.mozilla.org/en-US/Firefox/addon/banger/
77

8-
Banger fetches list of bangs from DuckDuckGo and Brave, letting you choose which backend to use.
9-
All processing is done client-side, so bang execution is faster than usual.
8+
## FAQ
109

11-
To learn more about bangs, see https://help.duckduckgo.com/duckduckgo-help-pages/features/bangs/ and https://search.brave.com/help/bangs
10+
### What are bangs?
11+
Bangs are a feature of certain search engines (DuckDuckGo[^1.1], Brave Search[^1.2], Searx[^1.3], SearXNG[^1.4], You.com[^1.5]) that allow you to type shortcuts to quickly open up another search engine or website's URL. For example, you can type `!yt example` in DuckDuckGo to open up https://www.youtube.com/results?search_query=example, which is the page on YouTube for searching `example`; likewise, you can simply type `!yt` to open up https://www.youtube.com.
12+
13+
[^1.1]: https://duckduckgo.com/bangs
14+
[^1.2]: https://search.brave.com/bangs
15+
[^1.3]: https://searx.github.io/searx/user/search_syntax.html
16+
[^1.4]: https://docs.searxng.org/user/index.html
17+
[^1.5]: https://about.you.com/bangs/
18+
19+
### What does banger do?
20+
Banger lets you execute !bangs client-side without having to send a request to a search engine's server each time you fetch a bang. It also allows you to use !bangs with any search engine rather than only those that support them. Also, it speeds your queries up because all the data is cached client-side and there are fewer redirects.
21+
22+
Banger also goes a step further and adds exclusive new features such as allowing you to define your own !bangs and having site bangs and super lucky bangs.
23+
24+
### Why does banger's search suggestions use Google?
25+
Due to a technical limitation with the Web Extensions API, Banger can't direct search suggestions to its engine of choice instead of choosing a permanent search suggestion provider. Which forces it to settle down with one search suggestion provider, and Google is the most popular choice.
26+
27+
### What's a lucky bang?
28+
Lucky bang is a bang without a specified search engine. Currently, it's only supported in DuckDuckGo (but with Banger you can use it anywhere) and you can use it by typing a `!` followed by a whitespace and your search query. It allows you to directly open up the first search result instead of having to manually click it after searching.
29+
30+
Officially, lucky lang doesn't have a name. Banger calls it `lucky lang` because of this feature similar to Google's `I'm feeling lucky` button.
31+
32+
Note: You can configure what symbol to use for the Lucky Bang on Banger's settings page.
33+
34+
### What's a site bang?
35+
A site bang is what Banger calls the bangs that you can execute inside your search engine rather than opening up the target site's search. It works by using the `site:` syntax[^2.1][^2.2] of search engines. By default, Banger uses the prefix `!@` for site bangs; So you can type `!@yt example` to search up `site:https://www.youtube.com example` on your preferred search engine. There's plans to support sub-domain modification later.
36+
37+
[^2.1]: https://support.google.com/websearch/answer/2466433
38+
[^2.2]: https://help.duckduckgo.com/duckduckgo-help-pages/results/syntax/
39+
40+
### What's a mixed site bang?
41+
A mixed site bang is what banger calls the bangs where you can execute a site bang inside another bang, such as using `!ddg@yt example` to search `site:https://www.youtube.com example` on DuckDuckGo.
42+
43+
### What's a super lucky bang?
44+
A super lucky bang is what Banger calls the bang where you combine a site bang with the lucky bang. By default, Banger uses the prefix `!!` for super lucky bangs. So you can type `!!yt example` and it'll open the first search result of `example` from YouTube. Unfortunately, the search results are currently only fetched from DuckDuckGo as I'm not aware of other search engines allowing you to redirect to the first search result freely.
45+
46+
### How to chain multiple bangs together?
47+
You can chain multiple bangs, site bangs, mixed site bangs, or super lucky bangs together with Banger's multi-bang delimiter, which is `;` by default. So you can type `!yt;r` to open up YouTube and Reddit in their respective tabs, and `!yr;r example` to search `example` on both of them.
48+
49+
### How can I chain multiple sites together in site bangs, mixed site bangs, and super lucky bangs?
50+
You can chain multiple of them together using Banger's multi-site bang delimiter, which is `,` by default. So you can type `!@yt,r example` to search `site:https://www.youtube.com/ | site:https://www.reddit.com/ example`. `|` here is the `OR` operator supported by most search engines[^3.1]; although as of 1st January 2023 Brave Search doesn't appear to support it yet.
51+
52+
[^3.1]: https://support.microsoft.com/en-gb/topic/advanced-search-options-b92e25f1-0085-4271-bdf9-14aaea720930
53+
54+
### Can I mix multi-bang and multi-site-bang chaining?
55+
Yes, you can! Typing `!@yt,r;r example` searches `site:https://www.youtube.com/ | site:https://www.reddit.com/ example` in one tab and `site:https://www.reddit.com/ example` in another.
56+
57+
### Can I add my own bangs?
58+
You absolutely can! Head to Banger's options page and click on the `Custom Bangs` tab.
59+
60+
### Can I use the symbols as postfixes rather than prefixes?
61+
Yes, you can! Both postfix and prefix syntax is supported for bangs.
62+
63+
### Can I place my bang at the end of my query rather than at the start?
64+
Yes, you can! Although placing them in the middle isn't supported, unfortunately.
65+
66+
### Will you add Chrome support?
67+
I've been considering it but I don't think I'll do it unless this extension gets enough users. Unfortunately, Chrome's addon marketplace requires a $5 registration fee for publishing extensions[^4.1]. I'm not planning on adding Chrome compatibility until I can publish it there.
68+
69+
[^4.1]: https://developer.chrome.com/docs/webstore/register/
70+
71+
### Will you add Edge support?
72+
It's planned! Since Microsoft Edge's marketplace doesn't require any registration fees[^5.1], I've been considering porting Banger to support Edge and publishing it there. Although currently, it doesn't appear that Edge's marketplace has anything similar to [web-ext-submit](https://www.npmjs.com/package/web-ext-submit), so integrating it into GitHub Actions might not be feasible.
73+
74+
[^5.1]: https://learn.microsoft.com/en-us/microsoft-edge/extensions-chromium/publish/create-dev-account
75+
76+
## Roadmap
77+
78+
- [x] Bangs with any search engine. (`!yt` to open YouTube, `!yt example` to search `example` in YouTube.)
79+
- [x] Quick client-side bang querying and caching.
80+
- [x] Support for all 13.5k DuckDuckGo bangs (https://duckduckgo.com/bangs). As well as the ability to switch to Brave Search's bangs instead. (https://search.brave.com/bangs)
81+
- [x] Lucky bangs. (`! example` to open up the first search result for `example`.)
82+
- [x] Site bangs. (`!@yt example` to search for `example` from YouTube on your preferred search engine.)
83+
- [x] Mixed site bangs. (`!g@yt example` to search for `example` from YouTube on Google.)
84+
- [x] Multi-bangs. (`!yt;r` to open up YouTube and Reddit in their respective tabs.)
85+
- [x] Multi-site bangs. (`!@yt,r example` to search for `example` from YouTube or Reddit.)
86+
- [x] Custom bangs. (You can define your own bangs in settings.)
87+
- [x] Flexible syntax. (`!yt example`, `yt! example`, `example yt!`, `example !yt`)
88+
- [x] Customization options.
89+
- [x] Import/Export settings.
90+
- [ ] Negative site bangs.
91+
- [ ] Negative mixed site bangs.
92+
- [ ] Mobile support.
93+
- [ ] Custom bang sources.
1294

1395
## Development
96+
1497
### Installation
15-
You must install the required pnpm packages and setup husky hooks in order to develop this repository.
98+
99+
You must install the required npm packages and set up husky hooks to develop this repository.
100+
16101
1. `pnpm install`
17102
2. `pnpm run prepare`
103+
18104
### Testing
105+
19106
- `pnpm run test` to run all tests
20107
- `pnpm run watch` to watch source files
21-
- `pnpm run start` to start a firefox instance with the current addon build temporarily installed
108+
- `pnpm run start` to start a Firefox instance with the current addon build temporarily installed

jest.config.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

package.json

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,29 @@
44
"description": "Add DuckDuckGo-like !Bangs to any search engine.",
55
"scripts": {
66
"watch": "vite build --watch",
7+
"watch:ext": "chokidar \"static/**/*\" -c \"pnpm run build:ext\"",
78
"bundle": "vite build",
89
"build:ext": "web-ext build --overwrite-dest",
910
"clean": "rimraf dist/ web-ext-artifacts/",
10-
"prebuild": "npm run clean && mkdirp dist/",
11-
"build": "npm run bundle && npm run build:ext",
11+
"prebuild": "pnpm run clean && mkdirp dist/",
12+
"build": "pnpm run bundle && pnpm run build:ext",
1213
"lint:src": "xo --fix .",
1314
"lint:ext": "web-ext lint",
14-
"lint": "npm run lint:src && npm run lint:ext",
15-
"test": "jest",
16-
"start:ext": "web-ext run --devtools",
17-
"start": "concurrently -k npm:watch npm:start:ext",
15+
"lint": "pnpm run lint:src && pnpm run lint:ext",
16+
"test": "vitest",
17+
"start:ext": "web-ext run --devtools --url about:addons",
18+
"start": "concurrently -k \"pnpm run watch\" \"pnpm run watch\" \"pnpm run start:ext\"",
19+
"dev": "pnpm run start",
1820
"sign": "env-cmd -x web-ext sign --api-key=\\$FIREFOX_API_KEY --api-secret=\\$FIREFOX_API_SECRET",
1921
"prepare": "husky install",
2022
"release": "standard-version --sign",
2123
"release:tags": "git push --follow-tags origin main",
2224
"release:github": "env-cmd conventional-github-releaser -p conventionalcommits",
23-
"postrelease": "npm run release:tags && npm run release:github"
25+
"postrelease": "pnpm run release:tags && pnpm run release:github"
2426
},
2527
"webExt": {
2628
"sourceDir": "dist/"
2729
},
28-
"alias": {
29-
"react": "preact/compat",
30-
"react-dom/test-utils": "preact/test-utils",
31-
"react-dom": "preact/compat",
32-
"react/jsx-runtime": "preact/jsx-runtime"
33-
},
3430
"repository": {
3531
"type": "git",
3632
"url": "git+https://github.com/WhistlingZephyr/banger.git"
@@ -49,34 +45,50 @@
4945
},
5046
"homepage": "https://github.com/WhistlingZephyr/banger#readme",
5147
"devDependencies": {
52-
"@babel/core": "^7.20.2",
53-
"@commitlint/cli": "^17.2.0",
54-
"@commitlint/config-conventional": "^17.2.0",
48+
"@babel/core": "^7.20.7",
49+
"@commitlint/cli": "^17.3.0",
50+
"@commitlint/config-conventional": "^17.3.0",
51+
"@fontsource/inter": "^4.5.14",
5552
"@tsconfig/recommended": "^1.0.1",
56-
"@types/jest": "^29.2.2",
57-
"@types/node": "^18.11.9",
58-
"@types/react": "^18.0.25",
59-
"@types/react-dom": "^18.0.9",
60-
"@vitejs/plugin-react": "^2.2.0",
61-
"concurrently": "^7.5.0",
53+
"@types/file-saver": "^2.0.5",
54+
"@types/ms": "^0.7.31",
55+
"@types/node": "^18.11.17",
56+
"@types/react": "^18.0.26",
57+
"@types/react-dom": "^18.0.10",
58+
"@types/react-modal": "^3.13.1",
59+
"@vitejs/plugin-react": "^3.0.0",
60+
"@vitest/ui": "^0.26.2",
61+
"chokidar-cli": "^3.0.0",
62+
"concurrently": "^7.6.0",
6263
"conventional-github-releaser": "^3.1.5",
64+
"downshift": "^7.0.5",
6365
"env-cmd": "^10.1.0",
64-
"husky": "^8.0.1",
65-
"jest": "^29.2.1",
66-
"jest-webextension-mock": "^3.7.22",
67-
"lint-staged": "^13.0.3",
66+
"escape-string-regexp": "^5.0.0",
67+
"eslint-config-xo-react": "^0.27.0",
68+
"eslint-plugin-react": "^7.31.11",
69+
"eslint-plugin-react-hooks": "^4.6.0",
70+
"fast-cartesian": "^7.6.0",
71+
"file-saver": "^2.0.5",
72+
"gridjs": "^5.1.0",
73+
"gridjs-react": "^5.1.0",
74+
"husky": "^8.0.2",
75+
"lint-staged": "^13.1.0",
6876
"mkdirp": "^1.0.4",
77+
"ms": "^2.1.3",
6978
"react": "^18.2.0",
7079
"react-dom": "^18.2.0",
80+
"react-icons": "^4.7.1",
81+
"react-modal": "^3.16.1",
7182
"rimraf": "^3.0.2",
7283
"standard-version": "^9.5.0",
73-
"ts-jest": "^29.0.3",
74-
"typescript": "^4.8.4",
75-
"typescript-plugin-css-modules": "^3.4.0",
76-
"vite": "^3.2.3",
77-
"web-ext": "^7.3.1",
84+
"typescript": "^4.9.4",
85+
"typescript-plugin-css-modules": "^4.1.1",
86+
"use-file-picker": "^1.5.1",
87+
"vite": "^4.0.3",
88+
"vitest": "^0.26.2",
89+
"web-ext": "^7.4.0",
7890
"web-ext-types": "^3.2.1",
7991
"webpack": "^5.75.0",
80-
"xo": "^0.52.4"
92+
"xo": "^0.53.1"
8193
}
8294
}

0 commit comments

Comments
 (0)