Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created February 13, 2020 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/8917bdd1ca64ce1bc8c592dfb39a0760 to your computer and use it in GitHub Desktop.
Save isaacs/8917bdd1ca64ce1bc8c592dfb39a0760 to your computer and use it in GitHub Desktop.

// Configs defined as npm config fields

//registry.npmjs.org/:_authToken=<uuid> the auth token to send to the registry. Not sure what this should look like on the conf object?

metrics-registry => metricsRegistry send-metrics = false registry = "https://registry.npmjs.org/" scope user-agent userAgent

// scoped registries @npm:registry = "https://registry.internal.npmjs.com/"

// publish access for scoped packages access

always-auth alwaysAuth audit audit-level auditLevel auth-type authType before browser

ca (certificate authority cert string) cafile = ca file instead of string cert = string, client certficate for SSL key = string, client key for SSL

cache String ~/.npm

// options passed to lockfile cache-lock-retries = 10 cache-lock-stale = 60000 cache-lock-wait = 10000

cache-max = DEPRECATED, set preferOnline if a small number cache-min = DEPRECATED, set preferOffline if a large number

// configs for token creation cidr = null read-only = false

// version configs preid tag-version-prefix => tagVersionPrefix allow-same-version allowSameVersion // configs for git behavior when running npm version message commit-hooks => commitHooks git-tag-version => gitTagVersion sign-git-commit => signGitCommit sign-git-tag => signGitTag

// Note: only for npm ls, not outdated or update depth = null

// search options description = true searchexclude = null searchlimit = 20 searchopts = "" searchstaleness = 900

dry-run = false

editor = "vim"

engine-strict => engineStrict

// fetch retry options // Consider always folding into a single // retry: { retries, factor, maxTimeout, minTimeout } fetch-retries => fetchRetries fetch-retry-factor => fetchRetryFactor fetch-retry-maxtimeout => fetchRetryMaxtimeout fetch-retry-mintimeout => fetchRetryMintimeout

force

format-package-lock => formatPackageLock

fund = true

// binary locators git = "git" npmBin nodeBin, NODE

global

// add to arborist bin-links => binLinks rebuild-bundle => rebuildBundle package-lock => packageLock (default true) package-lock-only => packageLockOnly (default false, only bIT, not reify) shrinkwrap => alias for packageLock global-style => globalStyle legacy-bundling => legacyBundling // consider removing this, it's probably never a good idea to disable // rollbacks, but if we don't remove it, add to arborist rollback = true

prefix = "/usr/local" tmp = "/var/folders/zc/5n20yjzn7mn7cz_qckj3b3440000gn/T" globalconfig = "/usr/local/etc/npmrc" userconfig = "/Users/isaacs/.npmrc" globalignorefile = "/usr/local/etc/npmignore"

// uid/gid stuff user = 0 group = 20

// Hamilton is a bit dated, and imo doesn't rise to the quintessential // level that justifies an easter egg. Consider removing, or replacing // with a giant ascii drawing of a ham. ham-it-up = false

// log settings progress = true heading = "npm" loglevel = "notice" logs-max = 10

// proxy settings noproxy = null proxy = null https-proxy => httpsProxy

// set to true to ignore missing script files if-present => ifPresent

// Consider removing, as we are intending to no longer run prepublish // at install time, as the world has moved on to prepare for that purpose ignore-prepublish => ignorePrepublish

ignore-scripts = false

// init settinigs // consider refactoring to: // initAuthor: {email, name, url} // or even: // init: { author: { email, name, url}, license, module, version } init-author-email => initAuthorEmail init-author-name => initAuthorName init-author-url => initAuthorUrl init-license => initLicense init-module => initModule init-version => initVersion

// output configs color unicode parseable json long

// Consider removing? we have workspaces now, and direct links // need to figure out what npm link foo should do, and if // npm install --link even makes sense in npm v7 link = false

// local interface to use when accessing the registry // mfh uses localAddress, nrf uses local-address local-address = localAddress

// maxsockets for nrf, but maxSockets in minipass-fetch/node-fetch maxsockets => maxSockets

metrics-registry => metricsRegistry (default to registry)

// add to @npmcli/run-script node-options => nodeOptions script-shell => scriptShell

node-version => nodeVersion

// remove this legacy garbage no one uses it onload-script = null

// I don't love these, I'd rather have a --omit argument to make it match // what arborist actually uses in buildIdealTree/reify only = null also dev = Install dev deps -- DEPRECATED, always installed at root level unless --omit=dev is set optional = true production = false

otp = null

// update in nrf offline = false prefer-offline => preferOffline prefer-online => preferOnline

save = true save-bundle = false save-dev = false save-exact = false save-optional = false save-prefix = "^" save-prod = false

scope = ""

// remove, no longer relevant scripts-prepend-node-path = "warn-only"

shell = "/usr/local/bin/bash"

// deprecated login options sso-poll-frequency = 500 sso-type = "oauth"

strict-ssl => strictSSL

tag => defaultTag

timing = false

umask

// remove in v7, no longer relevant? unsafe-perm = true

update-notifier => updateNotifier

// just the long form of -h usage = false

// overridden by filling in the appropriate fields ; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} {ci}" (overridden)

// long form of -v version = false // even longer form versions = false

// viewer for help viewer = "man"

/// extras.. npmSession: 8 random bytes for each command cache: the --cache config, plus /_cacache dirPacker: DEPRECATED REMOVE hashAlgorithm: 'sha1' (consider using sha512 instead??) includeDeprecated: option for npm-pick-manifest, always set to false project-scope => projectScope, the --scope config, or the scope in ${prefix}/package.json refer => the npm command to send as the http-referer header to registry dmode: 0o777 &(~umask) => passed to tar via pacote fmode: 0o777 &(~umask) => passed to tar via pacote npmVersion => the npm version uid, gid => set to env.SUDO_UID and env.SUDO_GID if set and getuid = 0

TODO:

  1. set in the environment:

    • npm_command - command being run (full name)
    • npm_execpath - path to require.main module in npm process
    • npm_node_execpath, NODE - process.execPath
    • any configs that are not the default value, and are not an auth token
  2. Update all deps to use option objects with canonical names, not fp

  3. Create the options object with canonical names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment