UNPKG

@viewdo/dxp-story-cli

Version:
74 lines (62 loc) 2.33 kB
const { resolvePath } = require('../services/utils') // const { getOrganizationAssetConventions } = require('../conventions/scaffold-conventions') module.exports = class OrganizationAssetConfig { constructor(organization_config, existing_asset_config) { // setup defaults Object.assign(this, this._getConfig(organization_config),{ organization_config }) // override from config if(existing_asset_config) Object.assign(this, existing_asset_config) } _getConfig(organization_config) { let config = { name: organization_config.name, sync_file: organization_config.file.path, organization_config } let file_types = this.getFileTypeDefinitions(organization_config) return Object.assign(config, { scripts_html_file: file_types.scripts_html_file.paths[0].local_path, email_layout_file: file_types.email_layout_file.paths[0].local_path, flashboard_css_file: file_types.flashboard_css_file.paths[0].local_path }) } // Organization File Type Definitions --------------------------------------- getFileTypeDefinitions(organization_config = this.organization_config) { return { scripts_html_file: { name: 'Html Script File', description: 'Used for adding script-based widgets to the dashboard page for this org', paths: [{ remote_path: `/organizations/${organization_config.key}/script-file`, local_path: resolvePath(this, 'scripts_html_file') || `${organization_config.root}/dashboard-scripts.html` }] }, flashboard_css_file: { name: 'Flashboard CSS File', description: '', paths: [{ remote_path: `/organizations/${organization_config.key}/flashboard-css`, local_path: resolvePath(this, 'flashboard_css_file') || `${organization_config.root}/flashboards.css` }] }, email_layout_file: { name: 'Email Layout File', description: '', paths: [{ remote_path: `/organizations/${organization_config.key}/email-layout`, local_path: resolvePath(this, 'email_layout_file') || `${organization_config.root}/email-layout.liquid` }] } } } }