Price Tracker is a Firefox extension that spots price drops on things you’re interested in.
Перейти к файлу
Bianca Danforth 349787b8d5
Collapse privacy extra keys into a single key
Event Telemetry [limits the max number of extra keys](https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/collection/events.html#limits) for an event to 10. In the fix for Issue #185, where three new privacy-related extra keys were added to every telemetry event, the number of extra keys for the 'open_external_page' event went to 11, which causes event telemetry to fail at the registration step.

This patch collapses these 3 privacy keys into a single key that points to a stringified JSON object.
2018-11-06 13:04:56 -08:00
.circleci Fix add-on filename in Circle config as well. 2018-10-25 22:38:55 -07:00
bin Move webpack config to subdirectory. 2018-10-22 15:14:16 -07:00
docs Collapse privacy extra keys into a single key 2018-11-06 13:04:56 -08:00
src Collapse privacy extra keys into a single key 2018-11-06 13:04:56 -08:00
webpack Move webpack config to subdirectory. 2018-10-22 15:14:16 -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 Move webpack config to subdirectory. 2018-10-22 15:14:16 -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 Update requests. 2018-10-30 12:25:45 -07:00
Pipfile.lock Update requests. 2018-10-30 12:25:45 -07:00
README.md Document how to release a new version of the add-on. 2018-11-05 13:26:26 -08:00
package-lock.json 9.0.0 2018-11-05 10:58:33 -08:00
package.json Address review comments 2018-11-05 16:14:59 -08:00
web-ext-config.js Update add-on ID in preference names. 2018-10-25 21:53:38 -07:00

README.md

Price Wise

Price Wise is a Firefox extension that tracks price changes to help you find the best time to buy.

Developer Setup

Prerequisites:

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

    git clone https://github.com/mozilla/price-wise.git
    cd price-wise
    
  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 price-wise: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)

Releasing a New Version

Price Wise bumps the major version number for every release, similar to Firefox. Releases are created by tagging a commit that bumps the version number and pushing that tag to the repo. This triggers CircleCI automation that packages, tests, and uploads the new version to the Test Pilot S3 bucket.

It is strongly recommended that developers creating releases configure Git to sign their commits and tags.

To create a new release of Price Wise:

  1. Increment the version number in package.json, create a new commit on the master branch with this change, and create a new git tag pointing to the commit with a name of the form v1.0.0, where 1.0.0 is the new version number.

    npm ships with a command that can perform these steps for you automatically:

    npm version major
    
  2. Push the updated master branch and the new tag to the remote for the Mozilla Price Wise repository (named origin in the example below):

    git push origin master
    git push origin v1.0.0
    

You can follow along with the build and upload progress for the new release on the CircleCI dashboard. Once the build finishes, the new version should be available immediately at https://testpilot.firefox.com/files/shopping-testpilot@mozilla.org/latest.

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.