@t1mmen/srtd 0.4.2 → 0.4.4
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 +1 -1
- package/dist/__tests__/apply.test.js +2 -2
- package/dist/__tests__/build.test.js +4 -4
- package/dist/__tests__/build.test.js.map +1 -1
- package/dist/__tests__/clear.test.d.ts +1 -0
- package/dist/__tests__/clear.test.js +11 -0
- package/dist/__tests__/clear.test.js.map +1 -0
- package/dist/__tests__/init.test.d.ts +1 -0
- package/dist/__tests__/init.test.js +28 -0
- package/dist/__tests__/init.test.js.map +1 -0
- package/dist/__tests__/register.test.d.ts +1 -0
- package/dist/__tests__/register.test.js +9 -0
- package/dist/__tests__/register.test.js.map +1 -0
- package/dist/__tests__/vitest.setup.js +2 -1
- package/dist/__tests__/vitest.setup.js.map +1 -1
- package/dist/__tests__/watch.test.js +3 -6
- package/dist/__tests__/watch.test.js.map +1 -1
- package/dist/commands/_app.js +1 -9
- package/dist/commands/_app.js.map +1 -1
- package/dist/commands/apply.js +3 -5
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/build.js +5 -6
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/clear.js +12 -5
- package/dist/commands/clear.js.map +1 -1
- package/dist/commands/index.js +6 -12
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/register.d.ts +1 -1
- package/dist/commands/register.js +62 -16
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/watch.js +25 -28
- package/dist/commands/watch.js.map +1 -1
- package/dist/components/Branding.js +1 -1
- package/dist/components/Branding.js.map +1 -1
- package/dist/components/ProcessingResults.js +26 -14
- package/dist/components/ProcessingResults.js.map +1 -1
- package/dist/components/Quittable.js +6 -4
- package/dist/components/Quittable.js.map +1 -1
- package/dist/components/StatBadge.d.ts +6 -0
- package/dist/components/StatBadge.js +14 -0
- package/dist/components/StatBadge.js.map +1 -0
- package/dist/components/TimeSince.js +9 -5
- package/dist/components/TimeSince.js.map +1 -1
- package/dist/hooks/useDatabaseConnection.js +2 -1
- package/dist/hooks/useDatabaseConnection.js.map +1 -1
- package/dist/hooks/useFullscreen.d.ts +1 -0
- package/dist/hooks/useFullscreen.js +18 -0
- package/dist/hooks/useFullscreen.js.map +1 -0
- package/dist/hooks/useTemplateProcessor.js +0 -6
- package/dist/hooks/useTemplateProcessor.js.map +1 -1
- package/dist/lib/templateManager.js +41 -26
- package/dist/lib/templateManager.js.map +1 -1
- package/dist/lib/templateManager.test.js +821 -505
- package/dist/lib/templateManager.test.js.map +1 -1
- package/dist/utils/applyMigrations.test.js +4 -1
- package/dist/utils/applyMigrations.test.js.map +1 -1
- package/dist/utils/databaseConnection.js +21 -19
- package/dist/utils/databaseConnection.js.map +1 -1
- package/dist/utils/databaseConnection.test.js +1 -4
- package/dist/utils/databaseConnection.test.js.map +1 -1
- package/dist/utils/logger.js +6 -5
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/registerTemplate.js +1 -2
- package/dist/utils/registerTemplate.js.map +1 -1
- package/package.json +2 -1
package/dist/commands/watch.js
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
// src/components/watch.tsx
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { Spinner } from '@inkjs/ui';
|
|
4
|
+
import figures from 'figures';
|
|
4
5
|
import { Box, Text, useInput } from 'ink';
|
|
5
6
|
import React, { useMemo } from 'react';
|
|
6
7
|
import Branding from '../components/Branding.js';
|
|
7
8
|
import Quittable from '../components/Quittable.js';
|
|
9
|
+
import { StatBadge } from '../components/StatBadge.js';
|
|
8
10
|
import { TimeSince } from '../components/TimeSince.js';
|
|
9
11
|
import { COLOR_ACCENT, COLOR_ERROR, COLOR_SUCCESS, COLOR_WARNING, } from '../components/customTheme.js';
|
|
10
|
-
import {
|
|
12
|
+
import { useFullscreen } from '../hooks/useFullscreen.js';
|
|
11
13
|
import { useTemplateManager } from '../hooks/useTemplateManager.js';
|
|
12
14
|
import { store } from '../utils/store.js';
|
|
13
15
|
const MAX_FILES = 10;
|
|
14
16
|
const MAX_CHANGES = 15;
|
|
15
17
|
const PATH_DISPLAY_LENGTH = 15;
|
|
16
|
-
function StatBadge({ label, value, color }) {
|
|
17
|
-
return (React.createElement(Box, { marginRight: 1 },
|
|
18
|
-
React.createElement(Badge, { color: color },
|
|
19
|
-
' ',
|
|
20
|
-
label,
|
|
21
|
-
": ",
|
|
22
|
-
value,
|
|
23
|
-
' ')));
|
|
24
|
-
}
|
|
25
18
|
function formatTemplateDisplay(templatePath, templateDir) {
|
|
26
19
|
const parts = templatePath.split(path.sep);
|
|
27
20
|
const filename = parts.pop() || '';
|
|
@@ -39,17 +32,21 @@ const TemplateRow = React.memo(({ template, isLatest, templateDir, }) => {
|
|
|
39
32
|
const displayName = formatTemplateDisplay(template.path, templateDir ?? '');
|
|
40
33
|
const needsBuild = !template.buildState.lastBuildDate ||
|
|
41
34
|
template.currentHash !== template.buildState.lastBuildHash;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
const color = template.buildState.lastAppliedError ? COLOR_ERROR : COLOR_SUCCESS;
|
|
36
|
+
return (React.createElement(Box, { marginLeft: 2, gap: 1 },
|
|
37
|
+
React.createElement(Box, { width: 2, justifyContent: "center" },
|
|
38
|
+
React.createElement(Text, { color: color }, template.buildState.lastAppliedError
|
|
39
|
+
? figures.cross
|
|
40
|
+
: isLatest
|
|
41
|
+
? figures.play
|
|
42
|
+
: figures.tick)),
|
|
45
43
|
React.createElement(Box, { width: 35 },
|
|
46
44
|
React.createElement(Text, null, displayName)),
|
|
47
|
-
React.createElement(Box,
|
|
45
|
+
React.createElement(Box, { minWidth: 18 },
|
|
48
46
|
React.createElement(Text, { dimColor: true },
|
|
49
47
|
"applied ",
|
|
50
|
-
React.createElement(TimeSince, { date: template.buildState.lastAppliedDate }),
|
|
51
|
-
|
|
52
|
-
React.createElement(Text, null, " \u2022 "),
|
|
48
|
+
React.createElement(TimeSince, { date: template.buildState.lastAppliedDate }))),
|
|
49
|
+
React.createElement(Box, null,
|
|
53
50
|
React.createElement(Text, { dimColor: true }, template.wip ? (React.createElement(React.Fragment, null, "wip")) : needsBuild ? (React.createElement(React.Fragment, null, "needs build")) : (React.createElement(React.Fragment, null,
|
|
54
51
|
"built ",
|
|
55
52
|
React.createElement(TimeSince, { date: template.buildState.lastBuildDate }),
|
|
@@ -59,8 +56,9 @@ TemplateRow.displayName = 'TemplateRow';
|
|
|
59
56
|
const UpdateLog = React.memo(({ updates, templateDir, }) => {
|
|
60
57
|
const sortedUpdates = useMemo(() => {
|
|
61
58
|
return [...updates]
|
|
62
|
-
.sort((a, b) => new Date(
|
|
63
|
-
.slice(0, MAX_CHANGES)
|
|
59
|
+
.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()) // Newest first
|
|
60
|
+
.slice(0, MAX_CHANGES) // Take most recent
|
|
61
|
+
.reverse(); // Display oldest to newest
|
|
64
62
|
}, [updates]);
|
|
65
63
|
const formatError = (error) => {
|
|
66
64
|
if (error instanceof Error)
|
|
@@ -74,14 +72,18 @@ const UpdateLog = React.memo(({ updates, templateDir, }) => {
|
|
|
74
72
|
};
|
|
75
73
|
return (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
|
|
76
74
|
React.createElement(Text, { bold: true }, "Changelog:"),
|
|
77
|
-
!sortedUpdates.length && React.createElement(
|
|
75
|
+
!sortedUpdates.length && React.createElement(Spinner, { label: "No updates yet, watching..." }),
|
|
78
76
|
sortedUpdates.map(update => (React.createElement(Box, { key: `${update.template.path}-${update.timestamp}`, marginLeft: 2 },
|
|
79
77
|
React.createElement(Text, { color: update.type === 'error'
|
|
80
78
|
? COLOR_ERROR
|
|
81
79
|
: update.type === 'applied'
|
|
82
80
|
? COLOR_SUCCESS
|
|
83
81
|
: COLOR_ACCENT },
|
|
84
|
-
update.type === 'error'
|
|
82
|
+
update.type === 'error'
|
|
83
|
+
? figures.cross
|
|
84
|
+
: update.type === 'applied'
|
|
85
|
+
? figures.play
|
|
86
|
+
: figures.info,
|
|
85
87
|
' ',
|
|
86
88
|
formatTemplateDisplay(update.template.path, templateDir ?? ''),
|
|
87
89
|
":",
|
|
@@ -94,7 +96,7 @@ const UpdateLog = React.memo(({ updates, templateDir, }) => {
|
|
|
94
96
|
});
|
|
95
97
|
UpdateLog.displayName = 'UpdateLog';
|
|
96
98
|
export default function Watch() {
|
|
97
|
-
|
|
99
|
+
useFullscreen();
|
|
98
100
|
const { templates, updates, stats, isLoading, errors, latestPath, templateDir } = useTemplateManager();
|
|
99
101
|
const [showUpdates, setShowUpdates] = React.useState(store.get('showWatchLogs'));
|
|
100
102
|
const activeTemplates = useMemo(() => templates.slice(-MAX_FILES), [templates]);
|
|
@@ -106,11 +108,6 @@ export default function Watch() {
|
|
|
106
108
|
store.set('showWatchLogs', show);
|
|
107
109
|
}
|
|
108
110
|
});
|
|
109
|
-
if (!isConnected) {
|
|
110
|
-
return (React.createElement(Box, { flexDirection: "column" },
|
|
111
|
-
React.createElement(Text, { color: COLOR_ERROR }, "Unable to connect to database. Is Supabase running?"),
|
|
112
|
-
React.createElement(Quittable, null)));
|
|
113
|
-
}
|
|
114
111
|
return (React.createElement(Box, { flexDirection: "column" },
|
|
115
112
|
React.createElement(Branding, { subtitle: "\uD83D\uDC40 Watch Mode" }),
|
|
116
113
|
React.createElement(Box, { marginBottom: 1 },
|
|
@@ -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,
|
|
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,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,OAAO,MAAM,S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AClC,qBAAqB,CAAC,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC;;wBAAI,MAAM,CAAC,KAAK,CAAC,CAC3D,CACH,CACP,CAAC,CACE,CACP,CACG,CACP;QAED,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC,EAAE,aAAa,EAAC,KAAK,EAAC,GAAG,EAAE,CAAC;YACzC,oBAAC,SAAS,OAAG;YACb;gBACE,oBAAC,GAAG,IAAC,OAAO,EAAE,CAAC;oBACb,oBAAC,IAAI,IAAC,QAAQ,mBAAS,CACnB;gBACN,oBAAC,GAAG,IAAC,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,CACC,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -23,7 +23,7 @@ export default function Branding({ subtitle }) {
|
|
|
23
23
|
React.createElement(Text, { bold: true, color: COLOR_SUPABASE }, "D"),
|
|
24
24
|
"efinitions")),
|
|
25
25
|
React.createElement(Text, { dimColor: true },
|
|
26
|
-
"v",
|
|
26
|
+
" v",
|
|
27
27
|
packageJson.version))));
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=Branding.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Branding.js","sourceRoot":"","sources":["../../src/components/Branding.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,oBAAoB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,cAAc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import { Box, Text } from 'ink';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
4
|
+
import { StatBadge } from './StatBadge.js';
|
|
5
|
+
import { COLOR_ERROR, COLOR_SKIP, COLOR_SUCCESS } from './customTheme.js';
|
|
6
|
+
function ResultSection({ items, label, variant, }) {
|
|
5
7
|
if (items.length === 0)
|
|
6
8
|
return null;
|
|
9
|
+
const icon = variant === 'build' ? figures.tick : variant === 'apply' ? figures.play : figures.pointerSmall;
|
|
10
|
+
const maxItems = 30;
|
|
11
|
+
const itemsToShow = items.slice(0, maxItems);
|
|
12
|
+
const overflow = items.length > maxItems ? `... and ${items.length - maxItems} more` : '';
|
|
13
|
+
const color = variant === 'skip' ? COLOR_SKIP : COLOR_SUCCESS;
|
|
7
14
|
return (React.createElement(Box, { flexDirection: "column" },
|
|
8
|
-
React.createElement(Text,
|
|
15
|
+
React.createElement(Text, { bold: true },
|
|
9
16
|
label,
|
|
10
17
|
":"),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
React.createElement(Box, { marginLeft: 2, flexDirection: "column" },
|
|
19
|
+
itemsToShow.map(item => (React.createElement(Text, { key: item, color: color },
|
|
20
|
+
icon,
|
|
21
|
+
" ",
|
|
22
|
+
item))),
|
|
23
|
+
overflow && React.createElement(Text, { dimColor: true }, overflow))));
|
|
14
24
|
}
|
|
15
25
|
export function ProcessingResults({ result, showBuild = true, showApply = false }) {
|
|
16
26
|
return (React.createElement(Box, { flexDirection: "column", gap: 1 },
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"Skipped ",
|
|
21
|
-
result.skipped.length,
|
|
22
|
-
" template(s)")),
|
|
27
|
+
React.createElement(ResultSection, { items: result.skipped, label: "Skipped", variant: "skip" }),
|
|
28
|
+
showBuild && React.createElement(ResultSection, { items: result.built, label: "Built", variant: "build" }),
|
|
29
|
+
showApply && React.createElement(ResultSection, { items: result.applied, label: "Applied", variant: "apply" }),
|
|
23
30
|
result.errors.length > 0 && (React.createElement(Box, { flexDirection: "column" },
|
|
24
31
|
React.createElement(Text, { color: COLOR_ERROR }, "Errors:"),
|
|
25
32
|
result.errors.map(error => (React.createElement(Text, { key: error.file, color: COLOR_ERROR },
|
|
26
|
-
|
|
33
|
+
figures.cross,
|
|
34
|
+
" ",
|
|
27
35
|
error.templateName,
|
|
28
36
|
": ",
|
|
29
37
|
error.error))))),
|
|
30
|
-
|
|
38
|
+
React.createElement(Box, { marginBottom: 1, gap: 1 },
|
|
39
|
+
result.skipped.length > 0 && (React.createElement(StatBadge, { label: "Skipped", value: result.skipped.length, color: COLOR_SKIP })),
|
|
40
|
+
result.errors.length > 0 && (React.createElement(StatBadge, { label: "Errors", value: result.errors.length, color: COLOR_ERROR })),
|
|
41
|
+
result.built.length > 0 && (React.createElement(StatBadge, { label: "Built", value: result.built.length, color: COLOR_SUCCESS })),
|
|
42
|
+
result.applied.length > 0 && (React.createElement(StatBadge, { label: "Applied", value: result.applied.length, color: COLOR_SUCCESS })))));
|
|
31
43
|
}
|
|
32
44
|
//# sourceMappingURL=ProcessingResults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessingResults.js","sourceRoot":"","sources":["../../src/components/ProcessingResults.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProcessingResults.js","sourceRoot":"","sources":["../../src/components/ProcessingResults.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,O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AAK,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,GAAI,CAC9E;YACA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1B,oBAAC,SAAS,IAAC,KAAK,EAAC,OAAO,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,GAAI,CAC9E;YACA,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAC5B,oBAAC,SAAS,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,GAAI,CAClF,CACG,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
1
|
+
import { Box, Text, useApp, useInput } from 'ink';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
export default function Quittable(props) {
|
|
5
4
|
// Use ref to track if component is mounted
|
|
5
|
+
const { exit } = useApp();
|
|
6
6
|
const mounted = React.useRef(true);
|
|
7
7
|
React.useEffect(() => {
|
|
8
8
|
return () => {
|
|
@@ -18,11 +18,13 @@ export default function Quittable(props) {
|
|
|
18
18
|
props.onQuit();
|
|
19
19
|
}
|
|
20
20
|
// Exit synchronously
|
|
21
|
-
|
|
21
|
+
exit();
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
24
|
console.error('Failed to exit cleanly:', error);
|
|
25
|
-
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
exit(error);
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quittable.js","sourceRoot":"","sources":["../../src/components/Quittable.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
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I,IAAC,QAAQ,mBAAc;QAC5B,oBAAC,IAAI,YAAS;QACd,oBAAC,IAAI,IAAC,QAAQ,iBAAY;QAC1B,oBAAC,IAAI,iBAAc;QACnB,oBAAC,IAAI,IAAC,QAAQ,qBAAgB,CAC1B,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/components/watch.tsx
|
|
2
|
+
import { Badge } from '@inkjs/ui';
|
|
3
|
+
import { Box } from 'ink';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export function StatBadge({ label, value, color, }) {
|
|
6
|
+
return (React.createElement(Box, { marginRight: 1 },
|
|
7
|
+
React.createElement(Badge, { color: color },
|
|
8
|
+
' ',
|
|
9
|
+
label,
|
|
10
|
+
": ",
|
|
11
|
+
value,
|
|
12
|
+
' ')));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=StatBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatBadge.js","sourceRoot":"","sources":["../../src/components/StatBadge.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,KAAK,GAC2C;IAChD,OAAO,CACL,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;QACjB,oBAAC,KAAK,IAAC,KAAK,EAAE,KAAK;YAChB,GAAG;YACH,KAAK;;YAAI,KAAK;YAAE,GAAG,CACd,CACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Text } from 'ink';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { COLOR_SUCCESS } from './customTheme.js';
|
|
3
4
|
export const TimeSince = ({ date }) => {
|
|
4
5
|
const [now, setNow] = React.useState(new Date());
|
|
5
6
|
React.useEffect(() => {
|
|
@@ -8,22 +9,25 @@ export const TimeSince = ({ date }) => {
|
|
|
8
9
|
}, []);
|
|
9
10
|
if (!date)
|
|
10
11
|
return React.createElement(Text, null, "never");
|
|
11
|
-
const
|
|
12
|
+
const parsedDate = new Date(date);
|
|
13
|
+
const diff = Math.abs(now.getTime() - parsedDate.getTime());
|
|
12
14
|
const seconds = Math.floor(diff / 1000);
|
|
15
|
+
if (seconds < 5)
|
|
16
|
+
return React.createElement(Text, { color: COLOR_SUCCESS }, "just now");
|
|
13
17
|
if (seconds < 60)
|
|
14
18
|
return React.createElement(Text, null,
|
|
15
19
|
seconds,
|
|
16
|
-
"s");
|
|
20
|
+
"s ago");
|
|
17
21
|
if (seconds < 3600)
|
|
18
22
|
return React.createElement(Text, null,
|
|
19
23
|
Math.floor(seconds / 60),
|
|
20
|
-
"m");
|
|
24
|
+
"m ago");
|
|
21
25
|
if (seconds < 86400)
|
|
22
26
|
return React.createElement(Text, null,
|
|
23
27
|
Math.floor(seconds / 3600),
|
|
24
|
-
"h");
|
|
28
|
+
"h ago");
|
|
25
29
|
return React.createElement(Text, null,
|
|
26
30
|
Math.floor(seconds / 86400),
|
|
27
|
-
"d");
|
|
31
|
+
"d ago");
|
|
28
32
|
};
|
|
29
33
|
//# sourceMappingURL=TimeSince.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSince.js","sourceRoot":"","sources":["../../src/components/TimeSince.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TimeSince.js","sourceRoot":"","sources":["../../src/components/TimeSince.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aA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AAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;gBAAa,CAAC;AACzD,CAAC,CAAC"}
|
|
@@ -17,6 +17,7 @@ export function useDatabaseConnection(checkInterval = 3000) {
|
|
|
17
17
|
const [state, setState] = useState({
|
|
18
18
|
isConnected: false,
|
|
19
19
|
isChecking: true,
|
|
20
|
+
error: undefined,
|
|
20
21
|
});
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
let mounted = true;
|
|
@@ -25,9 +26,9 @@ export function useDatabaseConnection(checkInterval = 3000) {
|
|
|
25
26
|
return;
|
|
26
27
|
setState(prev => ({ ...prev, isChecking: true }));
|
|
27
28
|
try {
|
|
28
|
-
const isConnected = await testConnection();
|
|
29
29
|
if (!mounted)
|
|
30
30
|
return;
|
|
31
|
+
const isConnected = await testConnection();
|
|
31
32
|
setState({
|
|
32
33
|
isConnected,
|
|
33
34
|
error: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDatabaseConnection.js","sourceRoot":"","sources":["../../src/hooks/useDatabaseConnection.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAQhE,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,oCAAoC,CAAC,EAAE,CAAC;YACjE,OAAO,gDAAgD,CAAC;QAC1D,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAC3C,OAAO,qDAAqD,CAAC;QAC/D,CAAC;QACD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC;IACvD,CAAC;IACD,O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AAC,WAAW,CAAC,CAAC,CAAC;IAEvC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFullscreen(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// hooks/useFullscreen.ts
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
const ENTER_FULLSCREEN = '\x1b[?1049h';
|
|
4
|
+
const EXIT_FULLSCREEN = '\x1b[?1049l';
|
|
5
|
+
export function useFullscreen() {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
process.stdout.write(ENTER_FULLSCREEN);
|
|
8
|
+
const cleanup = () => {
|
|
9
|
+
process.stdout.write(EXIT_FULLSCREEN);
|
|
10
|
+
};
|
|
11
|
+
process.on('exit', cleanup);
|
|
12
|
+
return () => {
|
|
13
|
+
cleanup();
|
|
14
|
+
process.off('exit', cleanup);
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=useFullscreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFullscreen.js","sourceRoot":"","sources":["../../src/hooks/useFullscreen.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC,MAAM,UAAU,aAAa;IAC3B,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAEvC,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACxC,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5B,OAAO,GAAG,EAAE;YACV,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -25,9 +25,6 @@ export function useTemplateProcessor(options) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
const result = await managerRef.current.processTemplates(options);
|
|
28
|
-
if (options.apply) {
|
|
29
|
-
await disconnect();
|
|
30
|
-
}
|
|
31
28
|
if (mounted) {
|
|
32
29
|
setResult(result);
|
|
33
30
|
setIsProcessing(false);
|
|
@@ -35,9 +32,6 @@ export function useTemplateProcessor(options) {
|
|
|
35
32
|
}
|
|
36
33
|
catch (err) {
|
|
37
34
|
console.error('Processing error:', err);
|
|
38
|
-
if (options.apply) {
|
|
39
|
-
await disconnect();
|
|
40
|
-
}
|
|
41
35
|
if (mounted) {
|
|
42
36
|
setResult(prev => ({
|
|
43
37
|
...prev,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTemplateProcessor.js","sourceRoot":"","sources":["../../src/hooks/useTemplateProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAQ5D,MAAM,UAAU,oBAAoB,CAAC,OAAyB;IAC5D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA0B;QAC5D,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,EAAE;KACV,CAAC,CAAC;IACH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,MAAM,EAAmB,CAAC;IAC7C,MAAM,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ACnC,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;gBACvB,KAAK,UAAU,EAAE,CAAC;gBAClB,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;gBACvC,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;gBAC/B,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -5,7 +5,6 @@ import { glob } from 'glob';
|
|
|
5
5
|
import { applyMigration } from '../utils/applyMigration.js';
|
|
6
6
|
import { calculateMD5 } from '../utils/calculateMD5.js';
|
|
7
7
|
import { getConfig } from '../utils/config.js';
|
|
8
|
-
import { testConnection } from '../utils/databaseConnection.js';
|
|
9
8
|
import { getNextTimestamp } from '../utils/getNextTimestamp.js';
|
|
10
9
|
import { isWipTemplate } from '../utils/isWipTemplate.js';
|
|
11
10
|
import { loadBuildLog } from '../utils/loadBuildLog.js';
|
|
@@ -104,8 +103,7 @@ export class TemplateManager extends EventEmitter {
|
|
|
104
103
|
}
|
|
105
104
|
if (!this.processing) {
|
|
106
105
|
this.processing = true;
|
|
107
|
-
|
|
108
|
-
setImmediate(() => void this.processNextTemplate());
|
|
106
|
+
await this.processNextTemplate();
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
async processTemplate(templatePath, force = false) {
|
|
@@ -171,7 +169,7 @@ export class TemplateManager extends EventEmitter {
|
|
|
171
169
|
}
|
|
172
170
|
finally {
|
|
173
171
|
this.processingTemplate = null;
|
|
174
|
-
|
|
172
|
+
await this.processNextTemplate();
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
175
|
async watch() {
|
|
@@ -279,17 +277,27 @@ export class TemplateManager extends EventEmitter {
|
|
|
279
277
|
const footer = `${this.config.footer}\n-- Last built: ${lastBuildAt || 'Never'}\n-- Built with https://github.com/t1mmen/srtd\n`;
|
|
280
278
|
const safeContent = this.config.wrapInTransaction ? `BEGIN;\n\n${content}\n\nCOMMIT;` : content;
|
|
281
279
|
const migrationContent = `${header}${banner}\n${safeContent}\n${footer}`;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
280
|
+
try {
|
|
281
|
+
await fs.writeFile(path.resolve(this.baseDir, migrationPath), migrationContent);
|
|
282
|
+
this.buildLog.templates[relPath] = {
|
|
283
|
+
...this.buildLog.templates[relPath],
|
|
284
|
+
lastBuildHash: currentHash,
|
|
285
|
+
lastBuildDate: new Date().toISOString(),
|
|
286
|
+
lastMigrationFile: migrationName,
|
|
287
|
+
lastBuildError: undefined,
|
|
288
|
+
};
|
|
289
|
+
this.invalidateCache(templatePath);
|
|
290
|
+
await this.saveBuildLogs();
|
|
291
|
+
this.emit('templateBuilt', template);
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
this.buildLog.templates[relPath] = {
|
|
295
|
+
...this.buildLog.templates[relPath],
|
|
296
|
+
lastBuildError: error instanceof Error ? error.message : String(error),
|
|
297
|
+
};
|
|
298
|
+
await this.saveBuildLogs();
|
|
299
|
+
this.emit('templateError', { template, error });
|
|
300
|
+
}
|
|
293
301
|
}
|
|
294
302
|
log(msg, logLevel = 'info') {
|
|
295
303
|
if (this.silent)
|
|
@@ -301,21 +309,28 @@ export class TemplateManager extends EventEmitter {
|
|
|
301
309
|
const result = { errors: [], applied: [], built: [], skipped: [] };
|
|
302
310
|
this.log('\n');
|
|
303
311
|
if (options.apply) {
|
|
304
|
-
const connectionTimeout = new Promise((_, reject) => setTimeout(() => reject(new Error('Database connection timeout')), 1000));
|
|
305
|
-
const isConnected = await Promise.race([testConnection(), connectionTimeout]);
|
|
306
|
-
if (!isConnected) {
|
|
307
|
-
this.log('Failed to connect to database, cannot proceed. Is Supabase running?', 'error');
|
|
308
|
-
return result;
|
|
309
|
-
}
|
|
310
|
-
this.log('Connected to database', 'success');
|
|
311
312
|
const action = options.force ? 'Force applying' : 'Applying';
|
|
312
313
|
this.log(`${action} changed templates to local database...`, 'success');
|
|
313
314
|
// Process all templates
|
|
314
315
|
for (const templatePath of templates) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
try {
|
|
317
|
+
const processResult = await this.processTemplate(templatePath, options.force);
|
|
318
|
+
if (processResult) {
|
|
319
|
+
result.errors.push(...(processResult.errors || []));
|
|
320
|
+
result.applied.push(...(processResult.applied || []));
|
|
321
|
+
result.skipped.push(...(processResult.skipped || []));
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
throw new Error('No result from processing template');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
result.errors.push({
|
|
329
|
+
file: templatePath,
|
|
330
|
+
templateName: templatePath,
|
|
331
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
332
|
+
});
|
|
333
|
+
}
|
|
319
334
|
}
|
|
320
335
|
if (result.applied.length === 0 && result.errors.length === 0) {
|
|
321
336
|
this.log('No changes to apply', 'skip');
|