@bagelink/sdk 0.0.507 → 0.0.511
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/bin/index.ts +9 -3
- package/package.json +1 -1
package/bin/index.ts
CHANGED
|
@@ -19,6 +19,8 @@ const baseURL = `${env.VITE_BAGEL_BASE_URL}/openapi.json`
|
|
|
19
19
|
|
|
20
20
|
const dirFlag = proc.argv[2]
|
|
21
21
|
|
|
22
|
+
const withAuth = proc.argv[3] === '--auth'
|
|
23
|
+
|
|
22
24
|
if (dirFlag) {
|
|
23
25
|
console.log(`using passed in dir to generate sdk client: ${dirFlag}`)
|
|
24
26
|
} else {
|
|
@@ -34,15 +36,19 @@ export async function loadTypes() {
|
|
|
34
36
|
'import.meta.env.VITE_BAGEL_BASE_URL'
|
|
35
37
|
)
|
|
36
38
|
|
|
37
|
-
if (!fs.existsSync(bagelinkDir))
|
|
38
|
-
fs.mkdirSync(bagelinkDir)
|
|
39
|
-
}
|
|
39
|
+
if (!fs.existsSync(bagelinkDir)) fs.mkdirSync(bagelinkDir)
|
|
40
40
|
|
|
41
41
|
const typesPath = join(bagelinkDir, 'types.d.ts')
|
|
42
42
|
fs.writeFileSync(typesPath, types)
|
|
43
43
|
|
|
44
44
|
const apiPath = join(bagelinkDir, 'api.ts')
|
|
45
45
|
fs.writeFileSync(apiPath, code)
|
|
46
|
+
|
|
47
|
+
if (withAuth) {
|
|
48
|
+
const authCode = fs.readFileSync(join(cwd, 'auth.txt'), 'utf-8')
|
|
49
|
+
const authPath = join(bagelinkDir, 'auth.ts')
|
|
50
|
+
fs.writeFileSync(authPath, authCode)
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
loadTypes().catch(console.error)
|