@statezero/core
Version:
The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate
23 lines (22 loc) • 998 B
JavaScript
import dotenv from "dotenv";
dotenv.config();
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { generateSchema } from "./commands/syncModels.js";
import { generateActions } from "./commands/syncActions.js";
import { sync } from "./commands/sync.js"; // Import the new combined sync function
yargs(hideBin(process.argv))
// The new 'sync' command
.command("sync", "Synchronize both models and actions from the backend", {}, // Builder for command-specific options (if any)
async (argv) => {
await sync(argv);
})
.command("sync-models", "Generate model classes from the backend schema", {}, async (argv) => {
await generateSchema(argv);
})
.command("sync-actions", "Generate action functions from the backend schema", {}, async (argv) => {
await generateActions(); // This function does not take arguments
})
.demandCommand(1, "You must provide a command to run. Use --help to see available commands.")
.help().argv;