@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.
- package/dist/generated-consts.d.ts +17 -3
- package/dist/generated-consts.js +21 -5
- package/dist/generated-types.d.ts +204 -6
- package/dist/generated-types.js +13 -1
- package/dist/index.d.ts +22 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +11 -8
- package/biome.json +0 -8
- package/scripts/generate-constants.script.ts +0 -126
- package/scripts/generate-types.script.ts +0 -68
- package/src/generated-consts.ts +0 -53
- package/src/generated-types.ts +0 -976
- package/src/index.ts +0 -26
- package/src/interfaces/service.interface.ts +0 -66
- package/tsconfig.json +0 -10
- package/tsconfig.lib.json +0 -18
- package/tsconfig.scripts.json +0 -15
- package/turbo.jsonc +0 -18
|
@@ -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
|
-
}
|
package/src/generated-consts.ts
DELETED
|
@@ -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
|
-
}
|