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