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

sfcc-env-switcher

v1.0.1

Published

CLI tool to switch Salesforce Commerce Cloud (SFCC/Demandware) environment files for the Prophet VS Code plugin

Readme

sfcc-env-switcher

An interactive CLI tool for switching Salesforce Commerce Cloud (SFCC / Demandware) environment connection files. Designed to work seamlessly with the Prophet Debugger VS Code extension.

Why

Prophet reads its connection settings from a dw.json file in your repository root. When you work across multiple SFCC instances (e.g. dev-us, dev-jp, production-us), you'd normally edit dw.json by hand every time you switch. This tool replaces that with an interactive menu — select an environment, and dw.json is updated instantly. The previously active environment's changes are backed up automatically before switching.

Prerequisites

  • Node.js >= 14.0.0
  • Prophet Debugger VS Code extension (or any tool that reads dw.json)

Recommended Folder Structure

Keep the switcher in a separate folder next to your SFCC repository:

parent/
├── your-sfcc-repo/       ← SFCC project (contains dw.json)
└── env-switcher/         ← switcher lives here
    ├── Config/
    │   └── default.json
    ├── EnvFiles/
    │   ├── dev-us.json
    │   ├── dev-jp.json
    │   └── production-us.json
    ├── package.json
    └── node_modules/

Installation

1. Create the switcher folder

mkdir env-switcher
cd env-switcher

2. Install the package

npm install sfcc-env-switcher

3. Scaffold the config structure

npx sfcc-env-switcher init

This copies the template Config/ and EnvFiles/ directories into your current folder. If they already exist, you will be prompted before anything is overwritten.

4. Edit the config files

Open Config/default.json and point it at your repository:

{
    "repo": "../your-sfcc-repo",
    "target": "dw.json",
    "envFiles": "./EnvFiles"
}

| Field | Description | |------------|-------------------------------------------------------------------------| | repo | Relative path from the config file to your SFCC repository root | | target | Path to the dw.json file inside the repo (relative to repo) | | envFiles | Path to the folder containing your environment files (relative to CWD) |

5. Edit the environment files

Inside EnvFiles/, each .json file represents one environment. The filename becomes the name shown in the menu. Fill in the real values for each instance:

{
    "cartridgesPath": "app_storefront_base:modules:",
    "version": "version1",
    "hostname": "dev-us-short.demandware.net",
    "username": "[email protected]",
    "password": "your_bm_password"
}

These files use the same format as Prophet's dw.json. The easiest starting point is to copy your current working dw.json and adjust per environment.

Usage

Run from the env-switcher folder:

npx sfcc-env-switcher

Or add a start script to the local package.json and use npm start:

{
  "scripts": {
    "start": "sfcc-env-switcher"
  }
}

You will see an interactive menu listing all configured environments, with the currently active one marked:

? Select Environment
> dev-us (active)
  dev-jp
  production-us
  Exit

Select an environment and press Enter. The tool will:

  1. Back up the current dw.json contents into the previously active environment file
  2. Copy the selected environment file into dw.json

Prophet will pick up the new connection automatically (you may need to restart the uploader).

How Active Environment is Detected

The tool compares the hostname field in dw.json against each environment file. The environment whose hostname matches is marked as active.

License

MIT