@appshuttle.io/turing
Version:
Code Generation Library used in Shuttle
44 lines (33 loc) • 1.38 kB
JavaScript
const fs = require('fs')
const AppIconTemplates = require('../TemplateContent/AppIcon-Templates')
class AppIconMotor {
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.appIconContent = ''
this.templates = new AppIconTemplates()
this.generateAppIcon = function () {
this.generateAppIconContentsStructure()
const context = this
return new Promise((resolve, reject) => {
try {
fs.mkdirSync(context.path)
fs.writeFileSync(context.path + '/Contents.json', context.appIconContent)
resolve()
} catch (error) {
reject(error)
}
})
}
this.generateAppIconContentsStructure = function () {
this.appIconContent = this.templates.getAppIconContentsJSONStructure()
}
}
}
module.exports = AppIconMotor