@bungres/kit 0.1.0

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +2435 -0
  6. package/dist/commands/drop.d.ts +5 -0
  7. package/dist/commands/drop.d.ts.map +1 -0
  8. package/dist/commands/fresh.d.ts +3 -0
  9. package/dist/commands/fresh.d.ts.map +1 -0
  10. package/dist/commands/generate.d.ts +3 -0
  11. package/dist/commands/generate.d.ts.map +1 -0
  12. package/dist/commands/migrate.d.ts +3 -0
  13. package/dist/commands/migrate.d.ts.map +1 -0
  14. package/dist/commands/pull.d.ts +29 -0
  15. package/dist/commands/pull.d.ts.map +1 -0
  16. package/dist/commands/push.d.ts +5 -0
  17. package/dist/commands/push.d.ts.map +1 -0
  18. package/dist/commands/refresh.d.ts +3 -0
  19. package/dist/commands/refresh.d.ts.map +1 -0
  20. package/dist/commands/seed.d.ts +3 -0
  21. package/dist/commands/seed.d.ts.map +1 -0
  22. package/dist/commands/status.d.ts +3 -0
  23. package/dist/commands/status.d.ts.map +1 -0
  24. package/dist/commands/studio.d.ts +3 -0
  25. package/dist/commands/studio.d.ts.map +1 -0
  26. package/dist/commands/tusky.d.ts +3 -0
  27. package/dist/commands/tusky.d.ts.map +1 -0
  28. package/dist/config.d.ts +44 -0
  29. package/dist/config.d.ts.map +1 -0
  30. package/dist/differ.d.ts +11 -0
  31. package/dist/differ.d.ts.map +1 -0
  32. package/dist/ensure-db.d.ts +2 -0
  33. package/dist/ensure-db.d.ts.map +1 -0
  34. package/dist/index.d.ts +13 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +1720 -0
  37. package/dist/schema-loader.d.ts +9 -0
  38. package/dist/schema-loader.d.ts.map +1 -0
  39. package/dist/utils/colors.d.ts +2 -0
  40. package/dist/utils/colors.d.ts.map +1 -0
  41. package/package.json +43 -0
  42. package/src/cli.ts +162 -0
  43. package/src/commands/drop.ts +92 -0
  44. package/src/commands/fresh.ts +17 -0
  45. package/src/commands/generate.ts +151 -0
  46. package/src/commands/migrate.ts +84 -0
  47. package/src/commands/pull.ts +339 -0
  48. package/src/commands/push.ts +105 -0
  49. package/src/commands/refresh.ts +37 -0
  50. package/src/commands/seed.ts +41 -0
  51. package/src/commands/status.ts +64 -0
  52. package/src/commands/studio.ts +471 -0
  53. package/src/commands/tusky.ts +83 -0
  54. package/src/config.ts +102 -0
  55. package/src/differ.ts +236 -0
  56. package/src/ensure-db.ts +32 -0
  57. package/src/index.ts +21 -0
  58. package/src/schema-loader.ts +50 -0
  59. package/src/utils/colors.ts +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aniket Khote
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @bungres/kit
2
+
3
+ CLI toolkit for [`@bungres/orm`](https://www.npmjs.com/package/@bungres/orm) — generate, migrate, push, pull, status, and drop your database schema with ease. 🐘✨
4
+
5
+ ## Requirements
6
+
7
+ - **Bun ≥ 1.3** (uses `Bun.sql` which is built-in)
8
+ - **Postgres ≥ 16**
9
+ - Built to work alongside `@bungres/orm`.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ bun add -d @bungres/kit
15
+ ```
16
+
17
+ ## Configuration
18
+
19
+ Create a `bungres.config.ts` file at the root of your project:
20
+
21
+ ```ts
22
+ import type { BungresKitConfig } from "@bungres/kit";
23
+
24
+ const config: BungresKitConfig = {
25
+ // dbUrl: "postgres://...", // or set DATABASE_URL env var
26
+ schema: "src/db/schema/**/*.ts",
27
+ migrationsDir: "./migrations",
28
+ outDir: "./src/db/generated",
29
+ dbSchema: "public",
30
+ verbose: false,
31
+ };
32
+
33
+ export default config;
34
+ ```
35
+
36
+ ## Commands Overview
37
+
38
+ Run the CLI using Bun:
39
+
40
+ ```bash
41
+ bun run bungres --help
42
+ ```
43
+
44
+ | Command | Description |
45
+ |---|---|
46
+ | `bungres generate` | Write a timestamped `.sql` migration file from your schema |
47
+ | `bungres migrate` | Run pending `.sql` files, track applied in `__bungres_migrations` |
48
+ | `bungres push` | Apply schema directly to DB — no files (great for dev/prototyping) |
49
+ | `bungres pull` | Introspect the DB and generate TypeScript schema |
50
+ | `bungres status` | Show applied vs pending migrations |
51
+ | `bungres drop` | Drop all tables defined in the schema (prompts for confirmation) |
52
+
53
+ ### Usage Examples
54
+
55
+ ```bash
56
+ bun run bungres generate
57
+ bun run bungres migrate
58
+ bun run bungres push
59
+ bun run bungres pull
60
+ bun run bungres status
61
+ bun run bungres drop --force # skip confirmation
62
+ ```
63
+
64
+ ## License
65
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}