Skip to content

Commit a1eb50f

Browse files
authored
Merge pull request #1853 from macrogreg/docs-for-win-dev
Add ReadMe sections on Windows and on running browser extension tests locally.
2 parents fa39618 + ebe91b4 commit a1eb50f

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,63 @@ Run the following to automatically compile changes as you make them:
129129

130130
- `npm run build-release`
131131

132+
#### Windows-specific considerations
133+
134+
Follow the above general guidance on setting up a dev environment.
135+
There are Windows-specific versions of some npm scripts:
136+
- build: `npm run build-win`
137+
- build-release: `npm run build-release-win`
138+
- watch: `watch-win`
139+
140+
When building for the first time you may get an error about `gulp` not being found.
141+
You can install gulp globally on your system by executing `npm install -g gulp` from your repo root.
142+
It is recommended that you do this proactively after executing `npm install` in the repo root for the first time.
143+
144+
#### Running the browser extension and corresponding tests locally
145+
146+
- Build the browser extension:
147+
`npm run build-release`
148+
(`npm run build-release-win` if you use Windows)
149+
150+
- After a successful build, the extension package will be found in:
151+
`RepoRoot/builds/`
152+
153+
- The following steps use _Firefox_ as an example; other browsers work similarly.
154+
The Firefox extension package is a file with an `.xpi`-extension. It is a simple archive. To modify it, you can rename it to `.zip`, make the changes, and then rename it back to `.xpi`. Many archive-related tools know this and allow you to work with the `.xpi`-file directly (e.g. [Total Commander](https://www.ghisler.com/download.htm)).
155+
156+
- Enable the extension package for local testing:
157+
By default, tests are not included into the release archive. To run tests in your local browser, copy the file
158+
`RepoRoot/dist/js/test.js`
159+
into the release package, so that it is located at
160+
`FloccusPackage.xpi/dist/js/test.js`
161+
162+
- Open Firefox using a dedicated test-profile:
163+
**If you use your main profile for testing, the test scripts will likely destroy your existing bookmarks and open tabs!**
164+
To interact with profiles, go to this address:
165+
`about:profiles`
166+
167+
- Load the extension:
168+
In the a dedicated Firefox profile window, go to
169+
`about:debugging`
170+
Select "This Firefox", and then under "Temporary Extensions", select "Load Temporary Add-on...". Then select the `.xpi`-file you prepared earlier.
171+
(Remember to unload the extension if you need to modify/rebuild the extension package.)
172+
173+
- The extension is now loaded. You can access it via the browser's extensions menu.
174+
175+
- Run tests:
176+
After loading the extension, click on "Manifest URL". It will open a new tab with the URL
177+
`moz-extension://SomeGuid/manifest.json`
178+
Modify the URL to read
179+
`moz-extension://SomeGuid/dist/html/test.html`
180+
, keeping the same GUID and press enter. The test run should start automatically.
181+
182+
- Debug or pause tests:
183+
Press `F12` to open developer tools.
184+
On the "Debugger" tab, you can pause the execution, set breakpoints and step through the code.
185+
186+
Happy developing and thank you for your contributions!
187+
188+
132189
## Backers
133190

134191
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/floccus#backer)]

0 commit comments

Comments
 (0)