const path = require('path'); module.exports = { tags: async (tln) => [], env: async (tln, env) => { env.CORDOVA_HOME = env.TLN_COMPONENT_HOME; env.PATH = [path.join(env.TLN_COMPONENT_HOME, 'node_modules', '.bin'), env.PATH].join(path.delimiter); }, options: async (tln, args) => { args .prefix('TLN_CORDOVA') .option('app', { describe: 'Cordova application folder name', default: 'app', type: 'string' }) .option('platform', { describe: 'Platform to work with', default: null, type: 'string' }); }, dotenvs: async (tln) => [], inherits: async (tln) => [], depends: async (tln) => [], steps: async (tln) => [ { id: 'install', desc: '', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); if (version && tln.canInstallComponent(tln, id, home)) { script.set([ `npm install cordova@${version}`, ]) } } }, { id: 'add-platform', desc: '', builder: async (tln, script) => { const app = script.env.TLN_CORDOVA_APP; const platform = script.env.TLN_CORDOVA_PLATFORM; if (platform) { script.set([ `cd ${app} && cordova platform add ${platform}` ]); } else { tln.logger.error(`Please define platform using --platform parameter`); } } } ], components: async (tln) => require('./components.js') }