This document contains instructions for setting up your local development environment and installing the dependencies required for contributing to the firefox-voice extension project.
Depending on your operating system the sections below outline the various installation steps, however in any case you need to have Firefox Nightly or Developer Edition installed. A release version, localized or unbranded version of Firefox will still suffice but some things may not work:
To get started with a Linux development environment, you would need to:
- Download the latest LTS version of NodeJs before running any of the provided npm commands.
- Download Firefox Nightly which is a pre-release version of Firefox that is updated every now and then just so you are developing and testing with the latest firefox features.
- Use
tar xjvf
to extract the binaries for FireFox Nightly into a location of your choice could be/opt/FireFoxNightly/
folder or just your download folder, wherever is fine. - Let firefox-voice know where you kept the binary (firefox) for FireFox Nightly typically by running
export FIREFOX=/path/to/FireFoxNightly/firefox
and using our example location would beexport FIREFOX=/opt/FireFoxNightly/firefox
. This creates a temporary export (environment variable) called FIREFOX for your current session.
You would have to run this everytime you have a new session so you may want to look at how to let the export stick permanently
On windows there are two options for installation. The first option can use virtually any version of windows which supports the latest LTS version of node (currently 12.16.1) and npm (currently 6.13.4). However, all node commands/scripts have to be run within git-bash (to provide support for unix commands). The second option is to use WSL which comes with windows 10 only, for persons who may prefer this alternative.
- Latest LTS version of NodeJS
- Git and Git-bash
- Firefox Nightly or Developer Edition
Before cloning the repo, using the terminal in Git-bash:
- Run
git config --global core.autocrlf false
to prevent git from automatically converting line endings from LF to CRLF - Run
npm config set script-shell "path\\to\\bash.exe"
. Point to the path where you have git-bash installed(using double backslashes). Example of path is"C:\\Program Files\\git\\bin\\bash.exe"
. This enables npm to run linux-like commands. - Fork and clone the repository
- To enable the npm scripts find your firefox installation, you need to create the environment variable
FIREFOX
. The easiest way to do this is to create the environment variable set to a normalized path using System properties->Advanced->Environment Variables. For example if the install path isC:\Program Files\Firefox Nightly\firefox.exe
then normalized path is/c/Program Files/Firefox Nightly/firefox.exe
. Alternatively, runsetx FIREFOX="normalized/path/to/firefox.exe"
. You can also set$PROFILE
to a directory where the profile information is kept (it defaults to./Profile/
). (Note: You may need to open a new terminal to detect the new environment variable.) - Now run
npm install
to install dependencies - Run
npm start
. This will launch a new Firefox browser with thefirefox-voice
extension installed.
- Latest LTS version of NodeJS
- Firefox Nightly or Developer Edition on WSL
If you are using Windows and wish to use WSL, you will need to setup Firefox Nightly or Developer on WSL before running firefox-voice
using the following steps:
- Download
firefox-nightly.tar.bz2
for Linux and move it to a folder of your choice e.g./opt
. - Extract it using
tar -xvjf firefox-*.tar.bz2
and move it to/opt/firefox/
. - Download
VcXsrv
on Windows and launch it with all default settings EXCEPT access control disabled. - At this point, the
DISPLAY
variable is not set, so you may run into issues running GUI apps from XServer. To fix this, runcat /etc/resolv.conf
to get the IP address of the nameserver, then runexport DISPLAY=IP_ADDRESS_OF_NAMESERVER_HERE:0
. You can also use this one-liner:export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
- Test Firefox Nightly by launching
./firefox
in the folder that you extracted thetar.bz2
; this should open up Firefox Nightly. - In the
firefox-voice
repo, export the variableFIREFOX
to point the script to your installation of firefox e.g.export FIREFOX=/opt/firefox/firefox
. - Now, running
npm start
should automatically startfirefox-nightly
, however the sound/microphone might not be working. - Download the PulseAudio binary for Windows.
- Extract the files to any location. You should see four folders named
bin
,etc
,lib
, andshare
. - Edit the configuration files in
etc
. Indefault.pa
, find the line starting with#load-module module-native-protocol-tcp
and change it toload-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
- In
daemon.conf
, find the line starting with; exit-idle-time = 20
and change it toexit-idle-time = -1
to turn off idle timer. - In admin Powershell, run
pulseaudio.exe
under thebin
folder, and keep this running. - Now, you will need to install PulseAudio for WSL. Uninstall any current versions of PulseAudio using
sudo apt-get purge pulseaudio
. - Run
sudo add-apt-repository ppa:therealkenc/wsl-pulseaudio
to add the PPA. - Update the sources using
sudo apt-get update
. - Install PulseAudio for WSL using
sudo apt install pulseaudio
. - In the same folder as
firefox-voices
, runexport PULSE_SERVER=tcp:IP_ADDRESS_OF_NAMESERVER_HERE
. This will allowfirefox-voices
to access the Windows sound system.
To get started with a macOS development environment, you would need to:
- Make sure you have the latest LTS version of NodeJs running any of the provided npm commands.
- Download and install Firefox Nightly which is a pre-release version of Firefox. Firefox Nightly is updated every now and then just so you are developing and testing with the latest features.
- Next, you fork the repository from mozilla firefox, and then clone the forked repo to your local system by running
git clone url to forked repo
on your terminal. - Open the repo in any IDE of your choice and run
npm install
, to install the dependencies. - Finally, run
npm start
to launch a new Firefox Nightly browser with the firefox-voice installed.