npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@guardian/commercial-bundle

v5.5.0

Published

The bundle that provides the advertising logic for the https://theguardian.com

Downloads

133

Readme

@guardian/commercial-bundle

This package contains the code for the commercial bundle that is loaded on all pages on theguardian.com.

Installation

To install the package, run yarn add @guardian/commercial-bundle.

Development

Requirements

  • Node
    • see .nvmrc for the current version
    • the version manager fnm is recommended with additional configuration to automatically switch on changing directory
  • Yarn

Setup

To install dependencies, run yarn.

To develop locally, run yarn serve to start a local server. This will watch for changes and rebuild the bundle. Serving it at http://localhost:3031.

Testing

To run the unit tests, run yarn test.

To run the integration tests, switch to the e2e workspace to run yarn cypress:open or yarn cypress:run to run cypress integration tests.

Releasing

Changes are automatically released to NPM.

The main branch on GitHub is analysed by semantic-release after every push.

If a commit message follows the conventional commit format, semantic-release can determine what types of changes are included in that commit.

If necessary, it will then automatically release a new, semver-compliant version of the package to NPM.

You can then bump the version of the package in Frontend, to use the new version.

Pull requests

Try to write PR titles in the conventional commit format, and squash and merge when merging. That way your PR will trigger a release when you merge it (if necessary).

Working locally with DCR

To use the bundle locally with DCR, run COMMERCIAL_BUNDLE_URL=http://localhost:3031/graun.standalone.commercial.js PORT=3030 make dev in the DCR directory.

DCR will then use the local bundle instead of the one from PROD/CODE.

Working locally with Frontend

To use the bundle locally with Frontend, you can override your default Frontend configuration (see the Frontend docs for more detail on this) to point to a local commercial dev server. For example, save the following in ~/.gu/frontend.conf:

devOverrides {
    commercial.overrideCommercialBundleUrl="http://localhost:3031/graun.standalone.commercial.js"
}

Frontend will then use the local bundle instead of the one from PROD/CODE. Frontend will pass the local bundle URL along to DCR, so you don't have to override there if you've done it in Frontend.

Linking

To use the production bundle locally with Frontend, run yarn link in the bundle directory. Then run yarn link @guardian/commercial-bundle in the frontend directory. Finally, start the frontend server as usual.

Frontend will then use the local bundle instead of the one from PROD/CODE.

Testing on CODE

To test the bundle on CODE, create a PR, add the [beta] @guardian/commercial-bundle label, this will release a beta version of the bundle to NPM, the exact version will be commented on your PR.

On a branch on frontend you can update the version of the bundle to the beta version and deploy to CODE to test.