@jungvonmatt/sb-migrate
Version:
CLI tool for managing Storyblok schema and content migrations
54 lines • 2.82 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const config_1 = require("../src/commands/config");
const login_1 = require("../src/commands/login");
const pull_components_1 = require("../src/commands/pull-components");
const generate_types_1 = require("../src/commands/generate-types");
const generate_migration_1 = require("../src/commands/generate-migration");
const run_1 = require("../src/commands/run");
const package_json_1 = __importDefault(require("../package.json"));
const program = new commander_1.Command();
program
.name("sb-migrate")
.description("CLI tool for managing Storyblok schema and content migrations with TypeScript support.")
.version(package_json_1.default.version);
program
.command("config")
.description("Configure Storyblok credentials")
.action(config_1.configureStoryblok);
program
.command("login")
.description("Login to Storyblok CLI using configured credentials")
.action(login_1.loginToStoryblok);
program
.command("pull-components")
.description("Pull components from Storyblok space")
.action(pull_components_1.pullComponents);
program
.command("generate-types")
.description("Generate TypeScript types from Storyblok components schema")
.action(generate_types_1.generateTypes);
program
.command("generate-migration")
.description("Generate a migration file for a schema or content migration")
.option("-t,--type <TYPE>", "Type of migration (e.g. 'create-component')")
.option("-n, --name <NAME>", "Name of the migration")
.action((options) => (0, generate_migration_1.generateMigration)(options));
program
.command("run")
.description("Run a schema or content migration file against Storyblok. If no file is specified, you can select from available migrations.")
.argument("[file]", "Path to the migration file (optional)")
.option("-d, --dry-run", "Preview changes without applying them", false)
.option("-s, --space <id>", "Storyblok space ID (overrides config)")
.option("-t, --token <token>", "Storyblok OAuth token (overrides config)")
.option("-p, --publish <mode>", "Publish mode (all, published, published-with-changes)", "published")
.option("-l, --languages <langs>", "Languages to publish (default: ALL_LANGUAGES)", "ALL_LANGUAGES")
.option("--throttle <ms>", "Add delay between API requests to avoid rate limiting (in milliseconds, default: 333ms = 3 requests per second)", (value) => parseInt(value, 10))
.action((filePath, options) => (0, run_1.run)(filePath, options));
program.parse();
//# sourceMappingURL=cli.js.map