para-cli 1.22.4 → 1.23.0
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 +1 -9
- package/index.js +20 -5
- package/package.json +8 -8
- package/para-cli.js +2 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Para Command-Line Interface (CLI)
|
|
4
4
|
|
|
5
|
-
[![NPM version][
|
|
5
|
+
[![NPM version][https://badge.fury.io/js/para-cli.svg]][https://npmjs.org/package/para-cli]
|
|
6
6
|
[](https://gitter.im/Erudika/para?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
7
7
|
|
|
8
8
|
## What is this?
|
|
@@ -165,11 +165,3 @@ For more information see [CONTRIBUTING.md](https://github.com/Erudika/para/blob/
|
|
|
165
165
|
|
|
166
166
|
## License
|
|
167
167
|
[Apache 2.0](LICENSE)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
[npm-image]: https://badge.fury.io/js/para-cli.svg
|
|
171
|
-
[npm-url]: https://npmjs.org/package/para-cli
|
|
172
|
-
[travis-image]: https://travis-ci.org/Erudika/para-cli.svg?branch=master
|
|
173
|
-
[travis-url]: https://travis-ci.org/Erudika/para-cli
|
|
174
|
-
[daviddm-image]: https://david-dm.org/Erudika/para-cli.svg?theme=shields.io
|
|
175
|
-
[daviddm-url]: https://david-dm.org/Erudika/para-cli
|
package/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var encoder = new TextEncoder('utf-8');
|
|
|
32
32
|
import striptags from 'striptags';
|
|
33
33
|
import { Parser } from 'htmlparser2';
|
|
34
34
|
import { createInterface } from 'readline';
|
|
35
|
+
import { Writable } from 'stream';
|
|
35
36
|
import jsonwebtoken from 'jsonwebtoken';
|
|
36
37
|
import { lookup } from 'mime-types';
|
|
37
38
|
import { globbySync } from 'globby';
|
|
@@ -48,14 +49,28 @@ var defaultConfig = { accessKey: '', secretKey: '', endpoint: 'https://paraio.co
|
|
|
48
49
|
const _defaultConfig = defaultConfig;
|
|
49
50
|
export { _defaultConfig as defaultConfig };
|
|
50
51
|
|
|
51
|
-
export function setup(config) {
|
|
52
|
+
export async function setup(config) {
|
|
53
|
+
var secretPrompt = cyan.bold('Para Secret Key: ');
|
|
54
|
+
var mutableStdout = new Writable({
|
|
55
|
+
write: function (chunk, encoding, callback) {
|
|
56
|
+
if (!this.muted || (chunk.toString() === secretPrompt))
|
|
57
|
+
process.stdout.write(chunk, encoding);
|
|
58
|
+
else if (this.muted && chunk.length === 1)
|
|
59
|
+
process.stdout.write(Buffer.from("*".repeat(Math.random() * 5)), encoding);
|
|
60
|
+
callback();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
52
63
|
var rl = createInterface({
|
|
53
64
|
input: process.stdin,
|
|
54
|
-
output:
|
|
65
|
+
output: mutableStdout,
|
|
66
|
+
terminal: true
|
|
55
67
|
});
|
|
68
|
+
mutableStdout.muted = false;
|
|
56
69
|
rl.question(cyan.bold('Para Access Key: '), function (accessKey) {
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
mutableStdout.muted = true;
|
|
71
|
+
rl.question(secretPrompt, function (secretKey) {
|
|
72
|
+
mutableStdout.muted = false;
|
|
73
|
+
rl.question(cyan.bold('Para Endpoint (Press enter for ' + defaultConfig.endpoint + '): '), function (endpoint) {
|
|
59
74
|
var access = (accessKey || config.get('accessKey') || "app:para").trim();
|
|
60
75
|
var secret = (secretKey || config.get('secretKey')).trim();
|
|
61
76
|
var endpoint = (endpoint || defaultConfig.endpoint).trim();
|
|
@@ -286,7 +301,7 @@ export function newJWT(accessKey, secretKey, endpoint, config, flags) {
|
|
|
286
301
|
}
|
|
287
302
|
config.set('endpoint', endpoint || config.get('endpoint'));
|
|
288
303
|
config.set('jwt', sign(sClaim, secretKey, { algorithm: 'HS256' }));
|
|
289
|
-
if (flags.print) {
|
|
304
|
+
if (flags && flags.print) {
|
|
290
305
|
console.log(yellow(config.get('jwt')));
|
|
291
306
|
} else {
|
|
292
307
|
console.log(green('✔'), 'New JWT generated and saved in', yellow(config.path));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "para-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Command-line tool for Para backend servers",
|
|
6
6
|
"homepage": "https://paraio.org",
|
|
@@ -26,25 +26,25 @@
|
|
|
26
26
|
"api"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"eslint": "^
|
|
29
|
+
"eslint": "^10.0.0"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
33
|
"url": "git+https://github.com/Erudika/para-cli.git"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"brace-expansion": "^
|
|
36
|
+
"brace-expansion": "^5.0.2",
|
|
37
37
|
"chalk": "^5.6.2",
|
|
38
|
-
"conf": "^15.0
|
|
38
|
+
"conf": "^15.1.0",
|
|
39
39
|
"exit": "^0.1.2",
|
|
40
|
-
"figlet": "^1.
|
|
41
|
-
"get-stdin": "^
|
|
40
|
+
"figlet": "^1.10.0",
|
|
41
|
+
"get-stdin": "^10.0.0",
|
|
42
42
|
"globby": "^16.1.0",
|
|
43
|
-
"htmlparser2": "^10.
|
|
43
|
+
"htmlparser2": "^10.1.0",
|
|
44
44
|
"jsonwebtoken": "^9.0.3",
|
|
45
45
|
"meow": "^14.0.0",
|
|
46
46
|
"mime-types": "^3.0.2",
|
|
47
|
-
"para-client-js": "^1.40.
|
|
47
|
+
"para-client-js": "^1.40.4",
|
|
48
48
|
"resolve": "^1.22.11",
|
|
49
49
|
"striptags": "^3.2.0",
|
|
50
50
|
"update-notifier": "^7.3.1",
|
package/para-cli.js
CHANGED
|
@@ -131,12 +131,12 @@ if (!input[0]) {
|
|
|
131
131
|
console.error(red('Command ' + input[0] + ' failed! Blank credentials, running setup first...'));
|
|
132
132
|
console.log("Please enter the access key and secret key for the root app 'app:para' first.");
|
|
133
133
|
process.exitCode = 1;
|
|
134
|
-
setup(config);
|
|
134
|
+
await setup(config);
|
|
135
135
|
} else {
|
|
136
136
|
var pc = new ParaClient(accessKey, secretKey, parseEndpoint(endpoint));
|
|
137
137
|
|
|
138
138
|
if (input[0] === 'setup') {
|
|
139
|
-
setup(config);
|
|
139
|
+
await setup(config);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
if (input[0] === 'apps') {
|
|
@@ -221,4 +221,3 @@ if (!input[0]) {
|
|
|
221
221
|
types(pc, config);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
|