UNPKG

2.13 kBJavaScriptView Raw
1var path = require('path')
2var userconfigSrc = path.resolve(__dirname, 'fixtures', 'userconfig')
3exports.userconfig = userconfigSrc + '-with-gc'
4exports.globalconfig = path.resolve(__dirname, 'fixtures', 'globalconfig')
5exports.builtin = path.resolve(__dirname, 'fixtures', 'builtin')
6exports.ucData =
7 { globalconfig: exports.globalconfig,
8 email: 'i@izs.me',
9 'env-thing': 'asdf',
10 'init.author.name': 'Isaac Z. Schlueter',
11 'init.author.email': 'i@izs.me',
12 'init.author.url': 'http://blog.izs.me/',
13 'init.version': '1.2.3',
14 'proprietary-attribs': false,
15 'npm:publishtest': true,
16 '_npmjs.org:couch': 'https://admin:password@localhost:5984/registry',
17 'npm-www:nocache': '1',
18 nodedir: '/Users/isaacs/dev/js/node-v0.8',
19 'sign-git-tag': true,
20 message: 'v%s',
21 'strict-ssl': false,
22 'tmp': process.env.HOME + '/.tmp',
23 _auth: 'dXNlcm5hbWU6cGFzc3dvcmQ=',
24 _token:
25 { AuthSession: 'yabba-dabba-doodle',
26 version: '1',
27 expires: '1345001053415',
28 path: '/',
29 httponly: true } }
30
31// set the userconfig in the env
32// unset anything else that npm might be trying to foist on us
33Object.keys(process.env).forEach(function (k) {
34 if (k.match(/^npm_config_/i)) {
35 delete process.env[k]
36 }
37})
38process.env.npm_config_userconfig = exports.userconfig
39process.env.npm_config_other_env_thing = 1000
40process.env.random_env_var = 'asdf'
41process.env.npm_config__underbar_env_thing = 'underful'
42process.env.NPM_CONFIG_UPPERCASE_ENV_THING = 42
43
44exports.envData = {
45 userconfig: exports.userconfig,
46 '_underbar-env-thing': 'underful',
47 'uppercase-env-thing': '42',
48 'other-env-thing': '1000'
49}
50exports.envDataFix = {
51 userconfig: exports.userconfig,
52 '_underbar-env-thing': 'underful',
53 'uppercase-env-thing': 42,
54 'other-env-thing': 1000,
55}
56
57
58if (module === require.main) {
59 // set the globalconfig in the userconfig
60 var fs = require('fs')
61 var uc = fs.readFileSync(userconfigSrc)
62 var gcini = 'globalconfig = ' + exports.globalconfig + '\n'
63 fs.writeFileSync(exports.userconfig, gcini + uc)
64
65 console.log('0..1')
66 console.log('ok 1 setup done')
67}