Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use newer NPM Version #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
291 changes: 171 additions & 120 deletions lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';
const os = require('os');
const path = require('path');
const ciInfo = require('ci-info');

const temp = os.tmpdir();
const uidOrPid = process.getuid ? process.getuid() : process.pid;
Expand Down Expand Up @@ -29,6 +30,20 @@ const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm';
const cacheRoot = process.platform === 'win32' && process.env.APPDATA || home;
const cache = path.resolve(cacheRoot, cacheExtra);

const editor = process.env.EDITOR ||
process.env.VISUAL ||
(isWindows ? `undefined\notepad.exe` : 'vi')

const shell = isWindows
? process.env.ComSpec || 'cmd'
: process.env.SHELL || 'sh'

const unicode = /UTF-?8$/i.test(
process.env.LC_ALL ||
process.env.LC_CTYPE ||
process.env.LANG || ''
)

let defaults;
let globalPrefix;

Expand All @@ -50,127 +65,163 @@ Object.defineProperty(exports, 'defaults', {
}
}

defaults = {
access: null,
'allow-same-version': false,
'always-auth': false,
also: null,
audit: true,
'auth-type': 'legacy',
'bin-links': true,
browser: null,
ca: null,
cafile: null,
cache: cache,
'cache-lock-stale': 60000,
'cache-lock-retries': 10,
'cache-lock-wait': 10000,
'cache-max': Infinity,
'cache-min': 10,
cert: null,
cidr: null,
color: process.env.NO_COLOR == null,
depth: Infinity,
description: true,
dev: false,
'dry-run': false,
editor: osenv.editor(),
'engine-strict': false,
force: false,
'fetch-retries': 2,
'fetch-retry-factor': 10,
'fetch-retry-mintimeout': 10000,
'fetch-retry-maxtimeout': 60000,
git: 'git',
'git-tag-version': true,
'commit-hooks': true,
global: false,
globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'),
'global-style': false,
group: process.platform === 'win32' ? 0 : process.env.SUDO_GID || process.getgid && process.getgid(),
'ham-it-up': false,
heading: 'npm',
'if-present': false,
'ignore-prepublish': false,
'ignore-scripts': false,
'init-module': path.resolve(home, '.npm-init.js'),
'init-author-name': '',
'init-author-email': '',
'init-author-url': '',
'init-version': '1.0.0',
'init-license': 'ISC',
json: false,
key: null,
'legacy-bundling': false,
link: false,
'local-address': undefined,
loglevel: 'notice',
logstream: process.stderr,
'logs-max': 10,
long: false,
maxsockets: 50,
message: '%s',
'metrics-registry': null,
'node-options': null,
// We remove node-version to fix the issue described here: https://github.com/pnpm/pnpm/issues/4203#issuecomment-1133872769
'offline': false,
'onload-script': false,
only: null,
optional: true,
otp: null,
'package-lock': true,
'package-lock-only': false,
parseable: false,
'prefer-offline': false,
'prefer-online': false,
prefix: globalPrefix,
production: process.env.NODE_ENV === 'production',
'progress': !process.env.TRAVIS && !process.env.CI,
provenance: false,
proxy: null,
'https-proxy': null,
'no-proxy': null,
'user-agent': 'npm/{npm-version} ' + 'node/{node-version} ' + '{platform} ' + '{arch}',
'read-only': false,
'rebuild-bundle': true,
registry: 'https://registry.npmjs.org/',
rollback: true,
save: true,
'save-bundle': false,
'save-dev': false,
'save-exact': false,
'save-optional': false,
'save-prefix': '^',
'save-prod': false,
scope: '',
'script-shell': null,
'scripts-prepend-node-path': 'warn-only',
searchopts: '',
searchexclude: null,
searchlimit: 20,
searchstaleness: 15 * 60,
'send-metrics': false,
shell: osenv.shell(),
shrinkwrap: true,
'sign-git-tag': false,
'sso-poll-frequency': 500,
'sso-type': 'oauth',
'strict-ssl': true,
tag: 'latest',
'tag-version-prefix': 'v',
timing: false,
tmp: temp,
unicode: hasUnicode(),
'unsafe-perm': process.platform === 'win32' || process.platform === 'cygwin' || !(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0,
usage: false,
user: process.platform === 'win32' ? 0 : 'nobody',
userconfig: path.resolve(home, '.npmrc'),
umask: process.umask ? process.umask() : umask.fromString('022'),
version: false,
versions: false,
viewer: process.platform === 'win32' ? 'browser' : 'man',
_exit: true
defaults = {
'_auth' : null,
'access' : null,
'all' : false,
'allow-same-version' : false,
'also' : null,
'audit' : true,
'audit-level' : null,
'auth-type' : 'web',
'before' : null,
'bin-links' : true,
'browser' : null,
'ca' : null,
'cache' : cache,
'cache-max' : Infinity,
'cache-min' : 0,
'cafile' : null,
'call' : '',
'cert' : null,
'cidr' : null,
'color' : !process.env.NO_COLOR || process.env.NO_COLOR === '0',
'commit-hooks' : true,
'cpu' : null,
'os' : null,
'depth' : null,
'description' : true,
'dev' : false,
'diff' : [],
'diff-ignore-all-space' : false,
'diff-name-only' : false,
'diff-no-prefix' : false,
'diff-dst-prefix' : 'b/',
'diff-src-prefix' : 'a/',
'diff-text' : false,
'diff-unified' : 3,
'dry-run' : false,
'editor' : editor,
'engine-strict' : false,
'fetch-retries' : 2,
'fetch-retry-factor' : 10,
'fetch-retry-maxtimeout' : 60000,
'fetch-retry-mintimeout' : 10000,
'fetch-timeout' : 5 * 60 * 1000,
'force' : false,
'foreground-scripts' : false,
'format-package-lock' : true,
'fund' : true,
'git' : 'git',
'git-tag-version' : true,
'global' : false,
'globalconfig' : '',
'global-style' : false,
'heading' : 'npm',
'https-proxy' : null,
'if-present' : false,
'ignore-scripts' : false,
'include' : [],
'include-staged' : false,
'include-workspace-root' : false,
'init-author-email' : '',
'init-author-name' : '',
'init-author-url' : '',
'init-license' : 'ISC',
'init-module' : '~/.npm-init.js',
'init-version' : '1.0.0',
'init.author.email' : '',
'init.author.name' : '',
'init.author.url' : '',
'init.license' : 'ISC',
'init.module' : '~/.npm-init.js',
'init.version' : '1.0.0',
'install-links' : false,
'install-strategy' : 'hoisted',
'json' : false,
'key' : null,
'legacy-bundling' : false,
'legacy-peer-deps' : false,
'link' : false,
'local-address' : null,
'sbom-format' : null,
'sbom-type' : 'library',
'location' : 'user',
'lockfile-version' : null,
'loglevel' : 'notice',
'logs-dir' : null,
'logs-max' : 10,
'long' : false,
'maxsockets' : 15,
'message' : '%s',
'node-options' : null,
'noproxy' : '',
'offline' : false,
'omit' : process.env.NODE_ENV === 'production' ? ['dev'] : [],
'omit-lockfile-registry-resolved' : false,
'only' : null,
'optional' : null,
'otp' : null,
'package' : [],
'package-lock' : true,
'package-lock-only' : false,
'pack-destination' : '.',
'parseable' : false,
'prefer-dedupe' : false,
'prefer-offline' : false,
'prefer-online' : false,
'prefix' : '',
'preid' : '',
'production' : null,
'progress' : !ciInfo.isCI,
'provenance' : false,
'provenance-file' : null,
'proxy' : null,
'read-only' : false,
'rebuild-bundle' : true,
'registry' : 'https://registry.npmjs.org/',
'replace-registry-host' : 'npmjs',
'save' : true,
'save-bundle' : false,
'save-dev' : false,
'save-exact' : false,
'save-optional' : false,
'save-peer' : false,
'save-prefix' : '^',
'save-prod' : false,
'scope' : '',
'script-shell' : null,
'searchexclude' : '',
'searchlimit' : 20,
'searchopts' : '',
'searchstaleness' : 15 * 60,
'shell' : shell,
'shrinkwrap' : true,
'sign-git-commit' : false,
'sign-git-tag' : false,
'strict-peer-deps' : false,
'strict-ssl' : true,
'tag' : 'latest',
'tag-version-prefix' : 'v',
'timing' : false,
'umask' : 0,
'unicode' : unicode,
'update-notifier' : true,
'usage' : false,
'user-agent' : 'npm/{npm-version} ' + 'node/{node-version} ' + '{platform} ' + '{arch} ' + 'workspaces/{workspaces} ' + '{ci}',
'userconfig' : '~/.npmrc',
'version' : false,
'versions' : false,
'viewer' : isWindows ? 'browser' : 'man',
'which' : null,
'workspace' : [],
'workspaces' : null,
'workspaces-update' : true,
'yes' : null,

};
return defaults;
}
});


Loading