_(parsedServices) .map(service => getServiceToolingByType(service, app)) .flatten() .filter(service => service.name) .map(service => ([service.name, _.omit(service, 'name')])) .fromPairs() .value()
/* * Determine whether we are in a browser or not * * While setting the config.mode is helpful this is a deeper check so that we * know how to handle the process object in things shell attaching, stream piping * stdin reading, etc * * @TODO: We might want to either expand the version checks or maybe do a lower * level check of the process file descriptors */ const isBrowser = () => _(process.versions) .reduce((isBrowser, version, thing) => (isBrowser || _.includes(browsers, thing)), false)
_(services) .groupBy('platformsh.type') .map((service, type) => _.merge({}, {type}, { services: _.flatten(_.map(service, s => parsedRelationships[s.name])), })) .value()
_(config) .flatMap(service => service) .map(url => exports.parseUrl(url)) .map(data => `${data.host}${data.pathname}:${data.port}`) .countBy() .value()
/* * Helper to normalize routes into arrays */ const normalizeRoutes = (routes = {}) => _(routes) .map((data, key) => _.merge({}, data, {key})) .value()
_(app.services) // Objectify .map(service => _.merge({name: service}, _.get(app, `config.services.${service}`, {}))) // Set the default .map(config => _.merge({}, config, {app_mount: _.get(config, 'app_mount', 'cached')})) // Filter out disabled mountes .filter(config => config.app_mount !== false && config.app_mount !== 'disabled') // Combine together .map(config => ([config.name, {volumes: [`${app.root}:/app:${config.app_mount}`]}])) .fromPairs() .value()
_(keys) .map(service => data) .map((service, index) => _.set({}, keys[index], service)) .thru(services => _.reduce(services, (sum, service) => _.merge(sum, service), {})) .value()
_(services) // Filter out services that are not supported yet .filter(service => getLandoServiceType(service.type) !== false) // Merge in other needed lando things .map(service => _.merge({}, getLandoService(service))) // Finally map to an object .map(service => ([service.name, service])).fromPairs() .value()
// Helper to sort tokens const sortTokens = (...sources) => _(_.flatten([...sources])) .sortBy('date') .groupBy('user') .map(tokens => _.last(tokens)) .value()
/* * Helper to get the applications environment variables */ const getEnvironmentVariables = appConfig => _(_.get(appConfig, 'variables.env', {})) .map((value, key) => ([key, (_.isObject(value)) ? JSON.stringify(value) : value])) .fromPairs() .value()
_(services) .map(service => getServiceToolingByType(service)) .filter(tools => !_.isEmpty(tools)) .map(tools => _.map(tools, (config, name) => ([name, config]))) .flatten() .fromPairs() .value()
_(relationships) .map(relationship => relationship) .flatten() .map('service') .uniqBy() .value()
/* * Helper to get dynamic service keys for stripping */ const getDynamicKeys = (answer, answers = {}) => _(answers) .map((value, key) => ({key, value})) .filter(data => data.value === answer) .map(data => data.key) .map(key => (_.size(key) === 1) ? `-${key}` : `--${key}`) .value()
_(relationships) .map((relationship, name) => _.merge({}, relationship[0], {relationship: name})) .groupBy('service') .value()
_(options) .keys() .sortBy() .map(key => [key, options[key]]) .fromPairs() .value()