@hellocoop/quickstart 2.3.3 → 2.4.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/next.mjs +15 -6
- package/package.json +1 -1
package/next.mjs
CHANGED
|
@@ -9,30 +9,39 @@ import quickstart from './index.js';
|
|
|
9
9
|
import { randomBytes } from 'crypto'
|
|
10
10
|
|
|
11
11
|
const HELLO_CONFIG_FILE = 'hello.config.js'
|
|
12
|
-
const HELLO_COOP_FILE = 'pages/api/hellocoop.
|
|
12
|
+
const HELLO_COOP_FILE = 'pages/api/hellocoop.ts'
|
|
13
13
|
const ENV_FILE = '.env.local'
|
|
14
14
|
|
|
15
15
|
// check if @hellocoop/nextjs is installed
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
const writeConfig = async (options) => {
|
|
19
|
+
options.wildcard_domain=true
|
|
20
|
+
const client_id = await quickstart(options)
|
|
19
21
|
const filePath = process.cwd()+'/'+HELLO_CONFIG_FILE
|
|
20
22
|
try {
|
|
21
|
-
statSync(filePath)
|
|
22
|
-
|
|
23
|
+
statSync(filePath)
|
|
24
|
+
const append = `
|
|
25
|
+
// added by @hellocoop/quickstart --nextjs on ${(new Date()).toISOString()}
|
|
26
|
+
config.client_id:'${secret}'
|
|
27
|
+
`
|
|
28
|
+
appendFileSync( filePath, append)
|
|
29
|
+
console.log(`\nUpdated ${filePath} with:`)
|
|
30
|
+
console.log(chalk.blueBright(append))
|
|
23
31
|
return
|
|
24
32
|
} catch (err) {
|
|
25
33
|
if (err.code !== 'ENOENT') { // file does not exist
|
|
26
34
|
throw(err)
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
// file does not exist - let's get a client_id and write file
|
|
30
|
-
options.wildcard_domain=true
|
|
31
|
-
const client_id = await quickstart(options)
|
|
32
37
|
const config =`// ${HELLO_CONFIG_FILE}
|
|
38
|
+
import { Config } from '@hellocoop/nextjs'
|
|
33
39
|
|
|
34
40
|
const config = {
|
|
35
41
|
client_id: '${client_id}',
|
|
42
|
+
// see https://hello.dev/docs/sdks/nextjs/#configuration for details
|
|
43
|
+
// scope:[]
|
|
44
|
+
// provider_hint:[]
|
|
36
45
|
}
|
|
37
46
|
export default config
|
|
38
47
|
`
|