@hellocoop/quickstart 1.0.10 → 1.0.12
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/package.json +4 -3
- package/quickstart.js +23 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hellocoop/quickstart",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Provides a CLI to start the Hello Quickstart web app and return a client_id",
|
|
5
|
-
"
|
|
5
|
+
"main": "quickstart.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"quickstart": "./index.mjs"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"build": "echo \"No build specified\" && exit 0"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
package/quickstart.js
CHANGED
|
@@ -6,9 +6,31 @@ import * as http from 'http'
|
|
|
6
6
|
import { URLSearchParams, parse } from 'url';
|
|
7
7
|
import page from './page.js'
|
|
8
8
|
|
|
9
|
+
export const validQuickstartParams = [
|
|
10
|
+
'suffix',
|
|
11
|
+
'name',
|
|
12
|
+
'tos_uri',
|
|
13
|
+
'pp_uri',
|
|
14
|
+
'image_uri',
|
|
15
|
+
'dark_image_uri',
|
|
16
|
+
'redirect_uri',
|
|
17
|
+
'integration',
|
|
18
|
+
]
|
|
19
|
+
|
|
9
20
|
const quickstart = async function (params) {
|
|
10
21
|
return new Promise(async (resolve) => {
|
|
11
22
|
|
|
23
|
+
if (!process.stdout.isTTY) {
|
|
24
|
+
const error = new Error('Not running on interactive terminal. Exiting Quickstart CLI')
|
|
25
|
+
console.error(error)
|
|
26
|
+
return error
|
|
27
|
+
}
|
|
28
|
+
const paramKeys = Object.keys(params)
|
|
29
|
+
paramKeys || paramKeys.forEach( param => {
|
|
30
|
+
if (!validQuickstartParams.includes(parm))
|
|
31
|
+
throw(new Error(`Invalid param:${param}`))
|
|
32
|
+
})
|
|
33
|
+
|
|
12
34
|
const port = await getPort()
|
|
13
35
|
const host = 'localhost'
|
|
14
36
|
|
|
@@ -33,7 +55,7 @@ const quickstart = async function (params) {
|
|
|
33
55
|
|
|
34
56
|
const response_uri = `http://${host}:${port}/`
|
|
35
57
|
const queryParams = {
|
|
36
|
-
|
|
58
|
+
... params,
|
|
37
59
|
response_uri,
|
|
38
60
|
}
|
|
39
61
|
const queryString = new URLSearchParams(queryParams).toString();
|