Price Tracker is a Firefox extension that spots price drops on things you’re interested in.
Перейти к файлу
Bianca Danforth 8d3a7e8030 Fix #134: Add METRICS.md and initial telemetry setup
* Adds METRICS.md document in a new 'docs' subfolder.
* Adds 'telemetry.js' background script which registers all events and provides a wrapper method to record events.
  * The event 'send_system_notice' was originally 'send_system_notification', however, that exceeded the [string length limit](https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/collection/events.html#limits) imposed by Event Telemetry.
  * There is no need to unregister the events, as the events are only registered for the duration of the [current Firefox session](https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/core/nsITelemetry.idl#484).

Note: This PR does not actually record any events. That will happen in subsequent PRs. For the setup here, I did confirm that I can successfully records events in 'about:telemetry#events-tab' once 'browser.telemetry.recordEvent' is called. This can be confirmed by adding `telemetry.recordEvent('badge_toolbar_button', 'toolbar_button', null, {badge_type: 'add'});` after `telemetry.init()` in './src/background/index.js'.
2018-10-15 13:27:41 -07:00
.circleci Fix #28: Add Firefox/Marionette/Tape-based test suite. 2018-07-23 18:41:11 -07:00
bin Implement Redux-based storage, backend for saving products and tracking prices. 2018-08-09 14:40:02 -07:00
docs Fix #134: Add METRICS.md and initial telemetry setup 2018-10-15 13:27:41 -07:00
src Fix #134: Add METRICS.md and initial telemetry setup 2018-10-15 13:27:41 -07:00
.babelrc Implement Redux-based storage, backend for saving products and tracking prices. 2018-08-09 14:40:02 -07:00
.eslintignore Add webpack as a build tool. 2018-07-06 10:04:32 -07:00
.eslintrc.json #56: Detect and store price alerts, and show a notificaiton. 2018-08-29 18:02:57 -07:00
.gitignore #36: Update rules for better accuracy. 2018-08-24 14:59:17 -07:00
.stylelintrc.json Fix #99: Replace product card in empty state with button. 2018-09-21 10:39:46 -07:00
LICENSE Add basic scaffolding for a sidebar extension, README, etc. 2018-06-29 15:44:40 -07:00
Pipfile Fix #28: Add Firefox/Marionette/Tape-based test suite. 2018-07-23 18:41:11 -07:00
Pipfile.lock Fix #28: Add Firefox/Marionette/Tape-based test suite. 2018-07-23 18:41:11 -07:00
README.md Review feedback. 2018-08-29 17:40:44 -07:00
package-lock.json Replace complex ordering method with lodash helper. 2018-10-08 16:22:22 -07:00
package.json Replace complex ordering method with lodash helper. 2018-10-08 16:22:22 -07:00
web-ext-config.js Bump up price update intervals during development. 2018-09-28 14:43:56 -07:00
webpack.config.js Mild refactor of the extraction module. 2018-10-10 10:27:34 -07:00
webpack.config.test.js Fix #28: Add Firefox/Marionette/Tape-based test suite. 2018-07-23 18:41:11 -07:00

README.md

Commerce WebExtension

This repo contains the WebExtension for the Commerce project.

Developer Setup

Prerequisites:

  • A recent version of Node.js and NPM
  1. Clone the repository:

    git clone https://github.com/mozilla/webext-commerce.git
    cd webext-commerce
    
  2. Install dependencies:

    npm install
    
  3. Build the extension:

    npm run build
    
  4. Run the built extension in a test browser:

    npm start
    

Running Tests

Automated tests are run in a Firefox browser instance using Marionette. We use the Python client for Marionette since there is no up-to-date JavaScript client.

To set up your environment for running the tests, you must have:

  • A Firefox binary. On MacOS, this can be found within the .app folder at Firefox.app/Contents/MacOS/firefox.
  • Python 2.7
  • Pipenv

With these installed, you can set up the test suite:

  1. Install Python dependencies:

    pipenv install
    
  2. Save the path to your Firefox binary with npm:

    npm config set webext-commerce:firefox_bin <PATH_TO_FIREFOX_BINARY>
    

After this, you can run pipenv run test to run the automated test suite.

Scripts

Command Description
npm start Launch Firefox with the extension temporarily installed
npm run lint Run linting checks
npm run build Compile source files with Webpack
npm run watch Watch for changes and rebuild
npm run package Package the extension into an XPI file
pipenv run test Run test suite (See "Running Tests" for setup)

Code Organization

  • src/background contains the background scripts that trigger UI elements (such as the page action) and periodically check for price updates.
  • src/browser_action contains the toolbar popup for managing the list of currently-tracked products and tracking new products.
  • src/extraction contains the content scripts that extract product information from product web pages.
  • src/state contains the Redux-based code for managing global extension state.
  • src/tests contains the automated test suite.

Data Storage

Global state for the add-on is managed via Redux. Any time the data is changed, it is persisted to the add-on local storage.

Reducers, action creators, etc. are organized into ducks inside the src/state directory.

License

The Commerce WebExtension is licensed under the MPL v2.0. See LICENSE for details.