You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

defaults.js 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // Generated with `lib/make.js`
  2. 'use strict';
  3. const os = require('os');
  4. const path = require('path');
  5. const temp = os.tmpdir();
  6. const uidOrPid = process.getuid ? process.getuid() : process.pid;
  7. const hasUnicode = () => true;
  8. const isWindows = process.platform === 'win32';
  9. const osenv = {
  10. editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? 'notepad.exe' : 'vi'),
  11. shell: () => isWindows ? (process.env.COMSPEC || 'cmd.exe') : (process.env.SHELL || '/bin/bash')
  12. };
  13. const umask = {
  14. fromString: () => process.umask()
  15. };
  16. let home = os.homedir();
  17. if (home) {
  18. process.env.HOME = home;
  19. } else {
  20. home = path.resolve(temp, 'npm-' + uidOrPid);
  21. }
  22. const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm';
  23. const cacheRoot = process.platform === 'win32' ? process.env.APPDATA : home;
  24. const cache = path.resolve(cacheRoot, cacheExtra);
  25. let defaults;
  26. let globalPrefix;
  27. Object.defineProperty(exports, 'defaults', {
  28. get: function () {
  29. if (defaults) return defaults;
  30. if (process.env.PREFIX) {
  31. globalPrefix = process.env.PREFIX;
  32. } else if (process.platform === 'win32') {
  33. // c:\node\node.exe --> prefix=c:\node\
  34. globalPrefix = path.dirname(process.execPath);
  35. } else {
  36. // /usr/local/bin/node --> prefix=/usr/local
  37. globalPrefix = path.dirname(path.dirname(process.execPath)); // destdir only is respected on Unix
  38. if (process.env.DESTDIR) {
  39. globalPrefix = path.join(process.env.DESTDIR, globalPrefix);
  40. }
  41. }
  42. defaults = {
  43. access: null,
  44. 'allow-same-version': false,
  45. 'always-auth': false,
  46. also: null,
  47. 'auth-type': 'legacy',
  48. 'bin-links': true,
  49. browser: null,
  50. ca: null,
  51. cafile: null,
  52. cache: cache,
  53. 'cache-lock-stale': 60000,
  54. 'cache-lock-retries': 10,
  55. 'cache-lock-wait': 10000,
  56. 'cache-max': Infinity,
  57. 'cache-min': 10,
  58. cert: null,
  59. color: true,
  60. depth: Infinity,
  61. description: true,
  62. dev: false,
  63. 'dry-run': false,
  64. editor: osenv.editor(),
  65. 'engine-strict': false,
  66. force: false,
  67. 'fetch-retries': 2,
  68. 'fetch-retry-factor': 10,
  69. 'fetch-retry-mintimeout': 10000,
  70. 'fetch-retry-maxtimeout': 60000,
  71. git: 'git',
  72. 'git-tag-version': true,
  73. global: false,
  74. globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'),
  75. 'global-style': false,
  76. group: process.platform === 'win32' ? 0 : process.env.SUDO_GID || process.getgid && process.getgid(),
  77. 'ham-it-up': false,
  78. heading: 'npm',
  79. 'if-present': false,
  80. 'ignore-prepublish': false,
  81. 'ignore-scripts': false,
  82. 'init-module': path.resolve(home, '.npm-init.js'),
  83. 'init-author-name': '',
  84. 'init-author-email': '',
  85. 'init-author-url': '',
  86. 'init-version': '1.0.0',
  87. 'init-license': 'ISC',
  88. json: false,
  89. key: null,
  90. 'legacy-bundling': false,
  91. link: false,
  92. 'local-address': undefined,
  93. loglevel: 'notice',
  94. logstream: process.stderr,
  95. 'logs-max': 10,
  96. long: false,
  97. maxsockets: 50,
  98. message: '%s',
  99. 'metrics-registry': null,
  100. 'node-version': process.version,
  101. 'offline': false,
  102. 'onload-script': false,
  103. only: null,
  104. optional: true,
  105. 'package-lock': true,
  106. parseable: false,
  107. 'prefer-offline': false,
  108. 'prefer-online': false,
  109. prefix: globalPrefix,
  110. production: process.env.NODE_ENV === 'production',
  111. 'progress': !process.env.TRAVIS && !process.env.CI,
  112. 'proprietary-attribs': true,
  113. proxy: null,
  114. 'https-proxy': null,
  115. 'user-agent': 'npm/{npm-version} ' + 'node/{node-version} ' + '{platform} ' + '{arch}',
  116. 'rebuild-bundle': true,
  117. registry: 'https://registry.npmjs.org/',
  118. rollback: true,
  119. save: true,
  120. 'save-bundle': false,
  121. 'save-dev': false,
  122. 'save-exact': false,
  123. 'save-optional': false,
  124. 'save-prefix': '^',
  125. 'save-prod': false,
  126. scope: '',
  127. 'script-shell': null,
  128. 'scripts-prepend-node-path': 'warn-only',
  129. searchopts: '',
  130. searchexclude: null,
  131. searchlimit: 20,
  132. searchstaleness: 15 * 60,
  133. 'send-metrics': false,
  134. shell: osenv.shell(),
  135. shrinkwrap: true,
  136. 'sign-git-tag': false,
  137. 'sso-poll-frequency': 500,
  138. 'sso-type': 'oauth',
  139. 'strict-ssl': true,
  140. tag: 'latest',
  141. 'tag-version-prefix': 'v',
  142. timing: false,
  143. tmp: temp,
  144. unicode: hasUnicode(),
  145. 'unsafe-perm': process.platform === 'win32' || process.platform === 'cygwin' || !(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0,
  146. usage: false,
  147. user: process.platform === 'win32' ? 0 : 'nobody',
  148. userconfig: path.resolve(home, '.npmrc'),
  149. umask: process.umask ? process.umask() : umask.fromString('022'),
  150. version: false,
  151. versions: false,
  152. viewer: process.platform === 'win32' ? 'browser' : 'man',
  153. _exit: true
  154. };
  155. return defaults;
  156. }
  157. })