@t1mmen/srtd 0.3.0 โ 0.4.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.
- package/README.md +75 -110
- package/dist/__tests__/vitest.setup.js +41 -25
- package/dist/__tests__/vitest.setup.js.map +1 -1
- package/dist/commands/_app.js +15 -7
- package/dist/commands/_app.js.map +1 -1
- package/dist/commands/apply.js +1 -0
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/clear.d.ts +2 -0
- package/dist/commands/clear.js +45 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/index.js +9 -4
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/watch.js +30 -14
- package/dist/commands/watch.js.map +1 -1
- package/dist/hooks/useTemplateManager.d.ts +6 -8
- package/dist/hooks/useTemplateManager.js +80 -97
- package/dist/hooks/useTemplateManager.js.map +1 -1
- package/dist/lib/templateManager.d.ts +9 -2
- package/dist/lib/templateManager.js +147 -48
- package/dist/lib/templateManager.js.map +1 -1
- package/dist/lib/templateManager.test.js +452 -15
- package/dist/lib/templateManager.test.js.map +1 -1
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.js +26 -40
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/databaseConnection.js +13 -1
- package/dist/utils/databaseConnection.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# `srtd` ๐ช Supabase Repeatable Template Definitions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
> Live-reloading SQL templates for [Supabase](https://supabase.com) projects. DX supercharged! ๐
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@t1mmen/srtd)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
7
9
|
[](https://github.com/t1mmen/srtd/actions/workflows/ci.yml)
|
|
8
10
|
[](https://codecov.io/gh/t1mmen/srtd)
|
|
9
11
|
|
|
12
|
+
|
|
13
|
+
[](./readme-screenshot.png)
|
|
14
|
+
|
|
10
15
|
`srtd` enhances the [Supabase](https://supabase.com) DX by adding live-reloading SQL templates into local db. The single-source-of-truth template โก๏ธ migrations system brings sanity to code reviews, making `git blame` useful.
|
|
11
16
|
|
|
12
|
-
Built specifically for projects using the standard [Supabase](https://supabase.com) stack (but probably works alright for other Postgres-based projects, too).
|
|
13
17
|
|
|
14
18
|
**Read the introductory blog post: [Introducing `srtd`: Live-Reloading SQL Templates for Supabase](https://timm.stokke.me/blog/srtd-live-reloading-and-sql-templates-for-supabase)**
|
|
15
19
|
|
|
@@ -17,7 +21,7 @@ Built specifically for projects using the standard [Supabase](https://supabase.c
|
|
|
17
21
|
|
|
18
22
|
While building [Timely](https://www.timely.com)'s next-generation [Memory Engine](https://www.timely.com/memory-app) on [Supabase](https://supabase.com), we found ourselves facing two major annoyances:
|
|
19
23
|
|
|
20
|
-
1. Code reviews were painful - function changes showed up as complete rewrites
|
|
24
|
+
1. Code reviews were painful - function changes showed up as complete rewrites, `git blame` was useless
|
|
21
25
|
2. Designing and iterating on database changes locally meant constant friction, like the dance around copy-pasting into SQL console
|
|
22
26
|
|
|
23
27
|
After over a year of looking-but-not-finding a better way, I paired up with [Claude](https://claude.ai) to eliminate these annoyances. Say hello to `srtd`.
|
|
@@ -29,6 +33,8 @@ After over a year of looking-but-not-finding a better way, I paired up with [Cla
|
|
|
29
33
|
- **Just SQL**: Templates build as standard [Supabase](https://supabase.com) migrations when you're ready to deploy
|
|
30
34
|
- **Developer Friendly**: Interactive CLI with visual feedback for all operations
|
|
31
35
|
|
|
36
|
+
Built specifically for projects using the standard [Supabase](https://supabase.com) stack (but probably works alright for other Postgres-based projects, too).
|
|
37
|
+
|
|
32
38
|
## Requirements
|
|
33
39
|
|
|
34
40
|
- Node.js v20.x or higher
|
|
@@ -89,94 +95,94 @@ supabase migration up # Apply using Supabase CLI
|
|
|
89
95
|
|
|
90
96
|
Running `srtd` without arguments opens an interactive menu:
|
|
91
97
|
|
|
92
|
-
```
|
|
93
|
-
โฏ ๐๏ธ build - Build Supabase migrations from templates
|
|
94
|
-
โถ๏ธ apply - Apply migration templates directly to database
|
|
95
|
-
โ๏ธ register - Register templates as already built
|
|
96
|
-
๐ watch - Watch templates for changes, apply directly to database
|
|
97
|
-
```
|
|
98
|
-
|
|
99
98
|
### CLI Mode
|
|
100
99
|
|
|
101
|
-
- ๐๏ธ `build [--force]` - Generate migrations from templates
|
|
102
|
-
- โถ๏ธ `apply [--force]` - Apply templates directly to local database
|
|
103
|
-
- โ๏ธ `register [file.sql]` - Mark templates as already built
|
|
104
|
-
- ๐ `watch` - Watch and auto-apply changes
|
|
100
|
+
- ๐๏ธ `srtd build [--force]` - Generate migrations from templates
|
|
101
|
+
- โถ๏ธ `srtd apply [--force]` - Apply templates directly to local database
|
|
102
|
+
- โ๏ธ `srtd register [file.sql]` - Mark templates as already built
|
|
103
|
+
- ๐ `srtd watch` - Watch and auto-apply changes
|
|
104
|
+
- ๐งน `srtd clean` - Remove all logs and reset config
|
|
105
105
|
|
|
106
106
|
> [!IMPORTANT]
|
|
107
107
|
> `watch` and `apply` commands modify your local database directly and don't clean up after themselves. Use with caution!
|
|
108
108
|
|
|
109
|
-
##
|
|
109
|
+
## The Power of Templates ๐ช
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
|
|
112
|
+
Templates make code reviews meaningful. Consider this PR adding priority to a notification function:
|
|
113
|
+
|
|
114
|
+
Without templates, this would appear as a complete rewrite in your PR.
|
|
115
|
+
|
|
116
|
+
### Perfect For ๐ฏ
|
|
112
117
|
|
|
113
118
|
โ
Database functions:
|
|
114
|
-
```
|
|
115
|
-
--
|
|
116
|
-
CREATE OR REPLACE FUNCTION
|
|
117
|
-
RETURNS
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
json_build_object('table', TG_TABLE_NAME, 'id', NEW.id)::text
|
|
128
|
-
);
|
|
129
|
-
RETURN NEW;
|
|
130
|
-
END;
|
|
131
|
-
$$ LANGUAGE plpgsql;
|
|
119
|
+
```diff
|
|
120
|
+
-- Event notifications
|
|
121
|
+
CREATE OR REPLACE FUNCTION notify_changes()
|
|
122
|
+
RETURNS trigger AS $$
|
|
123
|
+
BEGIN
|
|
124
|
+
PERFORM pg_notify(
|
|
125
|
+
'changes',
|
|
126
|
+
json_build_object('table', TG_TABLE_NAME, 'id', NEW.id)::text
|
|
127
|
+
);
|
|
128
|
+
+ RAISE NOTICE 'Notified changes for %', TG_TABLE_NAME; -- Debug logging
|
|
129
|
+
RETURN NEW;
|
|
130
|
+
END;
|
|
131
|
+
$$ LANGUAGE plpgsql;
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
โ
Row-Level Security (RLS):
|
|
135
|
-
```
|
|
136
|
-
-- Replace/update policies safely
|
|
137
|
-
DROP POLICY IF EXISTS "workspace_access" ON resources;
|
|
138
|
-
CREATE POLICY "workspace_access" ON resources
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
```diff
|
|
136
|
+
-- Replace/update policies safely
|
|
137
|
+
DROP POLICY IF EXISTS "workspace_access" ON resources;
|
|
138
|
+
CREATE POLICY "workspace_access" ON resources
|
|
139
|
+
USING (workspace_id IN (
|
|
140
|
+
SELECT id FROM workspaces
|
|
141
|
+
WHERE organization_id = auth.organization_id()
|
|
142
|
+
+ AND auth.user_role() NOT IN ('pending')
|
|
143
|
+
));
|
|
143
144
|
```
|
|
144
145
|
|
|
145
146
|
โ
Views for data abstraction:
|
|
146
|
-
```
|
|
147
|
-
CREATE OR REPLACE VIEW active_subscriptions AS
|
|
148
|
-
SELECT
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
FROM subscriptions s
|
|
153
|
-
JOIN plans p ON p.id = s.plan_id
|
|
154
|
-
WHERE s.status = 'active'
|
|
155
|
-
|
|
147
|
+
```diff
|
|
148
|
+
CREATE OR REPLACE VIEW active_subscriptions AS
|
|
149
|
+
SELECT
|
|
150
|
+
s.*,
|
|
151
|
+
p.name as plan_name,
|
|
152
|
+
p.features
|
|
153
|
+
FROM subscriptions s
|
|
154
|
+
JOIN plans p ON p.id = s.plan_id
|
|
155
|
+
- WHERE s.status = 'active';
|
|
156
|
+
+ WHERE s.status = 'active'
|
|
157
|
+
+ AND s.expires_at > CURRENT_TIMESTAMP;
|
|
156
158
|
```
|
|
157
159
|
|
|
158
160
|
โ
Roles and Permissions:
|
|
159
|
-
```
|
|
160
|
-
-- Revoke all first for clean state
|
|
161
|
-
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM public;
|
|
161
|
+
```diff
|
|
162
|
+
-- Revoke all first for clean state
|
|
163
|
+
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM public;
|
|
162
164
|
|
|
163
|
-
-- Grant specific access
|
|
164
|
-
GRANT USAGE ON SCHEMA public TO authenticated;
|
|
165
|
-
GRANT SELECT ON ALL TABLES IN SCHEMA public TO authenticated;
|
|
165
|
+
-- Grant specific access
|
|
166
|
+
GRANT USAGE ON SCHEMA public TO authenticated;
|
|
167
|
+
GRANT SELECT ON ALL TABLES IN SCHEMA public TO authenticated;
|
|
168
|
+
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO admin;
|
|
166
169
|
```
|
|
167
170
|
|
|
168
171
|
โ
Safe Type Extensions:
|
|
169
|
-
```
|
|
170
|
-
DO $$
|
|
171
|
-
BEGIN
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
```diff
|
|
173
|
+
DO $$
|
|
174
|
+
BEGIN
|
|
175
|
+
-- Add new enum values idempotently
|
|
176
|
+
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'notification_type') THEN
|
|
177
|
+
CREATE TYPE notification_type AS ENUM ('email', 'sms');
|
|
178
|
+
END IF;
|
|
179
|
+
|
|
180
|
+
-- Extend existing enum safely
|
|
181
|
+
ALTER TYPE notification_type ADD VALUE IF NOT EXISTS 'push';
|
|
182
|
+
ALTER TYPE notification_type ADD VALUE IF NOT EXISTS 'pusher';
|
|
183
|
+
ALTER TYPE notification_type ADD VALUE IF NOT EXISTS 'webhook';
|
|
184
|
+
+ ALTER TYPE notification_type ADD VALUE IF NOT EXISTS 'email';
|
|
185
|
+
END $$;
|
|
180
186
|
```
|
|
181
187
|
|
|
182
188
|
### Not Recommended For
|
|
@@ -188,47 +194,6 @@ END $$;
|
|
|
188
194
|
|
|
189
195
|
Use regular [Supabase](https://supabase.com) migrations for these cases.
|
|
190
196
|
|
|
191
|
-
## The Power of Templates ๐ช
|
|
192
|
-
|
|
193
|
-
Templates make code reviews meaningful. Consider this PR adding priority to a notification function:
|
|
194
|
-
|
|
195
|
-
```diff
|
|
196
|
-
CREATE OR REPLACE FUNCTION dispatch_notification(
|
|
197
|
-
user_id uuid,
|
|
198
|
-
type text,
|
|
199
|
-
payload jsonb
|
|
200
|
-
) RETURNS uuid AS $$
|
|
201
|
-
DECLARE
|
|
202
|
-
notification_id uuid;
|
|
203
|
-
user_settings jsonb;
|
|
204
|
-
BEGIN
|
|
205
|
-
-- Get user notification settings
|
|
206
|
-
SELECT settings INTO user_settings
|
|
207
|
-
FROM user_preferences
|
|
208
|
-
WHERE id = user_id;
|
|
209
|
-
|
|
210
|
-
-- Create notification record
|
|
211
|
-
+ -- Include priority based on notification type
|
|
212
|
-
INSERT INTO notifications (
|
|
213
|
-
id,
|
|
214
|
-
user_id,
|
|
215
|
-
type,
|
|
216
|
-
payload,
|
|
217
|
-
+ priority,
|
|
218
|
-
created_at
|
|
219
|
-
) VALUES (
|
|
220
|
-
gen_random_uuid(),
|
|
221
|
-
dispatch_notification.user_id,
|
|
222
|
-
type,
|
|
223
|
-
payload,
|
|
224
|
-
+ COALESCE((SELECT priority FROM notification_types WHERE name = type), 'normal'),
|
|
225
|
-
CURRENT_TIMESTAMP
|
|
226
|
-
)
|
|
227
|
-
RETURNING id INTO notification_id;
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Without templates, this would appear as a complete rewrite in your PR.
|
|
231
|
-
|
|
232
197
|
## Configuration ๐
|
|
233
198
|
|
|
234
199
|
`srtd.config.json` created during initialization:
|
|
@@ -5,19 +5,35 @@ import { afterAll, beforeAll, vi } from 'vitest';
|
|
|
5
5
|
import { connect, disconnect } from '../utils/databaseConnection.js';
|
|
6
6
|
export const TEST_FN_PREFIX = 'srtd_scoped_test_func_';
|
|
7
7
|
export const TEST_ROOT = join(tmpdir(), `srtd-test-${Date.now()}`);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
8
|
+
vi.mock('../utils/logger', () => ({
|
|
9
|
+
logger: {
|
|
10
|
+
info: () => {
|
|
11
|
+
/** noop */
|
|
12
|
+
},
|
|
13
|
+
success: () => {
|
|
14
|
+
/** noop */
|
|
15
|
+
},
|
|
16
|
+
warn: () => {
|
|
17
|
+
/** noop */
|
|
18
|
+
},
|
|
19
|
+
error: () => {
|
|
20
|
+
/** noop */
|
|
21
|
+
},
|
|
22
|
+
skip: () => {
|
|
23
|
+
/** noop */
|
|
24
|
+
},
|
|
25
|
+
debug: () => {
|
|
26
|
+
/** noop */
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
19
30
|
beforeAll(async () => {
|
|
20
|
-
|
|
31
|
+
try {
|
|
32
|
+
await fs.mkdir(TEST_ROOT, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Error creating test root:', error, ', retrying once.');
|
|
36
|
+
}
|
|
21
37
|
});
|
|
22
38
|
afterAll(async () => {
|
|
23
39
|
await fs.rm(TEST_ROOT, { recursive: true, force: true });
|
|
@@ -26,19 +42,19 @@ afterAll(async () => {
|
|
|
26
42
|
try {
|
|
27
43
|
await client.query('BEGIN');
|
|
28
44
|
await client.query(`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
DO $$
|
|
46
|
+
DECLARE
|
|
47
|
+
r record;
|
|
48
|
+
BEGIN
|
|
49
|
+
FOR r IN
|
|
50
|
+
SELECT quote_ident(proname) AS func_name
|
|
51
|
+
FROM pg_proc
|
|
52
|
+
WHERE proname LIKE '${TEST_FN_PREFIX}%'
|
|
53
|
+
LOOP
|
|
54
|
+
EXECUTE 'DROP FUNCTION IF EXISTS ' || r.func_name;
|
|
55
|
+
END LOOP;
|
|
56
|
+
END;
|
|
57
|
+
$$;
|
|
42
58
|
`);
|
|
43
59
|
await client.query('COMMIT');
|
|
44
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.setup.js","sourceRoot":"","sources":["../../src/__tests__/vitest.setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,aAAa,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAEnE,
|
|
1
|
+
{"version":3,"file":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ands/_app.js
CHANGED
|
@@ -16,12 +16,20 @@ const customTheme = extendTheme(defaultTheme, {
|
|
|
16
16
|
export default function App({ Component, commandProps }) {
|
|
17
17
|
const { error } = useDatabaseConnection();
|
|
18
18
|
return (React.createElement(ThemeProvider, { theme: customTheme },
|
|
19
|
-
|
|
20
|
-
React.createElement(
|
|
21
|
-
React.createElement(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
React.createElement(Box, { flexDirection: "column", padding: 1 },
|
|
20
|
+
!!error && (React.createElement(Static, { items: [error] }, error => (React.createElement(Box, { key: error },
|
|
21
|
+
React.createElement(Alert, { variant: "error" },
|
|
22
|
+
React.createElement(Text, { bold: true, color: "red" },
|
|
23
|
+
"Error:",
|
|
24
|
+
' '),
|
|
25
|
+
error))))),
|
|
26
|
+
React.createElement(Component, { ...commandProps }))));
|
|
26
27
|
}
|
|
28
|
+
// Mimick fullscreen behavior
|
|
29
|
+
const enterAltScreenCommand = '\x1b[?1049h';
|
|
30
|
+
const leaveAltScreenCommand = '\x1b[?1049l';
|
|
31
|
+
process.stdout.write(enterAltScreenCommand);
|
|
32
|
+
process.on('exit', () => {
|
|
33
|
+
process.stdout.write(leaveAltScreenCommand);
|
|
34
|
+
});
|
|
27
35
|
//# sourceMappingURL=_app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_app.js","sourceRoot":"","sources":["../../src/commands/_app.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAExD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,MAAM,WAAW,GAAG,WAAW,CAAC,YAAY,EAAE;IAC5C,UAAU,EAAE;Q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H,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;gBAC5D,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;gBACtE,IAAI,EAAE,CAAC;YACT,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;oBACzB,IAAI,CAAC,GAAG,CAAC,CAAC;gBACZ,CAAC;gBACD,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC;QACD,KAAK,OAAO,EAAE,CAAC;IACjB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Select, Spinner } from '@inkjs/ui';
|
|
2
|
+
import Branding from 'components/Branding.js';
|
|
3
|
+
import Quittable from 'components/Quittable.js';
|
|
4
|
+
// commands/build.tsx
|
|
5
|
+
import { Box, useApp } from 'ink';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { clearBuildLogs, resetConfig } from '../utils/config.js';
|
|
8
|
+
const clearOptions = [
|
|
9
|
+
{ label: 'Clear local build logs', value: 'local' },
|
|
10
|
+
{ label: 'Clear shared build logs', value: 'shared' },
|
|
11
|
+
{ label: 'Reset config and logs to initial defaults', value: 'full_reset' },
|
|
12
|
+
];
|
|
13
|
+
export default function Clear() {
|
|
14
|
+
const { exit } = useApp();
|
|
15
|
+
const [isResetting, setIsResetting] = React.useState(false);
|
|
16
|
+
const handleSelect = async (value) => {
|
|
17
|
+
try {
|
|
18
|
+
setIsResetting(true);
|
|
19
|
+
switch (value) {
|
|
20
|
+
case 'local':
|
|
21
|
+
await clearBuildLogs(process.cwd(), 'local');
|
|
22
|
+
break;
|
|
23
|
+
case 'shared':
|
|
24
|
+
await clearBuildLogs(process.cwd(), 'shared');
|
|
25
|
+
break;
|
|
26
|
+
case 'full_reset':
|
|
27
|
+
await resetConfig(process.cwd());
|
|
28
|
+
await clearBuildLogs(process.cwd(), 'both');
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error('Invalid option');
|
|
32
|
+
}
|
|
33
|
+
exit();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
exit(err instanceof Error ? err : new Error('Unknown error occurred'));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return (React.createElement(React.Fragment, null,
|
|
40
|
+
React.createElement(Branding, { subtitle: "\uD83E\uDDF9 Maintenance" }),
|
|
41
|
+
React.createElement(Select, { options: clearOptions, onChange: handleSelect }),
|
|
42
|
+
isResetting ? (React.createElement(Box, { marginY: 1 },
|
|
43
|
+
React.createElement(Spinner, { label: "Resetting..." }))) : (React.createElement(Quittable, null))));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../src/commands/clear.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,qBAAqB;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,YAAY,GAAG;IACnB,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE;IACnD,EAAE,KAAK,EAAE,yBAAyB,EAAE,KAAK,EAAE,QAAQ,EAAE;IACrD,EAAE,KAAK,EAAE,2CAA2C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O,EAAE,CAAC;YACb,oBAAC,OAAO,IAAC,KAAK,EAAC,cAAc,GAAG,CAC5B,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,OAAG,CACd,CACA,CACJ,CAAC;AACJ,CAAC"}
|
package/dist/commands/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import Quittable from '../components/Quittable.js';
|
|
|
7
7
|
import { useDatabaseConnection } from '../hooks/useDatabaseConnection.js';
|
|
8
8
|
import Apply from './apply.js';
|
|
9
9
|
import Build from './build.js';
|
|
10
|
+
import Clear from './clear.js';
|
|
10
11
|
import Register from './register.js';
|
|
11
12
|
import Watch from './watch.js';
|
|
12
13
|
export default function UI() {
|
|
@@ -27,14 +28,18 @@ export default function UI() {
|
|
|
27
28
|
if (selectedCommand === 'watch') {
|
|
28
29
|
return React.createElement(Watch, null);
|
|
29
30
|
}
|
|
31
|
+
if (selectedCommand === 'clear') {
|
|
32
|
+
return React.createElement(Clear, null);
|
|
33
|
+
}
|
|
30
34
|
const menuItems = [
|
|
31
|
-
{ label: '๐๏ธ build - Build Supabase migrations from templates', value: 'build' },
|
|
32
|
-
{ label: 'โถ๏ธ apply - Apply migration templates directly to database', value: 'apply' },
|
|
33
|
-
{ label: 'โ๏ธ register - Register templates as already built', value: 'register' },
|
|
34
35
|
{
|
|
35
|
-
label: '๐ watch - Watch
|
|
36
|
+
label: '๐ watch - Watch for changes, apply directly to db',
|
|
36
37
|
value: 'watch',
|
|
37
38
|
},
|
|
39
|
+
{ label: 'โถ๏ธ apply - Apply templates directly to db', value: 'apply' },
|
|
40
|
+
{ label: '๐๏ธ build - Build templates as Supabase migrations', value: 'build' },
|
|
41
|
+
{ label: 'โ๏ธ register - Register templates as already built', value: 'register' },
|
|
42
|
+
{ label: '๐งน maintenance - Clear build logs and reset config', value: 'clear' },
|
|
38
43
|
];
|
|
39
44
|
return (React.createElement(Box, { flexDirection: "column" },
|
|
40
45
|
React.createElement(Branding, null),
|
|
@@ -1 +1 @@
|
|
|
1
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,CAC/C,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,OAAG,CACd,CACG,CACP,CAAC;AACJ,CAAC"}
|
package/dist/commands/watch.js
CHANGED
|
@@ -8,7 +8,8 @@ import Quittable from '../components/Quittable.js';
|
|
|
8
8
|
import { TimeSince } from '../components/TimeSince.js';
|
|
9
9
|
import { useDatabaseConnection } from '../hooks/useDatabaseConnection.js';
|
|
10
10
|
import { useTemplateManager } from '../hooks/useTemplateManager.js';
|
|
11
|
-
const MAX_FILES =
|
|
11
|
+
const MAX_FILES = 10;
|
|
12
|
+
const MAX_CHANGES = 15;
|
|
12
13
|
const PATH_DISPLAY_LENGTH = 15;
|
|
13
14
|
function StatBadge({ label, value, color }) {
|
|
14
15
|
return (React.createElement(Box, { marginRight: 1 },
|
|
@@ -53,9 +54,23 @@ const TemplateRow = React.memo(({ template, isLatest, templateDir, }) => {
|
|
|
53
54
|
});
|
|
54
55
|
TemplateRow.displayName = 'TemplateRow';
|
|
55
56
|
const UpdateLog = React.memo(({ updates, templateDir, }) => {
|
|
56
|
-
const sortedUpdates = useMemo(() =>
|
|
57
|
+
const sortedUpdates = useMemo(() => {
|
|
58
|
+
return [...updates]
|
|
59
|
+
.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime())
|
|
60
|
+
.slice(0, MAX_CHANGES);
|
|
61
|
+
}, [updates]);
|
|
62
|
+
const formatError = (error) => {
|
|
63
|
+
if (error instanceof Error)
|
|
64
|
+
return error.message;
|
|
65
|
+
if (typeof error === 'string')
|
|
66
|
+
return error;
|
|
67
|
+
if (typeof error === 'object' && error && 'error' in error) {
|
|
68
|
+
return String(error.error);
|
|
69
|
+
}
|
|
70
|
+
return String(error);
|
|
71
|
+
};
|
|
57
72
|
return (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
|
|
58
|
-
React.createElement(Text, { bold: true }, "
|
|
73
|
+
React.createElement(Text, { bold: true }, "Changelog:"),
|
|
59
74
|
sortedUpdates.map(update => (React.createElement(Box, { key: `${update.template.path}-${update.timestamp}`, marginLeft: 2 },
|
|
60
75
|
React.createElement(Text, { color: update.type === 'error' ? 'red' : update.type === 'applied' ? 'green' : 'blue' },
|
|
61
76
|
update.type === 'error' ? 'โ' : update.type === 'applied' ? 'โจ' : '๐',
|
|
@@ -64,7 +79,7 @@ const UpdateLog = React.memo(({ updates, templateDir, }) => {
|
|
|
64
79
|
":",
|
|
65
80
|
' ',
|
|
66
81
|
update.type === 'error'
|
|
67
|
-
? update.error
|
|
82
|
+
? formatError(update.error)
|
|
68
83
|
: update.type === 'applied'
|
|
69
84
|
? 'applied successfully'
|
|
70
85
|
: 'changed and reapplied'))))));
|
|
@@ -89,27 +104,28 @@ export default function Watch() {
|
|
|
89
104
|
return (React.createElement(Box, { flexDirection: "column" },
|
|
90
105
|
React.createElement(Branding, { subtitle: "\uD83D\uDC40 Watch Mode" }),
|
|
91
106
|
React.createElement(Box, { marginY: 1 },
|
|
92
|
-
React.createElement(StatBadge, { label: "Total", value: stats.total, color: "
|
|
107
|
+
React.createElement(StatBadge, { label: "Total", value: stats.total, color: "green" }),
|
|
93
108
|
stats.needsBuild > 0 && (React.createElement(StatBadge, { label: "Needs Build", value: stats.needsBuild, color: "yellow" })),
|
|
94
109
|
stats.recentlyChanged > 0 && (React.createElement(StatBadge, { label: "Recent Changes", value: stats.recentlyChanged, color: "blue" })),
|
|
95
110
|
hasErrors && React.createElement(StatBadge, { label: "Errors", value: stats.errors, color: "red" })),
|
|
96
111
|
isLoading ? (React.createElement(Text, null, "\uD83D\uDD0D Finding templates...")) : (React.createElement(Box, { flexDirection: "column" },
|
|
97
112
|
activeTemplates.map(template => (React.createElement(TemplateRow, { key: template.path, template: template, isLatest: template.path === latestPath, templateDir: templateDir }))),
|
|
98
113
|
showUpdates && updates.length > 0 && (React.createElement(UpdateLog, { updates: updates, templateDir: templateDir })),
|
|
99
|
-
|
|
114
|
+
hasErrors && (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
|
|
100
115
|
React.createElement(Text, { bold: true, color: "red" }, "Errors:"),
|
|
101
116
|
Array.from(errors.entries()).map(([path, error]) => (React.createElement(Box, { key: path, marginLeft: 2, marginTop: 1 },
|
|
102
117
|
React.createElement(Text, { color: "red", wrap: "wrap" },
|
|
103
118
|
formatTemplateDisplay(path, templateDir ?? ''),
|
|
104
119
|
": ",
|
|
105
|
-
error)))))))),
|
|
120
|
+
String(error))))))))),
|
|
106
121
|
React.createElement(Box, { marginY: 1, flexDirection: "row", gap: 1 },
|
|
107
|
-
React.createElement(
|
|
108
|
-
|
|
109
|
-
React.createElement(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
122
|
+
React.createElement(Quittable, null),
|
|
123
|
+
updates.length > 0 && (React.createElement(React.Fragment, null,
|
|
124
|
+
React.createElement(Box, { marginY: 1 },
|
|
125
|
+
React.createElement(Text, { dimColor: true }, "\u2022")),
|
|
126
|
+
React.createElement(Box, { marginY: 1 },
|
|
127
|
+
React.createElement(Text, { dimColor: true }, "press "),
|
|
128
|
+
React.createElement(Text, { underline: showUpdates }, "u"),
|
|
129
|
+
React.createElement(Text, { dimColor: true }, " to toggle updates")))))));
|
|
114
130
|
}
|
|
115
131
|
//# sourceMappingURL=watch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,4B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C,OAAO,EAAE,CAAC;oBACb,oBAAC,IAAI,IAAC,QAAQ,mBAAc;oBAC5B,oBAAC,IAAI,IAAC,SAAS,EAAE,WAAW,QAAU;oBACtC,oBAAC,IAAI,IAAC,QAAQ,+BAA0B,CACpC,CACL,CACJ,CACG,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -4,18 +4,16 @@ export type TemplateUpdate = {
|
|
|
4
4
|
template: TemplateStatus;
|
|
5
5
|
timestamp: string;
|
|
6
6
|
error?: string;
|
|
7
|
-
path: string;
|
|
8
7
|
};
|
|
9
|
-
export interface TemplateStats {
|
|
10
|
-
total: number;
|
|
11
|
-
needsBuild: number;
|
|
12
|
-
recentlyChanged: number;
|
|
13
|
-
errors: number;
|
|
14
|
-
}
|
|
15
8
|
export interface UseTemplateManager {
|
|
16
9
|
templates: TemplateStatus[];
|
|
17
10
|
updates: TemplateUpdate[];
|
|
18
|
-
stats:
|
|
11
|
+
stats: {
|
|
12
|
+
total: number;
|
|
13
|
+
needsBuild: number;
|
|
14
|
+
recentlyChanged: number;
|
|
15
|
+
errors: number;
|
|
16
|
+
};
|
|
19
17
|
isLoading: boolean;
|
|
20
18
|
errors: Map<string, string>;
|
|
21
19
|
latestPath?: string;
|