@bagelink/sdk 0.0.639 → 0.0.642

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/bin/index.ts +25 -30
  2. package/package.json +1 -1
package/bin/index.ts CHANGED
@@ -52,39 +52,34 @@ async function runEsLintOnDir(dir: string) {
52
52
  }
53
53
 
54
54
  export async function loadTypes() {
55
- try {
56
- const { types, code } = await openAPI(
57
- baseURL || '',
58
- 'import.meta.env.VITE_BAGEL_BASE_URL'
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
  )
76
+ const authPath = join(bagelinkDir, 'auth.ts')
77
+ await formatAndWriteCode(authPath, authCode)
78
+ }
60
79
 
61
- if (!fs.existsSync(bagelinkDir)) fs.mkdirSync(bagelinkDir)
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
- console.log({ cwd })
71
-
72
- const authCode = fs.readFileSync(
73
- join(__dirname, 'auth.ts'),
74
- 'utf-8'
75
- ).replace(
76
- '',
77
- ''
78
- )
79
- const authPath = join(bagelinkDir, 'auth.ts')
80
- await formatAndWriteCode(authPath, authCode)
81
- }
80
+ await runEsLintOnDir(bagelinkDir)
82
81
 
83
- await runEsLintOnDir(bagelinkDir)
84
- } catch (error) {
85
- proc.exitCode = 1
86
- console.error(error)
87
- }
82
+ console.log('Client and type files generated successfully!!!')
88
83
  }
89
84
 
90
85
  loadTypes().catch((error: unknown) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/sdk",
3
3
  "type": "module",
4
- "version": "0.0.639",
4
+ "version": "0.0.642",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",