pxnpm 2.0.0-1 → 2.0.3

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 CHANGED
File without changes
package/README.md CHANGED
@@ -1,67 +1,62 @@
1
- # 普迅电力-FE-私库
1
+ pxnpm
2
+ =======
2
3
 
3
- ## 使用
4
+ ## Requirements
4
5
 
5
- ```bash
6
- $ npm install -g pxnpm // 外网
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
- $ pxnpm install [name]
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 adduser
19
+ $ npm install pxnpm -g --registry=https://r.npm.taobao.org
21
20
  ```
22
21
 
23
- ### 登录 / 登出
22
+ ## Usage
24
23
 
25
- ```bash
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.json中name格式需要符合 `@团队名称/项目名` 原则,例如: `@yfzx/xxx, @zrui/query-table`
32
+ ### Open package document or git web url
34
33
 
35
34
  ```bash
36
- pxnpm init
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
- pxnpm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
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
- - major: 主版本号
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 publish
57
+ $ pxnpm i --by=npm react-native
63
58
  ```
64
59
 
65
- ### 其他命令
60
+ ## License
66
61
 
67
- 支持所有其他npm命令
62
+ [MIT](LICENSE.txt)
package/bin/pxnpm CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  'use strict';
4
- const pkg = require('../package.json');
5
4
 
6
5
  const debug = require('debug')('cnpm');
6
+ const pkg = require('../package.json');
7
7
  const argv = require('../lib/parse_argv')();
8
8
 
9
9
  const action = argv.args[0];
package/lib/config.js CHANGED
@@ -1,28 +1,27 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
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");
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 === "win32") {
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 || "/tmp";
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("npm config get prefix").toString().trim();
19
+ prefix = cp.execSync('npm config get prefix').toString().trim();
19
20
  } catch (err) {
20
21
  // ignore it
21
- debug("npm config cli error: %s", err);
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,49 @@ const isPublish = rawAction === "login" || rawAction === "publish";
30
29
  process.env.outerAddr = JSON.stringify({
31
30
  inner: {
32
31
  proxy: {
33
- protocol: "http:",
34
- host: "fe-repo.inner.px.nfjbill.ren",
35
- port: 8080
32
+ protocol: 'http:',
33
+ host: 'fe-repo.inner.px.nfjbill.ren',
34
+ port: 8080,
36
35
  },
37
36
  registry: {
38
- protocol: "http:",
39
- host: "fe-repo.inner.px.nfjbill.ren",
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: "http:",
46
- host: "npm.taobao.org",
47
- port: 80
44
+ protocol: 'http:',
45
+ host: 'npm.taobao.org',
46
+ port: 80,
48
47
  },
48
+ // registry: {
49
+ // protocol: 'https:',
50
+ // host: 'pips.xt.nfjbill.ren',
51
+ // port: isPublish ? 8905 : 38083,
52
+ // },
49
53
  registry: {
50
- protocol: "http:",
51
- host: "pip.xt.nfjbill.ren",
52
- port: isPublish ? 8905 : 38082
53
- }
54
+ protocol: 'http:',
55
+ host: '39.105.197.205',
56
+ port: isPublish ? 8905 : 38082,
57
+ },
54
58
  },
55
59
  io: {
56
60
  proxy: {
57
- protocol: "http:",
58
- host: "r.pxnpm.nfjbill.ren",
59
- port: 8080
61
+ protocol: 'http:',
62
+ host: 'r.pxnpm.nfjbill.ren',
63
+ port: 8080,
60
64
  },
61
65
  registry: {
62
- protocol: "http:",
63
- host: "registry.pxnpm.nfjbill.ren",
64
- port: isPublish ? 5508 : 5507
65
- }
66
+ protocol: 'http:',
67
+ host: 'registry.pxnpm.nfjbill.ren',
68
+ port: isPublish ? 5508 : 5507,
69
+ },
66
70
  },
67
71
  // yk3 内部端口
68
72
  lp: {
69
- addr: "http://127.0.0.1:38020"
70
- }
73
+ addr: 'http://127.0.0.1:38020',
74
+ },
71
75
  });
72
76
 
73
77
  const outerAddr = JSON.parse(process.env.outerAddr);
@@ -75,11 +79,11 @@ const outerAddr = JSON.parse(process.env.outerAddr);
75
79
  const getAddr = function(type) {
76
80
  return {
77
81
  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}`
82
+ registry: `${outerAddr[type].registry.protocol}//${outerAddr[type].registry.host}:${outerAddr[type].registry.port}`,
79
83
  };
80
84
  };
81
85
 
82
- let addr = getAddr("io");
86
+ let addr = getAddr('io');
83
87
  let pxnpmServer = `http://${outerAddr.io.registry.host}`;
84
88
  const timeout = 3000;
85
89
  const { success: is } = ping.test(outerAddr.inner.proxy.host, outerAddr.inner.proxy.port, timeout); // registry
@@ -88,29 +92,28 @@ const { success: os } = ping.test(outerAddr.outer.proxy.host, outerAddr.outer.pr
88
92
  if (!is && !os) {
89
93
  // consola.fatal('没有发现安装源,请调通网络,或重新尝试安装');
90
94
  // process.exit(0);
91
- addr = getAddr("outer");
95
+ addr = getAddr('outer');
92
96
  }
93
97
 
94
98
  if (!is && os) {
95
99
  // consola.warn('您正在使用协同模式安装,如果安装失败,请多尝试几次,或联系管理员');
96
- addr = getAddr("outer");
100
+ addr = getAddr('outer');
97
101
  }
98
102
 
99
103
  if (is && !os) {
100
- addr = getAddr("inner");
104
+ addr = getAddr('inner');
101
105
  }
102
106
 
103
107
  let proxy = addr.proxy;
104
108
  let registry = addr.registry;
105
109
 
106
- // ====
107
- const userconfig = path.join(root, ".pxnpmrc");
110
+ const userconfig = path.join(root, '.pxnpmrc');
108
111
  if (fs.existsSync(userconfig)) {
109
112
  let cnpmrc;
110
113
  try {
111
- cnpmrc = ini.parse(fs.readFileSync(userconfig, "utf-8"));
114
+ cnpmrc = ini.parse(fs.readFileSync(userconfig, 'utf-8'));
112
115
  } catch (err) {
113
- console.warn("[cnpm:config] [WARN] read %s ini format error", userconfig);
116
+ console.warn('[cnpm:config] [WARN] read %s ini format error', userconfig);
114
117
  }
115
118
 
116
119
  if (cnpmrc && cnpmrc.proxy) {
@@ -122,12 +125,21 @@ process.env.__pxnpm_config_proxy = proxy;
122
125
  process.env.__pxnpm_config_pxnpmServer = pxnpmServer;
123
126
 
124
127
  module.exports = {
128
+ // cnpmHost: 'https://npm.taobao.org',
129
+ // cnpmRegistry: 'http://cln.grsg.aly.px.nfjbill.xyz:38020/',
130
+ // disturl: 'https://npm.taobao.org/mirrors/node', // download dist tarball for node-gyp
131
+ // iojsDisturl: 'https://npm.taobao.org/mirrors/iojs',
132
+ // cache: path.join(root, '.cnpm'), // cache folder name
133
+ // userconfig,
134
+ // proxy,
135
+ // prefix,
136
+
125
137
  cnpmHost: pxnpmServer,
126
138
  cnpmRegistry: registry,
127
139
  disturl: `${proxy}/mirrors/node`, // download dist tarball for node-gyp
128
- iojsDisturl: `${proxy}/mirrors/node`,
129
- cache: path.join(root, ".pxnpm"), // cache folder name
140
+ iojsDisturl: `${proxy}/mirrors/iojs`,
141
+ cache: path.join(root, '.pxnpm'), // cache folder name
130
142
  userconfig,
131
143
  proxy: '',
132
- prefix
144
+ prefix,
133
145
  };
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 .cnpmrc')
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,23 +1,23 @@
1
1
  {
2
- "name": "pxnpm",
3
- "version": "2.0.0-1",
4
- "description": "pxnpm use cnpm engine",
5
- "main": "bin/pxnpm",
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",
@@ -30,10 +30,12 @@
30
30
  "ini": "^1.3.4",
31
31
  "npm": "^6.13.4",
32
32
  "npm-request": "^1.0.0",
33
- "pxnpminstall": "2.0.0",
34
- "open": "^8.2.1",
33
+ "open": "^0.0.5",
34
+ "pxnpminstall": "^1.0.5",
35
35
  "urllib": "^2.17.0"
36
36
  },
37
+ "deprecated": false,
38
+ "description": "cnpm: npm client for cnpmjs.org",
37
39
  "devDependencies": {
38
40
  "autod": "^2.7.1",
39
41
  "coffee": "^3.3.0",
@@ -45,14 +47,36 @@
45
47
  "rimraf": "^2.5.4"
46
48
  },
47
49
  "engines": {
48
- "node": ">= 10.0.0"
50
+ "node": ">= 6.0.0"
49
51
  },
50
- "ci": {
51
- "type": "github",
52
- "version": "10, 12, 14, 16",
53
- "os": {
54
- "github": "linux, windows, macos"
55
- }
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"
56
80
  },
57
- "license": "MIT"
81
+ "version": "2.0.3"
58
82
  }