Skip to content

Latest commit

 

History

History
100 lines (70 loc) · 4.3 KB

developer-notes.md

File metadata and controls

100 lines (70 loc) · 4.3 KB

Developer Notes for IPFS Companion

Table of Contents

Build from Sources

You will need NodeJS and Firefox. Make sure npm and firefox are in your PATH.

It may be a good idea to use yarn instead of npm. We provide yarn.lock if you choose to do so.

Installing Dependencies

To install all dependencies into node_modules directory, execute:

npm install

Build and Run in Firefox

One stop command to build, test and deploy add-on to Firefox:

npm start        # all-in-one

To do each step manually:

npm run build    # build runs bundle:firefox at the end, so manifest will be ok
npm run test     # test suite
npm run firefox  # spawn new Firefox

It is also possible to load extension manually: enter about:debugging in the URL bar then click "Load Temporary Add-on" and point it at add-on/manifest.json

Build and Manual Install in Chromium

First, build it manually:

npm run build bundle:chromium # last part is important: it overwrites manifest

Then open up chrome://extensions in Chromium-based browser, enable "Developer mode", click "Load unpacked extension..." and point it at add-on

Chrome "unpacked extension" Firefox "temporary add on"
installing ipfs-companion as an unpacked extension in chrome installing ipfs-companion as a temporary add on in firefox

Firefox for Android

See docs/firefox-for-android.md

Useful Tasks

Each npm task can be run separately, but for most of time dev-build, test and fix:lint are all you need.

  • npm install -- install all NPM dependencies
  • npm run build -- build the add-on (copy external libraries, create .zip bundles for Chrome and Firefox)
  • npm run bundle:chromium -- overwrites manifest and packages a generic, Chromium-compatible version
  • npm run bundle:brave -- overwrites manifest and packages a Brave-compatible version requesting access to chrome.sockets
  • npm run bundle:firefox -- overwrites manifest and packages a Firefox-compatible version
  • npm run build:rename-artifacts -- renames artifacts to include runtimes in filenames
  • npm run ci -- runs tests and build (with frozen yarn.lock)
  • npm test -- run entire test suite
  • npm run lint -- read-only check for potential syntax problems (run all linters)
  • npm run fix:lint -- try to fix simple syntax problems (run standard with --fix etc)
  • npm run lint:standard -- run standard linter (IPFS JavaScript projects default to standard code style)
  • npm run lint:web-ext -- run addons-linter shipped with web-ext tool
  • npm run firefox -- run as temporary add-on in Firefox
  • npm run chromium -- run as temporary add-on in Chromium
  • npm run get-firefox-nightly -- fetch latest Firefox Nightly to ./firefox/
  • npm run firefox:beta:add -- --update-link "https://host/path/to/file.xpi" file.xpi -- add a manifest entry for new self-hosted Beta for Firefox

Release build shortcuts:

  • npm run dev-build -- all-in-one: fast dependency install, build with yarn (updates yarn.lock if needed)
  • npm run beta-build -- reproducible beta build in docker with frozen yarn.lock
  • npm run release-build -- reproducible release build in docker with frozen yarn.lock

Tips