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

@jungvonmatt/contentful-config

v4.1.2

Published

[![NPM version][npm-image]][npm-url]

Readme

NPM version

JvM Contentful config loader

Tool for loading and managing Contentful configurations with support for environment variables and interactive prompts.
Based on @jungvonmatt/config-loader and c12

Getting started

Install

npm install @jungvonmatt/contentful-config

Usage

Basic Example

import { loadContentfulConfig } from '@jungvonmatt/contentful-config';

// Load configuration from multiple sources:
// - contentful-cli configuration file (~/.contentfulrc.json)
// - environment variables (CONTENTFUL_SPACE_ID, etc.)
// - project configuration files (myapp.config.js, .myapprc, etc.)
const { config } = await loadContentfulConfig('myapp');

console.log(config.spaceId); // Contentful Space ID
console.log(config.environmentId); // Contentful Environment ID (defaults to 'master')
console.log(config.accessToken); // Content Delivery API Token
console.log(config.previewAccessToken); // Content Preview API Token
console.log(config.managementToken); // Content Management API Token

With Required Values

import { loadContentfulConfig } from '@jungvonmatt/contentful-config';

// If required values are not found in configuration files or
// environment variables, an interactive prompt will be displayed
const { config } = await loadContentfulConfig('myapp', {
  required: ['spaceId', 'accessToken']
});

// The configuration now contains all required values,
// either from existing sources or user input

CLI

The package includes a CLI tool to generate .env-compatible configuration files.

Usage

contentful-config [options]

Options

| Option | Description | | --- | --- | | -n, --name <name> | Config name (default: contentful) | | -o, --output <file> | Write output to a file instead of stdout | | -r, --required <keys> | Required config keys, comma-separated or repeated (default: spaceId,environmentId,accessToken,previewAccessToken) | | -h, --help | Show help message |

Examples

# Print .env config to stdout
contentful-config

# Write to a .env file (merges with existing content)
contentful-config -o .env

# Use a custom config name
contentful-config -n myapp -o .env

# Specify custom required keys
contentful-config -r spaceId,accessToken

# Or repeat the flag
contentful-config -r spaceId -r accessToken -r environmentId

Behavior

  • Login check: If no Contentful management token is found, the CLI automatically runs contentful login to authenticate.
  • Interactive prompts: All required keys are prompted interactively, with existing values pre-filled as defaults.
  • File merging: When using -o, existing file content is preserved. Matching keys are updated in place, new keys are appended. Comments and unrelated entries remain untouched.
  • Output: The following environment variables are generated:

| Config Key | Environment Variable | | --- | --- | | spaceId | CONTENTFUL_SPACE_ID | | environmentId | CONTENTFUL_ENVIRONMENT_ID | | accessToken | CONTENTFUL_DELIVERY_ACCESS_TOKEN | | previewAccessToken | CONTENTFUL_PREVIEW_ACCESS_TOKEN | | host | CONTENTFUL_HOST |

Note: The management token is intentionally excluded from the output as it is read from the Contentful CLI config file.