@teardown/types 0.0.2 → 0.1.5

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.
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import { existsSync } from "node:fs";
4
- import { $ } from "bun";
5
-
6
- const PROJECT_ID = "oqluchbcdgvgycrodhtb";
7
- const GENERATED_TYPES_FILE = "./src/generated-types.ts";
8
- const SCHEMAS = ["public"];
9
- const REQUIRED_EXPORTS = ["Database", "TablesInsert", "TablesUpdate", "Enums", "Json"];
10
-
11
- console.log("🔄 Generating TypeScript types from Supabase...");
12
-
13
- // Store original file for rollback if needed
14
- const originalContent = existsSync(GENERATED_TYPES_FILE) ? await Bun.file(GENERATED_TYPES_FILE).text() : "";
15
-
16
- try {
17
- // Generate types using Supabase CLI (from remote project)
18
- const result = await $`supabase gen types typescript --project-id=${PROJECT_ID} --schema=${SCHEMAS.join(",")}`.text();
19
-
20
- // Validate output is not empty
21
- if (!result || result.trim().length === 0) {
22
- throw new Error("Supabase CLI returned empty output");
23
- }
24
-
25
- // Validate required exports exist
26
- const missingExports = REQUIRED_EXPORTS.filter((exportName) => !result.includes(`export type ${exportName}`));
27
-
28
- if (missingExports.length > 0) {
29
- throw new Error(`Generated types missing required exports: ${missingExports.join(", ")}`);
30
- }
31
-
32
- // Write the generated types
33
- await Bun.write(GENERATED_TYPES_FILE, result);
34
-
35
- console.log("✅ Types generated successfully");
36
-
37
- // Check if the generated file was modified
38
- const diffResult = await $`git diff --name-only ${GENERATED_TYPES_FILE}`.text();
39
-
40
- if (!diffResult.trim()) {
41
- console.log("â„šī¸ No changes detected, exiting...");
42
- process.exit(0);
43
- }
44
-
45
- // Stage the changes
46
- await $`git add ${GENERATED_TYPES_FILE}`;
47
-
48
- // Check if there are staged changes before committing
49
- const stagedChanges = await $`git diff --cached --name-only`.text();
50
- if (stagedChanges.trim()) {
51
- const commitMessage = "đŸ‘Ŋī¸ update generated types from supabase";
52
- await $`git commit -m ${commitMessage}`;
53
- console.log("✅ Changes committed successfully");
54
- } else {
55
- console.log("â„šī¸ No staged changes to commit");
56
- }
57
- } catch (error) {
58
- console.error("❌ Failed to generate types:", error);
59
-
60
- // Rollback to original content if it existed
61
- if (originalContent) {
62
- console.log("🔄 Restoring original file...");
63
- await Bun.write(GENERATED_TYPES_FILE, originalContent);
64
- console.log("✅ Original file restored");
65
- }
66
-
67
- process.exit(1);
68
- }
@@ -1,53 +0,0 @@
1
- export enum DevicePlatformEnum {
2
- IOS = "IOS",
3
- ANDROID = "ANDROID",
4
- WEB = "WEB",
5
- WINDOWS = "WINDOWS",
6
- MACOS = "MACOS",
7
- LINUX = "LINUX",
8
- PHONE = "PHONE",
9
- TABLET = "TABLET",
10
- DESKTOP = "DESKTOP",
11
- CONSOLE = "CONSOLE",
12
- TV = "TV",
13
- WEARABLE = "WEARABLE",
14
- GAME_CONSOLE = "GAME_CONSOLE",
15
- VR = "VR",
16
- UNKNOWN = "UNKNOWN",
17
- OTHER = "OTHER",
18
- }
19
-
20
- export enum EnvironmentTypeEnum {
21
- DEVELOPMENT = "DEVELOPMENT",
22
- STAGING = "STAGING",
23
- PRODUCTION = "PRODUCTION",
24
- }
25
-
26
- export enum OrgRoleTypeEnum {
27
- OWNER = "OWNER",
28
- ADMIN = "ADMIN",
29
- ENGINEER = "ENGINEER",
30
- }
31
-
32
- export enum OrgTypeEnum {
33
- PERSONAL = "PERSONAL",
34
- START_UP = "START_UP",
35
- SCALE_UP = "SCALE_UP",
36
- AGENCY = "AGENCY",
37
- ENTERPRISE = "ENTERPRISE",
38
- }
39
-
40
- export enum ProjectApiKeyKindEnum {
41
- publishable = "publishable",
42
- secret = "secret",
43
- }
44
-
45
- export enum ProjectTypeEnum {
46
- REACT_NATIVE = "REACT_NATIVE",
47
- EXPO = "EXPO",
48
- }
49
-
50
- export enum VersionStatusEnum {
51
- LIVE = "LIVE",
52
- DISABLED = "DISABLED",
53
- }