UNPKG

@statezero/core

Version:

The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate

31 lines (30 loc) • 1.29 kB
import { generateSchema } from "./syncModels.js"; import { generateActions } from "./syncActions.js"; /** * Executes a full synchronization, running sync-models first, * followed by sync-actions. * @param {object} args - Command-line arguments, passed from yargs. */ export async function sync(args = {}) { try { console.log("šŸš€ Starting full synchronization..."); // --- Step 1: Synchronize Models --- console.log("\n----- Running Model Synchronization -----"); // Pass args down, as generateSchema expects an object await generateSchema(args); console.log("----- Model Synchronization Complete -----\n"); // --- Step 2: Synchronize Actions --- console.log("----- Running Action Synchronization -----"); // generateActions does not require args based on its definition await generateActions(); console.log("----- Action Synchronization Complete -----\n"); console.log("āœ… Full synchronization finished successfully!"); } catch (error) { console.error("\nāŒ A critical error occurred during full synchronization:", error.message); if (process.env.DEBUG) { console.error("Stack trace:", error.stack); } process.exit(1); } }