sb-mig
Version:
CLI to rule the world. (and handle stuff related to Storyblok CMS)
22 lines (21 loc) • 690 B
JavaScript
import { createAndSaveToFile } from "../../utils/files.js";
import Logger from "../../utils/logger.js";
import { getAllStories } from "./stories.js";
export const backupStories = async ({ suffix, spaceId, filename }, config) => {
Logger.log(`Making backup of your stories.`);
await getAllStories({}, { ...config, spaceId })
.then(async (res) => {
await createAndSaveToFile({
ext: "json",
filename: filename,
datestamp: true,
suffix,
folder: "stories",
res,
}, config);
})
.catch((err) => {
Logger.error(err);
Logger.error("error happened... :(");
});
};