Table of Contents

Namespace Nite.Configuration

Classes

NiteDirectories

Where Nite keeps per-user files, following the XDG Base Directory specification:

  • Config: settings people edit (config.json).
  • Cache: anything re-downloadable (tarballs, esbuild, registry metadata); safe to delete.
  • Data and State: reserved for things that are neither.

Each can be overridden with NITE_CONFIG_DIR, NITE_CACHE_DIR, NITE_DATA_DIR or NITE_STATE_DIR; otherwise XDG_*_HOME applies on every OS when set (to an absolute path, as the spec requires). Defaults are the XDG ones on Linux and macOS (developers expect ~/.config from a CLI), and the native AppData folders on Windows.

NiteSettings

Effective settings, merged from (highest first):

  1. NITE_* environment variables (NITE_REGISTRY)
  2. the project's nite.json (registry)
  3. the project's .npmrc
  4. the user's config.json in the config directory
  5. the user's ~/.npmrc (or $NPM_CONFIG_USERCONFIG)
  6. built-in defaults

Credentials only come from .npmrc files, so tokens stay where npm users already keep them.

Npmrc

Reads .npmrc files: key=value lines, #/; comments, optional quotes and \({VAR}</code> expansion (<code>\){VAR?} for "empty if unset"), as npm does. Nite only acts on the registry and credential keys; everything else is ignored.

RegistrySettings

Which registry serves which package, and which credentials go with which registry. Credentials follow npm's "nerf dart" keys (//npm.example.com/path/:_authToken=…): a request only carries a credential when its URL is under that host and path, so a token never leaks to another host (a tarball on a CDN, say).

SettingValue

A setting's effective value and where it came from (a file path, an environment variable, or "default").