jjb-cmd 2.2.11 → 2.2.13
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/README.md +4 -0
- package/package.json +2 -1
- package/src/new/cmd.auth/index.js +1 -1
- package/src/new/cmd.init/index.js +1 -1
- package/src/new/cmd.install/config.js +1 -1
- package/src/new/cmd.install/index.js +1 -1
- package/src/new/cmd.install/tools.js +1 -1
- package/src/new/cmd.install.app/index.js +1 -1
- package/src/new/cmd.jenkins/index.js +1 -1
- package/src/new/cmd.publish/index.js +1 -1
- package/src/new/cmd.push/index.js +1 -1
- package/src/new/cmd.push/java.js +1 -1
- package/src/new/cmd.push-set/index.js +1 -1
- package/src/new/cmd.refresh/index.js +1 -1
- package/src/new/cmd.reglist/index.js +1 -1
- package/src/new/cmd.rm-rf/index.js +1 -1
- package/src/new/cmd.version/index.js +1 -1
- package/src/old/cli.init.js +1 -1
- package/src/old/cli.install/config.js +1 -1
- package/src/old/cli.install/index.js +1 -1
- package/src/old/cli.install/tools.js +1 -1
- package/src/old/cli.merge.js +1 -1
- package/src/old/cli.pull.js +1 -1
- package/src/old/cli.pull2.js +1 -1
- package/src/old/cli.rm-rf.js +1 -1
- package/src/old/progress-bar.js +1 -1
- package/src/old/util.js +1 -1
- package/bin/command-old.js +0 -65
- package/bin/command.js +0 -185
package/bin/command.js
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
#! /usr/bin/env node
|
2
|
-
|
3
|
-
const commander = require('commander');
|
4
|
-
const readline = require('readline');
|
5
|
-
const path = require('path');
|
6
|
-
const fs = require('fs');
|
7
|
-
const child_process = require('child_process');
|
8
|
-
|
9
|
-
commander.command('v').description('-- 查看版本').action(() => {
|
10
|
-
const package_json_file = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString());
|
11
|
-
const {
|
12
|
-
version
|
13
|
-
} = package_json_file;
|
14
|
-
console.log(`当前版本 v${version}`);
|
15
|
-
});
|
16
|
-
|
17
|
-
commander.command('env [args]').description('-- 切换环境').action(args => {
|
18
|
-
const package_json_file = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString());
|
19
|
-
if (['test', 'prod'].includes(args)) {
|
20
|
-
package_json_file.env = args;
|
21
|
-
fs.writeFileSync(path.join(__dirname, '../package.json'), JSON.stringify(package_json_file));
|
22
|
-
}
|
23
|
-
});
|
24
|
-
|
25
|
-
commander.command('method [args]').description('-- 切换请求方式').action(args => {
|
26
|
-
const package_json_file = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString());
|
27
|
-
if (['http', 'https'].includes(args)) {
|
28
|
-
package_json_file.httpMethod = args;
|
29
|
-
fs.writeFileSync(path.join(__dirname, '../package.json'), JSON.stringify(package_json_file));
|
30
|
-
}
|
31
|
-
});
|
32
|
-
|
33
|
-
commander.command('pushMessage [args]').description('-- 设置publish提交时是否需要提交信息').action(args => {
|
34
|
-
const package_json_file = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')).toString());
|
35
|
-
if (['yes', 'no'].includes(args)) {
|
36
|
-
package_json_file.pushMessage = args;
|
37
|
-
fs.writeFileSync(path.join(__dirname, '../package.json'), JSON.stringify(package_json_file));
|
38
|
-
}
|
39
|
-
});
|
40
|
-
|
41
|
-
commander.command('view res').description('-- 预览资源').action(() => {
|
42
|
-
console.log('当前可资源:');
|
43
|
-
console.log('[common, react-admin-component]');
|
44
|
-
});
|
45
|
-
|
46
|
-
commander.command('link').option('-A').description('-- 创建符号链接').action(args => {
|
47
|
-
let dirList = [];
|
48
|
-
const hasFlag = args.A;
|
49
|
-
const root_path = path.resolve('./');
|
50
|
-
let r1 = readline.createInterface({
|
51
|
-
input: process.stdin,
|
52
|
-
output: process.stdout
|
53
|
-
});
|
54
|
-
r1.question('Target Path:', function (answer) {
|
55
|
-
const arr = answer.split('\\');
|
56
|
-
const name = arr.length
|
57
|
-
? arr[ arr.length - 1 ]
|
58
|
-
: '';
|
59
|
-
if (hasFlag) {
|
60
|
-
dirList = dirList.concat(fs.readdirSync(root_path).map(dir => {
|
61
|
-
return `${root_path}\\${dir}`;
|
62
|
-
}).filter(dir => fs.statSync(dir).isDirectory()).map(dir => {
|
63
|
-
return {
|
64
|
-
dir: dir + '\\' + name,
|
65
|
-
link: answer
|
66
|
-
};
|
67
|
-
}));
|
68
|
-
} else {
|
69
|
-
dirList = dirList.concat(root_path).map(dir => {
|
70
|
-
return {
|
71
|
-
dir: dir + '\\' + name,
|
72
|
-
link: answer
|
73
|
-
};
|
74
|
-
});
|
75
|
-
}
|
76
|
-
dirList.forEach(item => {
|
77
|
-
child_process.execSync(`mklink /D ${item.dir} ${item.link}`, (error, stdout) => {
|
78
|
-
if (!error) {
|
79
|
-
console.log(stdout);
|
80
|
-
}
|
81
|
-
});
|
82
|
-
});
|
83
|
-
console.log('执行完成。');
|
84
|
-
process.exit(0);
|
85
|
-
});
|
86
|
-
r1.on('close', () => process.exit(0));
|
87
|
-
});
|
88
|
-
|
89
|
-
// auth 命令
|
90
|
-
commander.command('auth [args]').description('-- 授权').action(args => {
|
91
|
-
require('../src/new/cmd.auth/index.js')(process.argv.splice(3));
|
92
|
-
});
|
93
|
-
|
94
|
-
//动态host方式发布包 jjb-cmd push-set http://api latest
|
95
|
-
commander.command('push-set [args]').description('-- 动态host方式发布包').action(args => {
|
96
|
-
require('../src/new/cmd.push-set/index.js')(process.argv.splice(3));
|
97
|
-
});
|
98
|
-
|
99
|
-
commander.command('publish [args]').description('-- 发布包').action(args => {
|
100
|
-
require('../src/new/cmd.publish/index.js')(args);
|
101
|
-
});
|
102
|
-
|
103
|
-
//jenkins模拟请求
|
104
|
-
commander.command('jenkins [args]').description('-- 发布包').action(args => {
|
105
|
-
require('../src/new/cmd.jenkins/index.js')(args);
|
106
|
-
});
|
107
|
-
|
108
|
-
// publish 命令
|
109
|
-
commander.command('push [args]').description('-- 发布包').action(args => {
|
110
|
-
if (args) {
|
111
|
-
if ([
|
112
|
-
'server',
|
113
|
-
'version',
|
114
|
-
'v',
|
115
|
-
'latest',
|
116
|
-
'beta',
|
117
|
-
'components'
|
118
|
-
].includes(args)) {
|
119
|
-
if ([
|
120
|
-
'v',
|
121
|
-
'version'
|
122
|
-
].includes(args)) {
|
123
|
-
require('../src/new/cmd.version/index.js')();
|
124
|
-
}
|
125
|
-
if ([
|
126
|
-
'server',
|
127
|
-
'components'
|
128
|
-
].includes(args)) {
|
129
|
-
require('../src/new/cmd.reglist/index.js')(args);
|
130
|
-
}
|
131
|
-
if ([ 'latest', 'beta' ].includes(args)) {
|
132
|
-
require('../src/new/cmd.push/index.js')(args);
|
133
|
-
}
|
134
|
-
} else if (['java'].includes(args)) {
|
135
|
-
require('../src/new/cmd.push/java.js')(process.argv.splice(3));
|
136
|
-
} else {
|
137
|
-
console.log(`无效的选项‘${args}’。`);
|
138
|
-
process.exit(0);
|
139
|
-
}
|
140
|
-
} else {
|
141
|
-
require('../src/new/cmd.push/index.js')(null);
|
142
|
-
}
|
143
|
-
});
|
144
|
-
|
145
|
-
// reglist 命令
|
146
|
-
commander.command('reg [args]').description('-- 查询注册表').action(a => {
|
147
|
-
// require('../src/new/cmd.reglist/index.js')();
|
148
|
-
});
|
149
|
-
|
150
|
-
// init 命令
|
151
|
-
commander.command('init -- <templateName>').description('-- 初始化模板').action(stdin => {
|
152
|
-
if ([
|
153
|
-
'lib',
|
154
|
-
'react-component',
|
155
|
-
'micro-app',
|
156
|
-
'micro-app-ts'
|
157
|
-
].includes(stdin)) {
|
158
|
-
require('../src/new/cmd.init/index.js')(stdin);
|
159
|
-
} else {
|
160
|
-
console.log(`初始化失败,未能正确输入模板类型,仅支持(lib,react-component,micro-app,micro-app-ts)模板。`);
|
161
|
-
process.exit(0);
|
162
|
-
}
|
163
|
-
});
|
164
|
-
|
165
|
-
// rm-rf 命令
|
166
|
-
commander.command('rm-rf').description('-- 删除全部').action(() => {
|
167
|
-
require('../src/new/cmd.rm-rf/index.js')();
|
168
|
-
});
|
169
|
-
|
170
|
-
// install 安装
|
171
|
-
commander.command('install').description('-- 安装').action(() => {
|
172
|
-
require('../src/new/cmd.install/index.js')();
|
173
|
-
});
|
174
|
-
|
175
|
-
// install 安装
|
176
|
-
commander.command('install.app').description('-- 安装').action(stdin => {
|
177
|
-
require('../src/new/cmd.install.app/index.js')(stdin);
|
178
|
-
});
|
179
|
-
|
180
|
-
//从服务端更新本地文件
|
181
|
-
commander.command('refresh').description('-- 更新').action(stdin => {
|
182
|
-
require('../src/new/cmd.refresh/index.js')(stdin);
|
183
|
-
});
|
184
|
-
|
185
|
-
commander.parse(process.argv);
|