UNPKG

@appshuttle.io/turing

Version:
43 lines (32 loc) 1.34 kB
const fs = require('fs') const XCAssetsTemplates = require('../TemplateContent/XCAssets-Templates') class XCAssetsMotor { constructor(path, project, screenPointers, screens) { if (!path) throw new Error('No app delegate 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 this.project = project this.screenPointers = screenPointers this.screens = screens this.xcAssetsContent = '' this.templates = new XCAssetsTemplates() this.generateXCAssets = function () { this.generateXCAssetsContentsStructure() const context = this return new Promise((resolve, reject) => { try { fs.writeFileSync(context.path + '/Contents.json', context.xcAssetsContent) resolve() } catch (error) { reject(error) } }) } this.generateXCAssetsContentsStructure = function () { this.xcAssetsContent = this.templates.getXCAssetsContentsJSONStructure() } } } module.exports = XCAssetsMotor