Requirements
February 14, 2020 ยท View on GitHub
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
.nvmrcfile from navigation-extension you can runnvm useornvm install, which will automatically install and enable the recommended Node.js version.
Contribution Workflow
To setup your environment:
- Fork the repository
- Get a local copy of it:
git clone ... - Add the
upstreamrepository as a remote:git remote add upstream git@github.com: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 installagain from time to time ifpackage.jsonchanged)git checkout -b <my-feature-branch>(create a new local branch from the latestupstream/masterrevision)
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 upstreamgit rebase upstream/mastergit 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
Installing dependencies can be done using npm:
npm ci
Building the Extension
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
Testing
Please see testing guidelines.
Contributions
Please use the configuration from editorconfig and check the Airbnb Javascript Style Guide which we use in this project.
Troubleshooting
- Make sure you have latest npm version installed
- Make sure you remove node_modules folder
rm -rf node_modulesbefore runningnpm install - Make sure you have python2 binary executable. On Mac it can be solved by running
brew install python2