-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.js
executable file
·58 lines (40 loc) · 1.74 KB
/
status.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { getJson, exists, getLogin, getConfigPaths } from "./helpers.js";
import { API as StudioAPI } from "./api_studio.js";
import { API as DenoAPI } from "./api_deno.js";
import { wait } from "./deps.js";
export default async function status() {
const FUNCTIONS_DOMAIN = Deno.env.get("FUNCTIONS_DOMAIN")
const spinner = wait(`Fetching account information`).start()
const login = await getLogin()
console.log(getConfigPaths())
if (login) {
//console.log(login)
const studio_api = StudioAPI.fromToken(login.token)
const deno_api = DenoAPI.fromToken(login.deno_deploy_token)
const studio_profile = await studio_api.requestJson(`/projects`)
const deno_profile = await deno_api.requestJson(`/projects`)
// console.log(` - ${studio_profile.length} Project`)
// console.log(` - ${deno_profile.length} Functions`)
spinner.succeed(`${login.profile.primary_email} (${studio_profile.length} Projects, ${deno_profile.length} Functions)`)
//console.log(studio_profile, deno_profile)
} else {
spinner.warn(`No auth info found`)
}
// if (!await exists('./tictapp.json')) {
// console.log(`No project found. run tictapp init`)
// Deno.exit()
// }
// const json = await getJson(`./tictapp.json`)
// const { profile, project } = json
// console.log(`
// %c${profile.primary_email}
// %c${project.name} %c${project.status}%c
// Api: https://${project.endpoint}
// Functions: https://${project.ref}.${FUNCTIONS_DOMAIN}
// `,
// "color: orange",
// "color: aquamarine;font-weight:bold",
// "background-color: grey",
// `color: blue`,
// );
}