@hellocoop/quickstart 2.3.3 → 2.5.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.
Files changed (2) hide show
  1. package/next.mjs +19 -9
  2. package/package.json +1 -1
package/next.mjs CHANGED
@@ -8,31 +8,40 @@ import 'dotenv/config'
8
8
  import quickstart from './index.js';
9
9
  import { randomBytes } from 'crypto'
10
10
 
11
- const HELLO_CONFIG_FILE = 'hello.config.js'
12
- const HELLO_COOP_FILE = 'pages/api/hellocoop.js'
11
+ const HELLO_CONFIG_FILE = 'hello.config.ts'
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
- console.error(`${HELLO_CONFIG_FILE} already exists at:\n${filePath}\nSkipping getting client_id`)
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
  `
@@ -61,8 +70,9 @@ const writeHelloCoop = async () => {
61
70
  }
62
71
 
63
72
  const content = `// ${HELLO_COOP_FILE}
64
-
65
- import config from '../../hello.config.js'
73
+ // generated by @hellocoop/quickstart --nextjs on ${(new Date()).toISOString()}
74
+ // this file should not need to be edited
75
+ import config from '../../hello.config'
66
76
  import { pageAuth } from '@hellocoop/nextjs'
67
77
  export default pageAuth(config)
68
78
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hellocoop/quickstart",
3
- "version": "2.3.3",
3
+ "version": "2.5.0",
4
4
  "description": "A CLI and module to start the Hello Quickstart web app and return a client_id",
5
5
  "main": "index.js",
6
6
  "bin": {