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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reuters-graphics/graphics-atlas-client

v1.0.0

Published

Readme

graphics-atlas-client

npm version

Global country metadata (ISO 3166) — names, translations (8 languages), ISO codes, [lon, lat] centroids, population, GDP and income group — plus TopoJSON country polygons and border lines at three detail levels. Zero runtime dependencies, dual ESM + CommonJS.

📖 Full documentation & interactive explorer →

Install

pnpm add @reuters-graphics/graphics-atlas-client

Quick start

Metadata

import AtlasMetadataClient from '@reuters-graphics/graphics-atlas-client';

const client = new AtlasMetadataClient();

client.getCountry('DE');              // by ISO alpha-2/alpha-3/numeric, name or slug
client.getRegion('Europe');
client.getSubregion('Western Europe');
client.getRegionByCountry('France');
client.getCountriesByRegion('Africa');

client.countries;                     // all 249
client.regions;                       // 6 UN regions
client.subregions;                    // 22 subregions

Lookups are case-insensitive; not-found returns null. Each country carries translations, abbreviations, coordinates ([lon, lat]) and a dataProfile (population, GDP, income group). Full reference: metadata docs.

Only ISO 3166-assigned countries are included — so Kosovo, Northern Cyprus and the Channel Islands are not.

Maps (TopoJSON)

Country polygons and border lines at low / medium / high detail. Fetch from the CDN at runtime, or import a file directly for a tree-shakeable local bundle.

// Fetch on demand — nothing bundled
await client.fetchCountryTopojson('germany', 'high');
await client.fetchGlobalTopojson('low');
await client.fetchRegionLines('Europe');   // border lines carry a `disputed` flag

// Or import one file — bundler ships only this one
import de from '@reuters-graphics/graphics-atlas-client/topojson/polygons/high/DE.json';

Full file layout and both approaches: TopoJSON docs.

Flags

Flags come from flag-icons; the client only builds URLs and class names — nothing is bundled.

const { svg, className } = client.getCountryFlag('DE');
// svg['4x3'] → CDN SVG URL;  className → 'fi fi-de' (needs flag-icons CSS)

client.getFlag('scotland');   // non-country flags (eu, un, gb-sct, …) resolve too

Returns null for unrecognized input. flag-icons is an optional peer dependency — only needed for the CSS-class approach.

Contributing

Development uses Node 22 (.nvmrc) and pnpm (via Corepack). CI runs on every push.

nvm use            # Node 22
corepack enable    # pinned pnpm
pnpm install
pnpm build         # bundle the client (CJS + ESM)
pnpm lint
pnpm test          # unit tests (network-free)

The published package targets Node >=18; Node 22 is the dev/CI baseline.

Regenerating data

pnpm build:metadata   # rebuild lib/data/metadata.json (centroids from data/centroids.csv)
pnpm build:maps       # rebuild topojson/ from country-borders (needs authenticated `gh`)

Map generation lives in bin/buildMaps/: it downloads the pinned country-borders GeoJSON (a private repo, so gh must be authenticated), then cuts and quantizes polygons + lines at three scales into topojson/. The source commit is pinned in input/.country-borders-sha for reproducible builds; pass { force: true } to fetchInput to re-pin to the latest country-borders. topojson/ is regenerated fresh at publish (prepublishOnly) and is not committed to git.

Docs site

An Astro Starlight site in docs/, deployed to GitHub Pages on push to master.

pnpm docs:dev      # run locally — served under /graphics-atlas-client/
pnpm docs:build    # build client + docs

Data sources

License

MIT