Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit 4b3ed43

Browse files
committed
fix node version check and envid params
1 parent 2e7c884 commit 4b3ed43

8 files changed

Lines changed: 39 additions & 43 deletions

File tree

bin/cloudbase.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ const pkg = require('../package.json')
1212
let processArgv = process.argv
1313
const isBeta = pkg.version.indexOf('-') > -1
1414

15-
const userNodeVersion = Number(
16-
process.versions.node
17-
.split('.')
18-
.slice(0, 2)
19-
.join('.')
20-
)
15+
const [major, minor] = process.versions.node.split('.').slice(0, 2)
2116

2217
// Node 版本检验提示
23-
if (userNodeVersion < 8.6) {
18+
if (Number(major) < 8 || (Number(major) === 8 && Number(minor) < 6)) {
2419
console.log(
2520
chalk.bold.red(
2621
'您的 Node 版本较低,CloudBase CLI 可能无法正常运行,请升级 Node 到 v8.6.0 以上!\n'

lib/commands/gateway/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const commands = [
4040
cmd: 'service:create',
4141
options: [
4242
{
43-
flags: '-e, --envId [envId]',
43+
flags: '-e, --envId <envId>',
4444
desc: '环境 Id'
4545
},
4646
{
@@ -63,7 +63,7 @@ const commands = [
6363
cmd: 'service:delete',
6464
options: [
6565
{
66-
flags: '-e, --envId [envId]',
66+
flags: '-e, --envId <envId>',
6767
desc: '环境 Id'
6868
},
6969
{
@@ -86,7 +86,7 @@ const commands = [
8686
cmd: 'service:list',
8787
options: [
8888
{
89-
flags: '-e, --envId [envId]',
89+
flags: '-e, --envId <envId>',
9090
desc: '环境 Id'
9191
},
9292
{
@@ -113,7 +113,7 @@ const commands = [
113113
cmd: 'service:domain:bind <domain>',
114114
options: [
115115
{
116-
flags: '-e, --envId [envId]',
116+
flags: '-e, --envId <envId>',
117117
desc: '环境 Id'
118118
}
119119
],
@@ -128,7 +128,7 @@ const commands = [
128128
cmd: 'service:domain:unbind <domain>',
129129
options: [
130130
{
131-
flags: '-e, --envId [envId]',
131+
flags: '-e, --envId <envId>',
132132
desc: '环境 Id'
133133
}
134134
],
@@ -143,7 +143,7 @@ const commands = [
143143
cmd: 'service:domain:list',
144144
options: [
145145
{
146-
flags: '-e, --envId [envId]',
146+
flags: '-e, --envId <envId>',
147147
desc: '环境 Id'
148148
},
149149
{

lib/commands/hosting.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const HostingStatusMap = {
3030
};
3131
commander_1.default
3232
.command('hosting:detail')
33-
.option('-e, --envId [envId]', '环境 Id')
33+
.option('-e, --envId <envId>', '环境 Id')
3434
.description('查看静态网站服务信息')
3535
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
3636
const { parent: { configFile }, envId } = options;
@@ -48,7 +48,7 @@ commander_1.default
4848
}));
4949
commander_1.default
5050
.command('hosting:deploy [filePath] [cloudPath]')
51-
.option('-e, --envId [envId]', '环境 Id')
51+
.option('-e, --envId <envId>', '环境 Id')
5252
.description('部署静态网站文件')
5353
.action((filePath, cloudPath = '', options) => __awaiter(void 0, void 0, void 0, function* () {
5454
const { parent: { configFile }, envId } = options;
@@ -74,7 +74,7 @@ commander_1.default
7474
}));
7575
commander_1.default
7676
.command('hosting:delete [cloudPath]')
77-
.option('-e, --envId [envId]', '环境 Id')
77+
.option('-e, --envId <envId>', '环境 Id')
7878
.option('-d, --dir', '删除目标是否为文件夹')
7979
.description('删除静态网站文件/文件夹,文件夹需指定 --dir 选项')
8080
.action((cloudPath = '', options) => __awaiter(void 0, void 0, void 0, function* () {
@@ -111,7 +111,7 @@ commander_1.default
111111
}));
112112
commander_1.default
113113
.command('hosting:list')
114-
.option('-e, --envId [envId]', '环境 Id')
114+
.option('-e, --envId <envId>', '环境 Id')
115115
.description('展示文件列表')
116116
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
117117
const { parent: { configFile }, envId } = options;

lib/commands/storage.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const AclMap = {
4141
};
4242
commander_1.default
4343
.command('storage:upload <localPath> [cloudPath]')
44-
.option('-e, --envId [envId]', '环境 Id')
44+
.option('-e, --envId <envId>', '环境 Id')
4545
.description('上传文件/文件夹')
4646
.action(function (localPath, cloudPath = '', options) {
4747
return __awaiter(this, void 0, void 0, function* () {
@@ -70,7 +70,7 @@ commander_1.default
7070
});
7171
commander_1.default
7272
.command('storage:download <cloudPath> <localPath>')
73-
.option('-e, --envId [envId]', '环境 Id')
73+
.option('-e, --envId <envId>', '环境 Id')
7474
.option('-d, --dir', '下载目标是否为文件夹')
7575
.description('下载文件/文件夹,文件夹需指定 --dir 选项')
7676
.action(function (cloudPath, localPath, options) {
@@ -97,7 +97,7 @@ commander_1.default
9797
});
9898
commander_1.default
9999
.command('storage:delete <cloudPath>')
100-
.option('-e, --envId [envId]', '环境 Id')
100+
.option('-e, --envId <envId>', '环境 Id')
101101
.option('-d, --dir', '下载目标是否为文件夹')
102102
.description('删除文件/文件夹,文件夹需指定 --dir 选项')
103103
.action(function (cloudPath, options) {
@@ -120,7 +120,7 @@ commander_1.default
120120
});
121121
commander_1.default
122122
.command('storage:list [cloudPath]')
123-
.option('-e, --envId [envId]', '环境 Id')
123+
.option('-e, --envId <envId>', '环境 Id')
124124
.option('--max', '传输数据的最大条数')
125125
.option('--markder', '起始路径名,后(不含)按照 UTF-8 字典序返回条目')
126126
.description('获取文件存储的文件列表')
@@ -146,7 +146,7 @@ commander_1.default
146146
});
147147
commander_1.default
148148
.command('storage:url <cloudPath>')
149-
.option('-e, --envId [envId]', '环境 Id')
149+
.option('-e, --envId <envId>', '环境 Id')
150150
.description('获取文件临时访问地址')
151151
.action(function (cloudPath, options) {
152152
return __awaiter(this, void 0, void 0, function* () {
@@ -160,7 +160,7 @@ commander_1.default
160160
});
161161
commander_1.default
162162
.command('storage:detail <cloudPath>')
163-
.option('-e, --envId [envId]', '环境 Id')
163+
.option('-e, --envId <envId>', '环境 Id')
164164
.description('获取文件信息')
165165
.action(function (cloudPath, options) {
166166
return __awaiter(this, void 0, void 0, function* () {
@@ -176,7 +176,7 @@ commander_1.default
176176
});
177177
commander_1.default
178178
.command('storage:get-acl')
179-
.option('-e, --envId [envId]', '环境 Id')
179+
.option('-e, --envId <envId>', '环境 Id')
180180
.description('获取文件存储权限信息')
181181
.action(function (options) {
182182
return __awaiter(this, void 0, void 0, function* () {
@@ -189,7 +189,7 @@ commander_1.default
189189
});
190190
commander_1.default
191191
.command('storage:set-acl')
192-
.option('-e, --envId [envId]', '环境 Id')
192+
.option('-e, --envId <envId>', '环境 Id')
193193
.description('设置文件存储权限信息')
194194
.action(function (options) {
195195
return __awaiter(this, void 0, void 0, function* () {

scripts/publish.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-require-imports */
12
const inquirer = require('inquirer')
23
const semver = require('semver')
34
const package = require('../package.json')

src/commands/gateway/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const commands = [
3535
cmd: 'service:create',
3636
options: [
3737
{
38-
flags: '-e, --envId [envId]',
38+
flags: '-e, --envId <envId>',
3939
desc: '环境 Id'
4040
},
4141
{
@@ -64,7 +64,7 @@ const commands = [
6464
cmd: 'service:delete',
6565
options: [
6666
{
67-
flags: '-e, --envId [envId]',
67+
flags: '-e, --envId <envId>',
6868
desc: '环境 Id'
6969
},
7070
{
@@ -93,7 +93,7 @@ const commands = [
9393
cmd: 'service:list',
9494
options: [
9595
{
96-
flags: '-e, --envId [envId]',
96+
flags: '-e, --envId <envId>',
9797
desc: '环境 Id'
9898
},
9999
{
@@ -126,7 +126,7 @@ const commands = [
126126
cmd: 'service:domain:bind <domain>',
127127
options: [
128128
{
129-
flags: '-e, --envId [envId]',
129+
flags: '-e, --envId <envId>',
130130
desc: '环境 Id'
131131
}
132132
],
@@ -148,7 +148,7 @@ const commands = [
148148
cmd: 'service:domain:unbind <domain>',
149149
options: [
150150
{
151-
flags: '-e, --envId [envId]',
151+
flags: '-e, --envId <envId>',
152152
desc: '环境 Id'
153153
}
154154
],
@@ -170,7 +170,7 @@ const commands = [
170170
cmd: 'service:domain:list',
171171
options: [
172172
{
173-
flags: '-e, --envId [envId]',
173+
flags: '-e, --envId <envId>',
174174
desc: '环境 Id'
175175
},
176176
{

src/commands/hosting.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const HostingStatusMap = {
2626

2727
program
2828
.command('hosting:detail')
29-
.option('-e, --envId [envId]', '环境 Id')
29+
.option('-e, --envId <envId>', '环境 Id')
3030
.description('查看静态网站服务信息')
3131
.action(async (options: any) => {
3232
const {
@@ -54,7 +54,7 @@ program
5454

5555
program
5656
.command('hosting:deploy [filePath] [cloudPath]')
57-
.option('-e, --envId [envId]', '环境 Id')
57+
.option('-e, --envId <envId>', '环境 Id')
5858
.description('部署静态网站文件')
5959
.action(async (filePath: string, cloudPath = '', options: any) => {
6060
const {
@@ -85,7 +85,7 @@ program
8585

8686
program
8787
.command('hosting:delete [cloudPath]')
88-
.option('-e, --envId [envId]', '环境 Id')
88+
.option('-e, --envId <envId>', '环境 Id')
8989
.option('-d, --dir', '删除目标是否为文件夹')
9090
.description('删除静态网站文件/文件夹,文件夹需指定 --dir 选项')
9191
.action(async (cloudPath = '', options: any) => {
@@ -131,7 +131,7 @@ program
131131

132132
program
133133
.command('hosting:list')
134-
.option('-e, --envId [envId]', '环境 Id')
134+
.option('-e, --envId <envId>', '环境 Id')
135135
.description('展示文件列表')
136136
.action(async (options: any) => {
137137
const {

src/commands/storage.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const AclMap = {
3939

4040
program
4141
.command('storage:upload <localPath> [cloudPath]')
42-
.option('-e, --envId [envId]', '环境 Id')
42+
.option('-e, --envId <envId>', '环境 Id')
4343
.description('上传文件/文件夹')
4444
.action(async function(localPath: string, cloudPath = '', options) {
4545
const {
@@ -72,7 +72,7 @@ program
7272

7373
program
7474
.command('storage:download <cloudPath> <localPath>')
75-
.option('-e, --envId [envId]', '环境 Id')
75+
.option('-e, --envId <envId>', '环境 Id')
7676
.option('-d, --dir', '下载目标是否为文件夹')
7777
.description('下载文件/文件夹,文件夹需指定 --dir 选项')
7878
.action(async function(cloudPath: string, localPath: string, options) {
@@ -106,7 +106,7 @@ program
106106

107107
program
108108
.command('storage:delete <cloudPath>')
109-
.option('-e, --envId [envId]', '环境 Id')
109+
.option('-e, --envId <envId>', '环境 Id')
110110
.option('-d, --dir', '下载目标是否为文件夹')
111111
.description('删除文件/文件夹,文件夹需指定 --dir 选项')
112112
.action(async function(cloudPath: string, options) {
@@ -133,7 +133,7 @@ program
133133

134134
program
135135
.command('storage:list [cloudPath]')
136-
.option('-e, --envId [envId]', '环境 Id')
136+
.option('-e, --envId <envId>', '环境 Id')
137137
.option('--max', '传输数据的最大条数')
138138
.option('--markder', '起始路径名,后(不含)按照 UTF-8 字典序返回条目')
139139
.description('获取文件存储的文件列表')
@@ -164,7 +164,7 @@ program
164164

165165
program
166166
.command('storage:url <cloudPath>')
167-
.option('-e, --envId [envId]', '环境 Id')
167+
.option('-e, --envId <envId>', '环境 Id')
168168
.description('获取文件临时访问地址')
169169
.action(async function(cloudPath: string, options) {
170170
const {
@@ -181,7 +181,7 @@ program
181181

182182
program
183183
.command('storage:detail <cloudPath>')
184-
.option('-e, --envId [envId]', '环境 Id')
184+
.option('-e, --envId <envId>', '环境 Id')
185185
.description('获取文件信息')
186186
.action(async function(cloudPath: string, options) {
187187
const {
@@ -201,7 +201,7 @@ program
201201

202202
program
203203
.command('storage:get-acl')
204-
.option('-e, --envId [envId]', '环境 Id')
204+
.option('-e, --envId <envId>', '环境 Id')
205205
.description('获取文件存储权限信息')
206206
.action(async function(options) {
207207
const {
@@ -218,7 +218,7 @@ program
218218

219219
program
220220
.command('storage:set-acl')
221-
.option('-e, --envId [envId]', '环境 Id')
221+
.option('-e, --envId <envId>', '环境 Id')
222222
.description('设置文件存储权限信息')
223223
.action(async function(options) {
224224
const {

0 commit comments

Comments
 (0)