pxnpm 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +0 -0
- package/README.md +32 -37
- package/bin/pxnpm +1 -1
- package/lib/config.js +54 -47
- package/lib/parse_argv.js +1 -1
- package/package.json +49 -26
package/LICENSE.txt
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,67 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
pxnpm
|
|
2
|
+
=======
|
|
2
3
|
|
|
3
|
-
##
|
|
4
|
+
## Requirements
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
$ npm install -g pxnpm --registry=http://10.120.20.50:5507 // 内网
|
|
9
|
-
```
|
|
6
|
+
| | Minimum | Recommended |
|
|
7
|
+
|--------|---------|-------------|
|
|
8
|
+
| NodeJS | 4.0.0 | stable |
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
## Install
|
|
12
11
|
|
|
13
12
|
```bash
|
|
14
|
-
$
|
|
13
|
+
$ npm install pxnpm -g
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
If you're in China, maybe you should install it from our [China mirror](https://npm.taobao.org):
|
|
18
17
|
|
|
19
18
|
```bash
|
|
20
|
-
$ pxnpm
|
|
19
|
+
$ npm install pxnpm -g --registry=https://r.npm.taobao.org
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
## Usage
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
$ pxnpm login
|
|
27
|
-
$ pxnpm logout
|
|
24
|
+
Support all commands just like `npm`.
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
### Sync packages from `npm`
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
```bash
|
|
29
|
+
$ pxnpm sync [moduleName]
|
|
30
|
+
```
|
|
32
31
|
|
|
33
|
-
package
|
|
32
|
+
### Open package document or git web url
|
|
34
33
|
|
|
35
34
|
```bash
|
|
36
|
-
pxnpm
|
|
37
|
-
|
|
35
|
+
$ pxnpm doc [name]
|
|
36
|
+
$ pxnpm doc -g [name] # open git web url directly
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
发布前运行,例如`pxnpm version patch`
|
|
39
|
+
## Build your own private registry npm cli
|
|
43
40
|
|
|
44
41
|
```bash
|
|
45
|
-
|
|
42
|
+
$ npm install pxnpm -g
|
|
46
43
|
|
|
44
|
+
# then alias it
|
|
45
|
+
$ alias mynpm='pxnpm --registry=http://registry.npm.example.com \
|
|
46
|
+
--registryweb=http://npm.example.com \
|
|
47
|
+
--userconfig=$HOME/.mynpmrc'
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
- premajor: 预备主版本
|
|
51
|
-
- minor: 次版本号
|
|
52
|
-
- preminor: 预备次版本
|
|
53
|
-
- patch: 修订号
|
|
54
|
-
- prepatch: 预备修订版
|
|
55
|
-
- prerelease: 预发布版本
|
|
56
|
-
|
|
57
|
-
### 发布
|
|
50
|
+
## Install with original npm cli
|
|
58
51
|
|
|
59
|
-
|
|
52
|
+
pxnpm using [npminstall](https://github.com/pxnpm/npminstall) by default.
|
|
53
|
+
If you don't like symlink mode for `node_modules`, you can change the installer to original npm.
|
|
54
|
+
But you will lose the fastest install speed.
|
|
60
55
|
|
|
61
56
|
```bash
|
|
62
|
-
$ pxnpm
|
|
57
|
+
$ pxnpm i --by=npm react-native
|
|
63
58
|
```
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
## License
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
[MIT](LICENSE.txt)
|
package/bin/pxnpm
CHANGED
package/lib/config.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
const debug = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const fs = require(
|
|
6
|
-
const cp = require(
|
|
7
|
-
const ini = require(
|
|
3
|
+
const debug = require('debug')('cnpm:config');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const cp = require('child_process');
|
|
7
|
+
const ini = require('ini');
|
|
8
|
+
const ping = require('connection-tester');
|
|
8
9
|
|
|
9
10
|
let root;
|
|
10
|
-
if (process.platform ===
|
|
11
|
+
if (process.platform === 'win32') {
|
|
11
12
|
root = process.env.USERPROFILE || process.env.APPDATA || process.env.TMP || process.env.TEMP;
|
|
12
13
|
} else {
|
|
13
|
-
root = process.env.HOME || process.env.TMPDIR ||
|
|
14
|
+
root = process.env.HOME || process.env.TMPDIR || '/tmp';
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
let prefix = null;
|
|
17
18
|
try {
|
|
18
|
-
prefix = cp.execSync(
|
|
19
|
+
prefix = cp.execSync('npm config get prefix').toString().trim();
|
|
19
20
|
} catch (err) {
|
|
20
21
|
// ignore it
|
|
21
|
-
debug(
|
|
22
|
+
debug('npm config cli error: %s', err);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
// =====
|
|
25
|
-
const ping = require("connection-tester");
|
|
26
25
|
const rawArgs = process.argv && process.argv.slice(2);
|
|
27
26
|
const rawAction = rawArgs && rawArgs[0];
|
|
28
27
|
const isPublish = rawAction === "login" || rawAction === "publish";
|
|
@@ -30,44 +29,44 @@ const isPublish = rawAction === "login" || rawAction === "publish";
|
|
|
30
29
|
process.env.outerAddr = JSON.stringify({
|
|
31
30
|
inner: {
|
|
32
31
|
proxy: {
|
|
33
|
-
protocol:
|
|
34
|
-
host:
|
|
35
|
-
port: 8080
|
|
32
|
+
protocol: 'http:',
|
|
33
|
+
host: 'fe-repo.inner.px.nfjbill.ren',
|
|
34
|
+
port: 8080,
|
|
36
35
|
},
|
|
37
36
|
registry: {
|
|
38
|
-
protocol:
|
|
39
|
-
host:
|
|
40
|
-
port: isPublish ? 5508 : 5507
|
|
41
|
-
}
|
|
37
|
+
protocol: 'http:',
|
|
38
|
+
host: 'fe-repo.inner.px.nfjbill.ren',
|
|
39
|
+
port: isPublish ? 5508 : 5507,
|
|
40
|
+
},
|
|
42
41
|
},
|
|
43
42
|
outer: {
|
|
44
43
|
proxy: {
|
|
45
|
-
protocol:
|
|
46
|
-
host:
|
|
47
|
-
port: 80
|
|
44
|
+
protocol: 'http:',
|
|
45
|
+
host: 'npm.taobao.org',
|
|
46
|
+
port: 80,
|
|
48
47
|
},
|
|
49
48
|
registry: {
|
|
50
|
-
protocol:
|
|
51
|
-
host:
|
|
52
|
-
port: isPublish ? 8905 :
|
|
53
|
-
}
|
|
49
|
+
protocol: 'https:',
|
|
50
|
+
host: 'pips.xt.nfjbill.ren',
|
|
51
|
+
port: isPublish ? 8905 : 38083,
|
|
52
|
+
},
|
|
54
53
|
},
|
|
55
54
|
io: {
|
|
56
55
|
proxy: {
|
|
57
|
-
protocol:
|
|
58
|
-
host:
|
|
59
|
-
port: 8080
|
|
56
|
+
protocol: 'http:',
|
|
57
|
+
host: 'r.pxnpm.nfjbill.ren',
|
|
58
|
+
port: 8080,
|
|
60
59
|
},
|
|
61
60
|
registry: {
|
|
62
|
-
protocol:
|
|
63
|
-
host:
|
|
64
|
-
port: isPublish ? 5508 : 5507
|
|
65
|
-
}
|
|
61
|
+
protocol: 'http:',
|
|
62
|
+
host: 'registry.pxnpm.nfjbill.ren',
|
|
63
|
+
port: isPublish ? 5508 : 5507,
|
|
64
|
+
},
|
|
66
65
|
},
|
|
67
66
|
// yk3 内部端口
|
|
68
67
|
lp: {
|
|
69
|
-
addr:
|
|
70
|
-
}
|
|
68
|
+
addr: 'http://127.0.0.1:38020',
|
|
69
|
+
},
|
|
71
70
|
});
|
|
72
71
|
|
|
73
72
|
const outerAddr = JSON.parse(process.env.outerAddr);
|
|
@@ -75,11 +74,11 @@ const outerAddr = JSON.parse(process.env.outerAddr);
|
|
|
75
74
|
const getAddr = function(type) {
|
|
76
75
|
return {
|
|
77
76
|
proxy: `${outerAddr[type].proxy.protocol}//${outerAddr[type].proxy.host}:${outerAddr[type].proxy.port}`,
|
|
78
|
-
registry: `${outerAddr[type].registry.protocol}//${outerAddr[type].registry.host}:${outerAddr[type].registry.port}
|
|
77
|
+
registry: `${outerAddr[type].registry.protocol}//${outerAddr[type].registry.host}:${outerAddr[type].registry.port}`,
|
|
79
78
|
};
|
|
80
79
|
};
|
|
81
80
|
|
|
82
|
-
let addr = getAddr(
|
|
81
|
+
let addr = getAddr('io');
|
|
83
82
|
let pxnpmServer = `http://${outerAddr.io.registry.host}`;
|
|
84
83
|
const timeout = 3000;
|
|
85
84
|
const { success: is } = ping.test(outerAddr.inner.proxy.host, outerAddr.inner.proxy.port, timeout); // registry
|
|
@@ -88,29 +87,28 @@ const { success: os } = ping.test(outerAddr.outer.proxy.host, outerAddr.outer.pr
|
|
|
88
87
|
if (!is && !os) {
|
|
89
88
|
// consola.fatal('没有发现安装源,请调通网络,或重新尝试安装');
|
|
90
89
|
// process.exit(0);
|
|
91
|
-
addr = getAddr(
|
|
90
|
+
addr = getAddr('outer');
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
if (!is && os) {
|
|
95
94
|
// consola.warn('您正在使用协同模式安装,如果安装失败,请多尝试几次,或联系管理员');
|
|
96
|
-
addr = getAddr(
|
|
95
|
+
addr = getAddr('outer');
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
if (is && !os) {
|
|
100
|
-
addr = getAddr(
|
|
99
|
+
addr = getAddr('inner');
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
let proxy = addr.proxy;
|
|
104
103
|
let registry = addr.registry;
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
const userconfig = path.join(root, ".pxnpmrc");
|
|
105
|
+
const userconfig = path.join(root, '.pxnpmrc');
|
|
108
106
|
if (fs.existsSync(userconfig)) {
|
|
109
107
|
let cnpmrc;
|
|
110
108
|
try {
|
|
111
|
-
cnpmrc = ini.parse(fs.readFileSync(userconfig,
|
|
109
|
+
cnpmrc = ini.parse(fs.readFileSync(userconfig, 'utf-8'));
|
|
112
110
|
} catch (err) {
|
|
113
|
-
console.warn(
|
|
111
|
+
console.warn('[cnpm:config] [WARN] read %s ini format error', userconfig);
|
|
114
112
|
}
|
|
115
113
|
|
|
116
114
|
if (cnpmrc && cnpmrc.proxy) {
|
|
@@ -122,12 +120,21 @@ process.env.__pxnpm_config_proxy = proxy;
|
|
|
122
120
|
process.env.__pxnpm_config_pxnpmServer = pxnpmServer;
|
|
123
121
|
|
|
124
122
|
module.exports = {
|
|
123
|
+
// cnpmHost: 'https://npm.taobao.org',
|
|
124
|
+
// cnpmRegistry: 'http://cln.grsg.aly.px.nfjbill.xyz:38020/',
|
|
125
|
+
// disturl: 'https://npm.taobao.org/mirrors/node', // download dist tarball for node-gyp
|
|
126
|
+
// iojsDisturl: 'https://npm.taobao.org/mirrors/iojs',
|
|
127
|
+
// cache: path.join(root, '.cnpm'), // cache folder name
|
|
128
|
+
// userconfig,
|
|
129
|
+
// proxy,
|
|
130
|
+
// prefix,
|
|
131
|
+
|
|
125
132
|
cnpmHost: pxnpmServer,
|
|
126
133
|
cnpmRegistry: registry,
|
|
127
134
|
disturl: `${proxy}/mirrors/node`, // download dist tarball for node-gyp
|
|
128
|
-
iojsDisturl: `${proxy}/mirrors/
|
|
129
|
-
cache: path.join(root,
|
|
135
|
+
iojsDisturl: `${proxy}/mirrors/iojs`,
|
|
136
|
+
cache: path.join(root, '.pxnpm'), // cache folder name
|
|
130
137
|
userconfig,
|
|
131
138
|
proxy: '',
|
|
132
|
-
prefix
|
|
139
|
+
prefix,
|
|
133
140
|
};
|
package/lib/parse_argv.js
CHANGED
|
@@ -19,7 +19,7 @@ module.exports = cmd => {
|
|
|
19
19
|
.option('-c, --cache [cache]', 'cache folder, default is ' + config.cache)
|
|
20
20
|
.option('-u, --userconfig [userconfig]', 'userconfig file, default is ' + config.userconfig)
|
|
21
21
|
.option('-y, --yes', 'yes all confirm')
|
|
22
|
-
.option('--ignore-custom-config', 'ignore custom .
|
|
22
|
+
.option('--ignore-custom-config', 'ignore custom .pxnpmrc')
|
|
23
23
|
.option('--proxy [proxy]', 'set a http proxy, no default');
|
|
24
24
|
}
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"files": [
|
|
7
|
-
"bin",
|
|
8
|
-
"lib"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"test": "npm run lint -- --fix && npm run test-local",
|
|
12
|
-
"test-local": "egg-bin test",
|
|
13
|
-
"lint": "eslint bin lib test/*.js",
|
|
14
|
-
"ci": "npm run lint && npm run test",
|
|
15
|
-
"autod": "autod"
|
|
2
|
+
"author": {
|
|
3
|
+
"name": "fengmk2",
|
|
4
|
+
"email": "fengmk2@gmail.com",
|
|
5
|
+
"url": "https://fengmk2.com"
|
|
16
6
|
},
|
|
17
|
-
"preferGlobal": true,
|
|
18
7
|
"bin": {
|
|
19
8
|
"pxnpm": "bin/pxnpm"
|
|
20
9
|
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/cnpm/cnpm/issues"
|
|
12
|
+
},
|
|
13
|
+
"bundleDependencies": false,
|
|
14
|
+
"ci": {
|
|
15
|
+
"version": "6, 8, 10, 12",
|
|
16
|
+
"command": {
|
|
17
|
+
"travis": "ci",
|
|
18
|
+
"appveyor": "ci"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"auto-correct": "^1.0.0",
|
|
23
23
|
"bagpipe": "^0.3.5",
|
|
24
24
|
"colors": "^1.1.2",
|
|
25
25
|
"commander": "~2.10.0",
|
|
26
|
-
"config-chain": "^1.1.13",
|
|
27
26
|
"connection-tester": "^0.2.1",
|
|
28
27
|
"cross-spawn": "~0.2.8",
|
|
29
28
|
"debug": "^2.2.0",
|
|
@@ -31,10 +30,12 @@
|
|
|
31
30
|
"ini": "^1.3.4",
|
|
32
31
|
"npm": "^6.13.4",
|
|
33
32
|
"npm-request": "^1.0.0",
|
|
34
|
-
"open": "^
|
|
35
|
-
"pxnpminstall": "
|
|
33
|
+
"open": "^0.0.5",
|
|
34
|
+
"pxnpminstall": "^1.0.5",
|
|
36
35
|
"urllib": "^2.17.0"
|
|
37
36
|
},
|
|
37
|
+
"deprecated": false,
|
|
38
|
+
"description": "cnpm: npm client for cnpmjs.org",
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"autod": "^2.7.1",
|
|
40
41
|
"coffee": "^3.3.0",
|
|
@@ -46,14 +47,36 @@
|
|
|
46
47
|
"rimraf": "^2.5.4"
|
|
47
48
|
},
|
|
48
49
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
50
|
+
"node": ">= 6.0.0"
|
|
50
51
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
"files": [
|
|
53
|
+
"bin",
|
|
54
|
+
"lib"
|
|
55
|
+
],
|
|
56
|
+
"homepage": "https://github.com/cnpm/cnpm",
|
|
57
|
+
"keywords": [
|
|
58
|
+
"cnpm",
|
|
59
|
+
"npm",
|
|
60
|
+
"npminstall"
|
|
61
|
+
],
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"main": "bin/cnpm",
|
|
64
|
+
"name": "pxnpm",
|
|
65
|
+
"preferGlobal": true,
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"tag": "latest"
|
|
68
|
+
},
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git://github.com/cnpm/cnpm.git"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"autod": "autod",
|
|
75
|
+
"ci": "npm run lint && npm run test",
|
|
76
|
+
"lint": "eslint bin lib test/*.js",
|
|
77
|
+
"test": "npm run lint -- --fix && npm run test-local",
|
|
78
|
+
"test-local": "egg-bin test",
|
|
79
|
+
"pub:beta": "npm version prerelease --preid=beta && npm publish --tag beta"
|
|
57
80
|
},
|
|
58
|
-
"
|
|
81
|
+
"version": "2.0.2"
|
|
59
82
|
}
|