UNPKG

@viewdo/dxp-story-cli

Version:
24 lines (16 loc) 1.03 kB
const Unpack = require('./app'); module.exports = (story_keys = [], ivx_config = {}, _console = console) => { const { output, directory, stories, source } = ivx_config; let current_output = output; if (!current_output) current_output = directory; story_keys.forEach(story_key => { const { episodes = {}, json_file: default_json_file_path = `${current_output}/${story_key}/story.json` } = stories[story_key]; const default_story_file_unpacker = new Unpack(source, _console, { story_key, episode_key: null }); default_story_file_unpacker.unpackFromFile(default_json_file_path); Object.keys(episodes).forEach(episode_key => { const { json_file: episode_json_file_path = `${current_output}/${story_key}/episodes/${episode_key}/story.json` } = episodes[episode_key] || {}; const episode_file_reader = new Unpack(source, _console, { story_key, episode_key }); episode_file_reader.unpackFromFile(episode_json_file_path); }); }); }