@wooksjs/event-cli 0.2.20 → 0.2.22
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/dist/index.cjs +5 -6
- package/dist/index.mjs +5 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -60,8 +60,8 @@ class WooksCli extends wooks.WooksAdapterBase {
|
|
|
60
60
|
const firstFlagIndex = argv.findIndex((a) => a.startsWith('-')) + 1;
|
|
61
61
|
const pathParams = (firstFlagIndex
|
|
62
62
|
? argv.slice(0, firstFlagIndex - 1)
|
|
63
|
-
: argv)
|
|
64
|
-
const path = '/' + pathParams.join('/');
|
|
63
|
+
: argv);
|
|
64
|
+
const path = '/' + pathParams.map((v) => encodeURIComponent(v)).join('/');
|
|
65
65
|
const { restoreCtx, clearCtx } = createCliContext({ argv, pathParams }, this.mergeEventOptions((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions));
|
|
66
66
|
const handlers = this.wooks.lookup('CLI', path) || ((_b = this.opts) === null || _b === void 0 ? void 0 : _b.onNotFound) && [this.opts.onNotFound] || null;
|
|
67
67
|
if (handlers) {
|
|
@@ -78,7 +78,7 @@ class WooksCli extends wooks.WooksAdapterBase {
|
|
|
78
78
|
: JSON.stringify(r, null, ' ')));
|
|
79
79
|
}
|
|
80
80
|
else if (response instanceof Error) {
|
|
81
|
-
|
|
81
|
+
this.onError(response);
|
|
82
82
|
}
|
|
83
83
|
else if (response) {
|
|
84
84
|
if (response) {
|
|
@@ -116,17 +116,16 @@ class WooksCli extends wooks.WooksAdapterBase {
|
|
|
116
116
|
else {
|
|
117
117
|
this.error('[0m' +
|
|
118
118
|
'Unknown command: ' +
|
|
119
|
-
'[31m' +
|
|
120
119
|
pathParams.join(' '));
|
|
121
120
|
process.exit(1);
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
error(e) {
|
|
125
124
|
if (typeof e === 'string') {
|
|
126
|
-
console.error('[31m' +
|
|
125
|
+
console.error('[31m' + 'ERROR: ' + '[0m' + e);
|
|
127
126
|
}
|
|
128
127
|
else {
|
|
129
|
-
console.error('[31m' +
|
|
128
|
+
console.error('[31m' + 'ERROR: ' + '[0m' + e.message);
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -58,8 +58,8 @@ class WooksCli extends WooksAdapterBase {
|
|
|
58
58
|
const firstFlagIndex = argv.findIndex((a) => a.startsWith('-')) + 1;
|
|
59
59
|
const pathParams = (firstFlagIndex
|
|
60
60
|
? argv.slice(0, firstFlagIndex - 1)
|
|
61
|
-
: argv)
|
|
62
|
-
const path = '/' + pathParams.join('/');
|
|
61
|
+
: argv);
|
|
62
|
+
const path = '/' + pathParams.map((v) => encodeURIComponent(v)).join('/');
|
|
63
63
|
const { restoreCtx, clearCtx } = createCliContext({ argv, pathParams }, this.mergeEventOptions((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions));
|
|
64
64
|
const handlers = this.wooks.lookup('CLI', path) || ((_b = this.opts) === null || _b === void 0 ? void 0 : _b.onNotFound) && [this.opts.onNotFound] || null;
|
|
65
65
|
if (handlers) {
|
|
@@ -76,7 +76,7 @@ class WooksCli extends WooksAdapterBase {
|
|
|
76
76
|
: JSON.stringify(r, null, ' ')));
|
|
77
77
|
}
|
|
78
78
|
else if (response instanceof Error) {
|
|
79
|
-
|
|
79
|
+
this.onError(response);
|
|
80
80
|
}
|
|
81
81
|
else if (response) {
|
|
82
82
|
if (response) {
|
|
@@ -114,17 +114,16 @@ class WooksCli extends WooksAdapterBase {
|
|
|
114
114
|
else {
|
|
115
115
|
this.error('[0m' +
|
|
116
116
|
'Unknown command: ' +
|
|
117
|
-
'[31m' +
|
|
118
117
|
pathParams.join(' '));
|
|
119
118
|
process.exit(1);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
error(e) {
|
|
123
122
|
if (typeof e === 'string') {
|
|
124
|
-
console.error('[31m' +
|
|
123
|
+
console.error('[31m' + 'ERROR: ' + '[0m' + e);
|
|
125
124
|
}
|
|
126
125
|
else {
|
|
127
|
-
console.error('[31m' +
|
|
126
|
+
console.error('[31m' + 'ERROR: ' + '[0m' + e.message);
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"description": "@wooksjs/event-cli",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"wooks": "0.2.
|
|
35
|
-
"@wooksjs/event-core": "0.2.
|
|
34
|
+
"wooks": "0.2.22",
|
|
35
|
+
"@wooksjs/event-core": "0.2.22"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"minimist": "^1.2.6",
|