Skip to content

Commit 34566fe

Browse files
committed
Rewrite entire extension in Svelte + Vite
1 parent 0d42330 commit 34566fe

File tree

274 files changed

+16950
-2631
lines changed

Some content is hidden

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

274 files changed

+16950
-2631
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
/web-ext-artifacts/
1+
/dist
2+
/node_modules
3+
.DS_Store
4+
/web-ext-artifacts
5+
/.idea

DEVELOP.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Development notes
2+
## IDEA/WebStorm
3+
`Use file extension` in the Code Styles options should be `never`.

README.md

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,64 @@
1-
# Profile Switcher for Firefox
1+
# firefox-profile-switcher
22

3-
Create, edit, delete and switch between browser profiles seamlessly in Firefox. Inspired by Chrome's profile switcher.
3+
This template should help get you started developing a svelte web extension in Vite.
44

5-
## Installation
5+
## Usage Notes
66

7-
[![Screenshot of popup](branding/amo_button.png)](https://addons.mozilla.org/en-CA/firefox/addon/profile-switcher/)
7+
The extension manifest is defined in `src/manifest.js` and used by `@samrum/vite-plugin-web-extension` in the vite config.
88

9-
The extension requires installation of extra software. You will be prompted to install the software after you have installed the extension.
9+
Background, content scripts, options, and popup entry points exist in the `src/entries` directory.
1010

11-
## Features
11+
Content scripts are rendered by `src/entries/contentScript/renderContent.js` which renders content within a ShadowRoot
12+
and handles style injection for HMR and build modes.
1213

13-
- Create, edit, delete and change your default profile
14-
- Switch between profiles in the toolbar
15-
- Choose from a variety of different profile pictures including both the current pictures included with Chrome along with the old pictures that are no longer available in Chrome.
14+
Otherwise, the project functions just like a regular Vite project.
1615

17-
## Screenshots
1816

19-
Switch to another browser profile with 2 clicks:
2017

21-
![Screenshot of popup](branding/popup_screenshot.png)
2218

23-
Create, edit, delete and change your default profile:
2419

25-
![Screenshot of popup](branding/manager_home_screenshot.png)
20+
Refer to [@samrum/vite-plugin-web-extension](https://github.com/samrum/vite-plugin-web-extension) for more usage notes.
2621

27-
## How does it work?
22+
## Customize configuration
2823

29-
Browser extensions do not have the ability to manage browser profiles. Instead the extension talks to a native program which has the ability to manipulate the browser folders (source code here: https://github.com/null-dev/firefox-profile-switcher-connector).
24+
See [Vite Configuration Reference](https://vitejs.dev/config/).
3025

31-
## Credits
26+
## Project Setup
3227

33-
Thanks to the authors of the Chromium project for creating the beautiful profile images.
28+
```sh
29+
npm install
30+
```
3431

35-
Thanks to Mozilla for making this great browser and for creating the design language that this extension uses.
32+
## Commands
33+
### Build
34+
#### Development, HMR
3635

37-
## License
36+
Hot Module Reloading is used to load changes inline without requiring extension rebuilds and extension/page reloads
37+
```sh
38+
npm run dev
39+
```
3840

39-
The extension and native program are licensed under GPL v3.
41+
#### Development, Watch
4042

41-
The profile pictures were created by the Chromium authors and are licensed under the Chromium license, see: https://github.com/null-dev/firefox-profile-switcher/blob/master/img/avatars/LICENSE.txt.
43+
Rebuilds extension on file changes. Requires a reload of the extension (and page reload if using content scripts)
44+
```sh
45+
npm run watch
46+
```
4247

43-
Some of the CSS used in this extension were developed by Mozilla and are licensed under MPL v2.
48+
#### Production
49+
50+
Minifies and optimizes extension build
51+
```sh
52+
npm run build
53+
```
54+
55+
### Load extension in browser
56+
57+
Loads the contents of the dist directory into the specified browser
58+
```sh
59+
npm run serve:chrome
60+
```
61+
62+
```sh
63+
npm run serve:firefox
64+
```

img/avatars/avatarlist.txt

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

img/avatars/gen-avatarlist.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

js/background/background.js

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

js/background/index.html

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

0 commit comments

Comments
 (0)