UNPKG

@t1mmen/srtd

Version:

Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀

36 lines 1.46 kB
// commands/build.tsx import { Spinner } from '@inkjs/ui'; import { Box, useApp } from 'ink'; import { option } from 'pastel'; import React from 'react'; import zod from 'zod'; import Branding from '../components/Branding.js'; import { ProcessingResults } from '../components/ProcessingResults.js'; import { useTemplateProcessor } from '../hooks/useTemplateProcessor.js'; export const options = zod.object({ force: zod.boolean().describe(option({ description: 'Force building of all templates, irrespective of changes', alias: 'f', })), apply: zod .boolean() .optional() .describe(option({ description: 'Apply the built templates', alias: 'a', })), }); export default function Build({ options }) { const { exit } = useApp(); const { result, isProcessing } = useTemplateProcessor({ force: options.force, apply: options.apply, generateFiles: true, onComplete: () => exit(), // Move exit here }); const forced = options.force ? '(forced)' : ''; return (React.createElement(Box, { flexDirection: "column", gap: 1 }, React.createElement(Branding, { subtitle: `🏗️ Build migrations ${forced}` }), isProcessing ? (React.createElement(Spinner, { label: `Building templates...` })) : (React.createElement(ProcessingResults, { result: result, showBuild: true, showApply: !!option.apply })))); } //# sourceMappingURL=build.js.map