@guardian/ophan-tracker-js

2.1.1 • Public • Published

Ophan Tracker JS

Browser JavaScript client for Ophan.

Install

$ npm install ophan-tracker-js

Contribute

Proxy tracker-js:

  1. Install dependencies

    $ brew install lighttpd
    .../ophan/tracker-js $ npm install
    
  2. In another terminal window:

    .../ophan/tracker-js $ lighttpd -f lighttpd.conf -D
    
  3. Install FoxyProxy (https://getfoxyproxy.org/downloads/) in your browser and create a rule that forces j.ophan.co.uk to localhost 8000. (For me FoxyProxy needed a few switches on and off before it decided to start talking to lighttpd.)

  4. In another terminal window, start a server that is running the Guardian frontend

  5. Navigate to where you are running the Guardian locally (e.g. https://localhost:9000/uk)

  6. Ensure FoxyProxy is enabled

  7. Develop with pleasure

Publish

Two formats for release

When you make a change to Tracker JS, you must release on both these systems:

NPM

We use changesets for automated publishing of the NPM package:

  1. Add a changeset, run the following command and follow the instructions

    .../ophan/tracker-js $ npx changeset
    
  2. When you raise a PR, the changeset bot won’t correctly see that you have included a changeset – it only checks for the .changesets folder in the root of the repository, whereas we have it in a subdirectory. Don’t worry.

  3. When the PR is merged, the changesets github action will create a new PR, example here. On merging this generated PR, the action will publish to NPM. (This checks the subdirectory correctly.)

S3 Bucket
Rollup

The generated files from Rollup are only used for publishing to the CDN to use SystemJS / AMD

Example Usage

You can see example usage of the library on theguardian.com here

/@guardian/ophan-tracker-js/

    Package Sidebar

    Install

    npm i @guardian/ophan-tracker-js

    Weekly Downloads

    1,377

    Version

    2.1.1

    License

    none

    Unpacked Size

    50.3 kB

    Total Files

    30

    Last publish

    Collaborators

    • joecowton1
    • guardian-developers
    • akash1810
    • reetta
    • sndrs
    • mxdvl