@bagelink/sdk 0.0.640 → 0.0.644
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/auth.ts +1 -1
- package/bin/index.ts +26 -29
- package/package.json +1 -1
package/bin/auth.ts
CHANGED
package/bin/index.ts
CHANGED
|
@@ -52,37 +52,34 @@ async function runEsLintOnDir(dir: string) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export async function loadTypes() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const { types, code } = await openAPI(
|
|
56
|
+
baseURL || '',
|
|
57
|
+
'import.meta.env.VITE_BAGEL_BASE_URL'
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
if (!fs.existsSync(bagelinkDir)) fs.mkdirSync(bagelinkDir)
|
|
61
|
+
|
|
62
|
+
const typesPath = join(bagelinkDir, 'types.d.ts')
|
|
63
|
+
await formatAndWriteCode(typesPath, types)
|
|
64
|
+
|
|
65
|
+
const apiPath = join(bagelinkDir, 'api.ts')
|
|
66
|
+
await formatAndWriteCode(apiPath, code)
|
|
67
|
+
|
|
68
|
+
if (withAuth) {
|
|
69
|
+
const authCode = fs.readFileSync(
|
|
70
|
+
join(__dirname, 'auth.ts'),
|
|
71
|
+
'utf-8'
|
|
72
|
+
).replace(
|
|
73
|
+
'// @ts-expect-error - required for axios to work',
|
|
74
|
+
''
|
|
59
75
|
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const typesPath = join(bagelinkDir, 'types.d.ts')
|
|
64
|
-
await formatAndWriteCode(typesPath, types)
|
|
65
|
-
|
|
66
|
-
const apiPath = join(bagelinkDir, 'api.ts')
|
|
67
|
-
await formatAndWriteCode(apiPath, code)
|
|
68
|
-
|
|
69
|
-
if (withAuth) {
|
|
70
|
-
const authCode = fs.readFileSync(
|
|
71
|
-
join(__dirname, 'auth.ts'),
|
|
72
|
-
'utf-8'
|
|
73
|
-
).replace(
|
|
74
|
-
'// @ts-expect-error - required for axios to work',
|
|
75
|
-
''
|
|
76
|
-
)
|
|
77
|
-
const authPath = join(bagelinkDir, 'auth.ts')
|
|
78
|
-
await formatAndWriteCode(authPath, authCode)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
await runEsLintOnDir(bagelinkDir)
|
|
82
|
-
} catch (error) {
|
|
83
|
-
proc.exitCode = 1
|
|
84
|
-
console.error(error)
|
|
76
|
+
const authPath = join(bagelinkDir, 'auth.ts')
|
|
77
|
+
await formatAndWriteCode(authPath, authCode)
|
|
85
78
|
}
|
|
79
|
+
|
|
80
|
+
await runEsLintOnDir(bagelinkDir)
|
|
81
|
+
|
|
82
|
+
console.log('Client and type files generated successfully!!!')
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
loadTypes().catch((error: unknown) => {
|