UNPKG

@appshuttle.io/turing

Version:
53 lines (39 loc) 1.59 kB
const fs = require('fs') const StoryboardMotor = require('./GenerationMotors/Storyboard-Motor') class iOSStoryboardGenerator { constructor(path, project, screenPointers, screens) { if (!path) throw new Error('No pbxproj path is specified') if (!project) throw new Error('No project is specified') if (!screenPointers) throw new Error('No screen pointers were specified') if (!screens) throw new Error('No screens were specified') this.path = path + '/Base.lproj' this.project = project this.screenPointers = screenPointers this.screens = screens this.storyboardMotor = new StoryboardMotor(this.path + '/Main.storyboard', project, screenPointers, screens) this.generateMainStoryboard = function () { try { if (!fs.existsSync(this.path)){ fs.mkdirSync(this.path); } } catch (err) { return } var generatePromises = [] generatePromises.push(this.storyboardMotor.generateMainStoryboard()) const context = this return new Promise((resolve, reject) => { Promise.all(generatePromises).then(function (values) { try { resolve() } catch (error) { reject(error) } }).catch(function (error) { reject(error) }) }) } } } module.exports = iOSStoryboardGenerator