1
- import { parseArkiveManifest } from '../../mod.ts'
1
+ import { ArkiveManifest , parseArkiveManifest } from '../../mod.ts'
2
2
import { join } from '../deps.ts'
3
3
import { spinner } from '../spinner.ts'
4
+ import { craftEndpoint , getSupabaseClient } from '../utils.ts'
4
5
import { cleanup } from './cleanup.ts'
5
6
import { pkg } from './pkg.ts'
6
7
import { upload } from './upload.ts'
@@ -25,7 +26,8 @@ export const action = async (
25
26
} catch ( error ) {
26
27
throw new Error ( `Error importing manifest.ts: ${ error . message } ` )
27
28
}
28
- const manifest = manifestImport . default ?? manifestImport . manifest
29
+ const manifest : ArkiveManifest = manifestImport . default ??
30
+ manifestImport . manifest
29
31
if ( ! manifest ) {
30
32
throw new Error (
31
33
`Manifest file must export a default or manifest object.` ,
@@ -47,7 +49,29 @@ export const action = async (
47
49
// cleanup
48
50
await cleanup ( tempPath )
49
51
50
- spinner ( ) . succeed ( 'Deployed successfully!' )
52
+ spinner ( ) . succeed ( `Deployed successfully!` )
53
+
54
+ const client = getSupabaseClient ( )
55
+ const { data : userData , error : userError } = await client . auth . getUser ( )
56
+
57
+ if ( userError ) {
58
+ console . error ( userError )
59
+ } else {
60
+ const { data, error } = await client . from ( 'user_profile' ) . select (
61
+ 'username' ,
62
+ ) . eq ( 'id' , userData . user . id ) . single ( )
63
+
64
+ if ( error ) {
65
+ console . error ( error )
66
+ } else {
67
+ const endpoint = craftEndpoint ( {
68
+ arkiveName : manifest . name ,
69
+ environment : options . env ?? 'staging' ,
70
+ username : data . username ,
71
+ } )
72
+ console . log ( `🚀 Arkive GraphQL endpoint ready at: ${ endpoint } ` )
73
+ }
74
+ }
51
75
} catch ( error ) {
52
76
spinner ( ) . fail ( 'Deployment failed: ' + error . message )
53
77
}
0 commit comments