@hellocoop/quickstart 2.2.1 → 2.3.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/index.js +2 -2
- package/package.json +1 -1
- package/page.js +2 -41
- package/quickstart.mjs +47 -24
package/index.js
CHANGED
|
@@ -67,8 +67,8 @@ const quickstart = async function (params) {
|
|
|
67
67
|
const hellooDomain = process.env.HELLO_DOMAIN || 'hello.coop'
|
|
68
68
|
const quickstartURL = `https://quickstart.${hellooDomain}/?${queryString}`
|
|
69
69
|
server.listen(port, host, () => {
|
|
70
|
-
console.log('\nObtaining a client_id with Hellō Quickstart')
|
|
71
|
-
console.log(
|
|
70
|
+
console.log('\nObtaining a client_id with Hellō Quickstart\n')
|
|
71
|
+
console.log(chalk.blueBright(quickstartURL))
|
|
72
72
|
const rl = readline.createInterface({
|
|
73
73
|
input: process.stdin,
|
|
74
74
|
output: process.stdout
|
package/package.json
CHANGED
package/page.js
CHANGED
|
@@ -9,55 +9,16 @@ export default function (client_id) {
|
|
|
9
9
|
<style>
|
|
10
10
|
* { padding: 0; margin: 0; border: none; box-sizing: border-box; }
|
|
11
11
|
html, body { height: 100%; }
|
|
12
|
-
a { color: inherit;text-decoration: none; }
|
|
13
|
-
a:hover, a:focus { text-decoration: underline; }
|
|
14
|
-
a::after {
|
|
15
|
-
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="18" style="margin-left: 4px; margin-top: 4px; opacity: 0.8;" fill="none" viewBox="0 0 28 28" stroke="%23303030"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg>')
|
|
16
|
-
}
|
|
17
|
-
.flash { animation: flash-animation 0.5s ease-in-out; }
|
|
18
|
-
@keyframes flash-animation {
|
|
19
|
-
0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; }
|
|
20
|
-
}
|
|
21
12
|
@media (prefers-color-scheme: dark) {
|
|
22
13
|
body { background-color: #151515; }
|
|
23
14
|
body, header, #client-id { color: #d4d4d4 !important; }
|
|
24
|
-
#client-id { background-color: #303030 !important; }
|
|
25
|
-
a::after { filter: invert(1); }
|
|
26
15
|
}
|
|
27
16
|
</style>
|
|
28
|
-
<script>
|
|
29
|
-
async function copyClientId() {
|
|
30
|
-
await navigator.clipboard.writeText("${client_id}")
|
|
31
|
-
//copy flash animation
|
|
32
|
-
document.querySelector("#client-id").classList.add("flash")
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
document.querySelector("#client-id").classList.remove("flash")
|
|
35
|
-
}, 500)
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
17
|
</head>
|
|
39
18
|
<body style="display: flex; flex-direction: column; color: #303030; font-family: ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;">
|
|
40
|
-
<header style="background-color: #303030; color: white; height: 48px; display: flex; justify-content: center; align-items: center; font-size: 1.25rem; font-weight: 600;">Hellō Quickstart
|
|
19
|
+
<header style="background-color: #303030; color: white; height: 48px; display: flex; justify-content: center; align-items: center; font-size: 1.25rem; font-weight: 600;">Hellō Quickstart Complete</header>
|
|
41
20
|
<main style="flex: 1; padding: 24px; display: flex; flex-direction: column; align-items: center;">
|
|
42
|
-
<
|
|
43
|
-
<label for="client-id" style="font-size: 14px; font-weight: 500; text-align: left;">Client ID</label>
|
|
44
|
-
<button id="client-id" onclick="copyClientId()" style="padding: 8px 0; height: auto; margin-top: 4px; text-align: left; border-radius: 6px; padding-left: 12px; padding-right: 12px; display: inline-flex; align-items: center; justify-content: center; background-color: #CBCFD5; color: #303030; font-size: 20px; cursor: pointer;">
|
|
45
|
-
<span style="margin-right: 8px; font-family: monospace;">${client_id}</span>
|
|
46
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="height: 1.25rem; width: 1.25rem" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
|
|
47
|
-
</button>
|
|
48
|
-
</div>
|
|
49
|
-
<div style="margin-top: 24px; display: flex; flex-direction: column; align-items: flex-start;">
|
|
50
|
-
You can update the:
|
|
51
|
-
<ul style="margin: 10px 0; list-style-position: inside;">
|
|
52
|
-
<li>Application Logo</li>
|
|
53
|
-
<li>Application Name</li>
|
|
54
|
-
<li>Terms of Service URL</li>
|
|
55
|
-
<li>Privacy Policy URL</li>
|
|
56
|
-
<li>Redirect URIs</li>
|
|
57
|
-
</ul>
|
|
58
|
-
<a href="https://console.hello.coop/?client_id=${client_id}" style="font-weight: 500;">at the Hellō Developer Console</a>
|
|
59
|
-
</div>
|
|
60
|
-
<p style="margin: 48px 0; font-size: 26px;">You may now close this window.</p>
|
|
21
|
+
<p style="margin: 48px 0; font-size: 26px;">you may now close this window</p>
|
|
61
22
|
</main>
|
|
62
23
|
</body>
|
|
63
24
|
</html>`
|
package/quickstart.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import semver from 'semver';
|
|
3
3
|
import * as fs from 'fs'
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
|
|
5
6
|
const requiredVersion = '>=18.3.0';
|
|
6
7
|
|
|
@@ -19,10 +20,13 @@ if (!process.stdout.isTTY) {
|
|
|
19
20
|
process.exit(1);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
values: { provider_hint, suffix, file, secret, wildcard, integration, debug },
|
|
23
|
+
let {
|
|
24
|
+
values: { nextjs, provider_hint, suffix, file, secret, wildcard, integration, debug },
|
|
24
25
|
} = parseArgs({
|
|
25
26
|
options: {
|
|
27
|
+
nextjs: {
|
|
28
|
+
type: "boolean"
|
|
29
|
+
},
|
|
26
30
|
provider_hint: {
|
|
27
31
|
type: "string",
|
|
28
32
|
short: "p",
|
|
@@ -66,28 +70,41 @@ if (existingClientId) {
|
|
|
66
70
|
process.exit(0);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
console.log(` suffix="${suffix}"`)
|
|
75
|
-
if (integration)
|
|
76
|
-
console.log(` integration="${integration}"`)
|
|
77
|
-
if (file)
|
|
78
|
-
console.log(` writing output to "${file}"`)
|
|
79
|
-
console.log(` generate secret=${secret}`)
|
|
80
|
-
console.log(` enable wildcard=${wildcard}\n`);
|
|
73
|
+
if (nextjs) {
|
|
74
|
+
wildcard = true
|
|
75
|
+
secret = true
|
|
76
|
+
file = '.env'
|
|
77
|
+
provider_hint = 'github gitlab google email--'
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
(async () => {
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
81
|
+
const options = {}
|
|
82
|
+
|
|
83
|
+
debug && console.log('Hellō Quickstart parameters:')
|
|
84
|
+
if (provider_hint) {
|
|
85
|
+
options.provider_hint = provider_hint
|
|
86
|
+
debug && console.log(` provider_hint="${provider_hint}"`)
|
|
87
|
+
}
|
|
88
|
+
if (suffix) {
|
|
89
|
+
options.suffix = suffix
|
|
90
|
+
debug && console.log(` suffix="${suffix}"`)
|
|
91
|
+
}
|
|
92
|
+
if (integration) {
|
|
93
|
+
options.integration = integration
|
|
94
|
+
debug && console.log(` integration="${integration}"`)
|
|
95
|
+
}
|
|
96
|
+
if (file) {
|
|
97
|
+
debug && console.log(` writing output to "${file}"`)
|
|
98
|
+
}
|
|
99
|
+
if (wildcard) {
|
|
100
|
+
options.wildcard_domain = wildcard
|
|
101
|
+
debug && console.log(` enable wildcard=${wildcard}\n`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
debug && console.log(` generate secret=${secret}`);
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
(async () => {
|
|
91
108
|
|
|
92
109
|
const output = {}
|
|
93
110
|
try {
|
|
@@ -117,9 +134,15 @@ HELLO_COOKIE_SECRET='${output.secret}'
|
|
|
117
134
|
process.exit(1)
|
|
118
135
|
}
|
|
119
136
|
console.log(`\nUpdated ${outputFile} with:`)
|
|
120
|
-
console.log(helloConfig
|
|
121
|
-
|
|
122
|
-
|
|
137
|
+
console.log(chalk.blueBright(helloConfig))
|
|
138
|
+
console.log(
|
|
139
|
+
`You can update the:
|
|
140
|
+
- Application Logo
|
|
141
|
+
- Application Name
|
|
142
|
+
- Terms of Service URL
|
|
143
|
+
- Privacy Policy URL
|
|
144
|
+
- Redirect URIs
|
|
145
|
+
at the Hellō Developer Console https://console.hello.coop`)
|
|
123
146
|
}
|
|
124
147
|
|
|
125
148
|
})();
|