Node.js LTS (currently v12) is recommended.
To manage multiple Node.js versions, we recommend using nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
- Restart your terminal
- Ensure that nvm was installed correctly with
nvm --version
- Thanks to the
.nvmrc
file from navigation-extension you can runnvm use
ornvm install
, which will automatically install and enable the recommended Node.js version.
To setup your environment:
- Fork the repository
- Get a local copy of it:
git clone ...
- Add the
upstream
repository as a remote:git remote add upstream [email protected]:cliqz/navigation-extension.git
When you are ready to contribute:
git fetch upstream
(get latest changes fromupstream
)git checkout upstream/master
(you might need to runnpm install
again from time to time ifpackage.json
changed)git checkout -b <my-feature-branch>
(create a new local branch from the latestupstream/master
revision)
Note that it is not necessary to have your own master
branch. Actually
having a master
branch on your fork is not needed, as you can always take the
latest changes from upstream/master
.
Do some changes, run tests locally (check the following sections for more details) and then create a pull request once you are ready.
If changes are pushed upstream while you are working on your changes, it might
be necessary to rebase your branch against master
. To do so:
git fetch upstream
git rebase upstream/master
git push origin <my-feature-branch> --force-with-lease
(you need to force push because rebase will re-write your history)
This will make sure that all commits from upstream appear before your own local changes in the git history.
Installing dependencies can be done using npm
:
npm ci
To build the extension and load it into Firefox:
./fern.js serve ./configs/<CONFIG>
The build artifacts can be found in the ./build
folder. It is also possible to
only build the extension without serving it in a browser with:
./fern.js build ./configs/<CONFIG>
Which accepts the same arguments as the serve
sub-command.
You can change flavors by specifying a configuration file stored
under the ./configs
folder. Passing this argument is mandatory.
Examples:
./fern.js build ./configs/amo.js
./fern.js serve ./configs/browser.js
Please see testing guidelines.
Please use the configuration from editorconfig and check the Airbnb Javascript Style Guide which we use in this project.
- Make sure you have latest npm version installed
- Make sure you remove node_modules folder
rm -rf node_modules
before runningnpm install
- Make sure you have python2 binary executable. On Mac it can be solved by running
brew install python2